WindowData

ceramic.Entitytracker.Modelelements.WindowData (Class)

Persistent data model for window state and configuration.

This class manages the persistent state of a window including its position, size, visibility settings, and contained items. It handles the lifecycle of window items and provides frame-based management for efficient UI updates.

Features

  • Position and size persistence
  • Expandable/collapsible state management
  • Scrollbar configuration
  • Window item lifecycle management
  • Frame-based usage tracking
  • Overlay and dialog support

Frame Management

The window data uses a frame-based system where:

  1. beginFrame() marks the start of a new frame and resets usage tracking
  2. Items are added/accessed during the frame
  3. endFrame() cleans up unused items and updates persistent data

Usage Examples

// Create window data
var windowData = new WindowData();
windowData.x = 100;
windowData.y = 50;
windowData.width = 300;
windowData.height = 400;

// Frame lifecycle
windowData.beginFrame();
// ... add items during frame
windowData.addItem(someWindowItem);
windowData.endFrame();

Static Members

elements
DEFAULT_WIDTH: Float

Default width for new windows when no specific width is set.


elements
DEFAULT_HEIGHT: Float

Default height for new windows, using ViewSize.auto() for automatic sizing. The negative value represents ViewSize.auto() which allows the window to size itself based on its content.

Instance Members

elements
x: Float

The X position of the window on screen. This value is automatically updated when the window is moved.

@default 50


elements
y: Float

The Y position of the window on screen. This value is automatically updated when the window is moved.

@default 50


elements
width: Float

The width of the window. This value is automatically updated when the window is resized.

@default 50


elements
height: Float

The height of the window. This value is automatically updated when the window is resized.

@default 50


elements
expanded: Bool

Whether the window is currently expanded (visible) or collapsed. When false, the window content is hidden but the title bar may remain visible.

@default true


Whether the window should display a header/title bar. When false, the window appears without a title bar.

@default true


elements
scrollbar: ScrollbarVisibility

The scrollbar visibility mode for the window content. Controls when and how scrollbars are displayed.

@default AUTO_ADD


elements
computedContentHeight: Float

The computed height of the window content area. This is calculated based on the contained items and layout.


Array of window items contained in this window. Items are managed through the frame lifecycle system.

See: WindowItem, addItem

elements
numItems: Int

The number of items currently in the window. This reflects the number of items added during the current frame.


elements
theme: Theme

The theme used for styling this window. If null, a default theme will be used.


elements
form: FormLayout

The form layout used to organize window items. This handles the vertical arrangement of items within the window.


elements
filler: ceramic.View

A filler view used for spacing or layout purposes.


elements
scrollable: Bool

Whether the window content is scrollable. When true, the window can display scrollbars if needed.


elements
didScrollWithHeight: Int

The height value when scrolling was last detected. Used for scroll state management. @private


elements
used: Bool

Whether this window data is currently being used. Windows marked as unused are cleaned up during endFrame().


elements
justClosed: Bool

Whether this window was just closed. Used for tracking recent closure events.


elements
closable: Bool

Whether the window can be closed by the user. When true, a close button is typically displayed.


elements
movable: Bool

Whether the window can be moved by dragging. When true, the user can drag the window around the screen.


elements
collapsible: Bool

Whether the window can be collapsed/expanded. When true, the user can toggle the window's expanded state.


elements
overlay: Bool

Whether this window is displayed as an overlay. Overlay windows typically appear above other content with special styling.


elements
overlayTheme: Theme

Special theme used when the window is in overlay mode. If null, the regular theme is used even for overlays.


elements
overlayClicked: Bool

Whether the overlay background was clicked. Used for handling overlay dismissal interactions.


elements
titleAlign: Anonymous

Text alignment for the window title. Controls how the title text is aligned in the title bar.


elements
targetX: Float

Target X position for window positioning. Used for animated positioning or special placement logic.


elements
targetY: Float

Target Y position for window positioning. Used for animated positioning or special placement logic.


elements
targetAnchorX: Float

Target anchor X value for window positioning. Used for special alignment and positioning calculations.


elements
targetAnchorY: Float

Target anchor Y value for window positioning. Used for special alignment and positioning calculations.


elements
window: Window

Reference to the actual Window visual that displays this data. This links the data model to its visual representation.


elements
invalidateX(): Void

elements
invalidateY(): Void

elements
invalidateWidth(): Void

elements
invalidateHeight(): Void

elements
invalidateExpanded(): Void

elements
invalidateHeader(): Void

elements
invalidateScrollbar(): Void

elements
beginFrame(): Void

Begins a new frame for window processing.

Marks the window as unused and resets the item index for the new frame. This should be called at the start of each frame before adding items. Windows that remain unused after endFrame() will be cleaned up.


elements
endFrame(): Void

Ends the current frame and performs cleanup.

If the window was not used during this frame, it will be destroyed. Otherwise, the current position is saved to persist window location. Any unused items beyond the current itemIndex are recycled.


elements
addItem(item: WindowItem): Void

Adds an item to the window at the current item index.

The item is placed at the current itemIndex position, and any existing item at that position has its previous item recycled. The itemIndex is then incremented for the next item.

Name Type Description
item WindowItem The WindowItem to add to the window *

elements
new(): Void

Creates a new WindowData instance with default values.

Private Members

elements
unobservedX: Float

elements
unobservedY: Float

elements
unobservedWidth: Float

elements
unobservedHeight: Float

elements
unobservedExpanded: Bool

elements
unobservedHeader: Bool

elements
unobservedScrollbar: ScrollbarVisibility

elements
itemIndex: Int

Current index for item management during frame processing. @private


elements
emitXChange(current: Float, previous: Float): Void

Event when x field changes.

Name Type
current Float
previous Float

elements
emitYChange(current: Float, previous: Float): Void

Event when y field changes.

Name Type
current Float
previous Float

elements
emitWidthChange(current: Float, previous: Float): Void

Event when width field changes.

Name Type
current Float
previous Float

elements
emitHeightChange(current: Float, previous: Float): Void

Event when height field changes.

Name Type
current Float
previous Float

elements
emitExpandedChange(current: Bool, previous: Bool): Void

Event when expanded field changes.

Name Type
current Bool
previous Bool

elements
emitHeaderChange(current: Bool, previous: Bool): Void

Event when header field changes.

Name Type
current Bool
previous Bool

elements
emitScrollbarChange(current: ScrollbarVisibility, previous: ScrollbarVisibility): Void

Event when scrollbar field changes.

Name Type
current ScrollbarVisibility
previous ScrollbarVisibility

Metadata

Name Parameters
:build tracker.macros.EventsMacro.build()
:autoBuild tracker.macros.EventsMacro.build()
:build ceramic.macros.EntityMacro.buildForCompletion()
:autoBuild ceramic.macros.EntityMacro.buildForCompletion()
:build tracker.macros.ObservableMacro.build()
:autoBuild tracker.macros.ObservableMacro.build()
:build tracker.macros.SerializableMacro.build()
:autoBuild tracker.macros.SerializableMacro.build()