WindowData
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:
beginFrame()
marks the start of a new frame and resets usage tracking- Items are added/accessed during the frame
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
Default width for new windows when no specific width is set.
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
The X position of the window on screen. This value is automatically updated when the window is moved.
@default 50
The Y position of the window on screen. This value is automatically updated when the window is moved.
@default 50
The width of the window. This value is automatically updated when the window is resized.
@default 50
The height of the window. This value is automatically updated when the window is resized.
@default 50
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
The scrollbar visibility mode for the window content. Controls when and how scrollbars are displayed.
@default AUTO_ADD
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.
The number of items currently in the window. This reflects the number of items added during the current frame.
The theme used for styling this window. If null, a default theme will be used.
The form layout used to organize window items. This handles the vertical arrangement of items within the window.
A filler view used for spacing or layout purposes.
Whether the window content is scrollable. When true, the window can display scrollbars if needed.
The height value when scrolling was last detected. Used for scroll state management. @private
Whether this window data is currently being used. Windows marked as unused are cleaned up during endFrame().
Whether this window was just closed. Used for tracking recent closure events.
Whether the window can be closed by the user. When true, a close button is typically displayed.
Whether the window can be moved by dragging. When true, the user can drag the window around the screen.
Whether the window can be collapsed/expanded. When true, the user can toggle the window's expanded state.
Whether this window is displayed as an overlay. Overlay windows typically appear above other content with special styling.
Special theme used when the window is in overlay mode. If null, the regular theme is used even for overlays.
Whether the overlay background was clicked. Used for handling overlay dismissal interactions.
Text alignment for the window title. Controls how the title text is aligned in the title bar.
Target X position for window positioning. Used for animated positioning or special placement logic.
Target Y position for window positioning. Used for animated positioning or special placement logic.
Target anchor X value for window positioning. Used for special alignment and positioning calculations.
Target anchor Y value for window positioning. Used for special alignment and positioning calculations.
Reference to the actual Window visual that displays this data. This links the data model to its visual representation.
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.
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.
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 * |
Creates a new WindowData instance with default values.
Private Members
Current index for item management during frame processing. @private
Event when x field changes.
Name | Type |
---|---|
current |
Float |
previous |
Float |
Event when y field changes.
Name | Type |
---|---|
current |
Float |
previous |
Float |
Event when width field changes.
Name | Type |
---|---|
current |
Float |
previous |
Float |
Event when height field changes.
Name | Type |
---|---|
current |
Float |
previous |
Float |
Event when expanded field changes.
Name | Type |
---|---|
current |
Bool |
previous |
Bool |
Event when header field changes.
Name | Type |
---|---|
current |
Bool |
previous |
Bool |
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() |