Class: UiViewStack
A stack of UI views.
UI views are registered with the stack and can be opened and closed within the stack as pages or popups. The stack has two layers: a main layer and an overlay layer. At any given time, the main layer contains one view opened as a page and zero or more views opened as popups, while the overlay layer contains zero or more views opened as popups. Views opened in the overlay layer always sit on top of views opened in the main layer. The open page is always located at the bottom of the main layer. The view stack keeps track of individual history states as views are opened and supports reverting to previous history states.
The view stack handles routing of UI interaction events to the appropriate open views in the stack. Additionally, bezel rotary knob label states requested by open views are processed and synthesized into a single knob label state based on which views have priority to handle the knob interaction events.
Implements
Constructors
constructor
• new UiViewStack(uiService
): UiViewStack
Creates a new instance of UiViewStack.
Parameters
Name | Type | Description |
---|---|---|
uiService | UiService | The UI service controlling this view stack. |
Returns
Defined in
src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiViewStack.tsx:243
Properties
activeView
• Readonly
activeView: Subscribable
<RenderedViewEntry
<UiView
<UiViewProps
>>>
This view stack's currently active view.
Defined in
src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiViewStack.tsx:225
knobLabelState
• Readonly
knobLabelState: SubscribableMap
<UiKnobId
, string
> & Subscribable
<UiKnobRequestedLabelState
>
This view stack's requested bezel rotary knob label state.
Defined in
src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiViewStack.tsx:235
openPage
• Readonly
openPage: Subscribable
<RenderedViewEntry
<UiView
<UiViewProps
>>>
This view stack's currently open page.
Defined in
src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiViewStack.tsx:229
Methods
attachToContainer
▸ attachToContainer(container
): void
Attaches this view stack to a container.
Parameters
Name | Type | Description |
---|---|---|
container | UiViewStackContainer | The container to which to attach. |
Returns
void
Throws
Error if this view stack has already been attached to a container.
Defined in
src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiViewStack.tsx:329
changePageTo
▸ changePageTo<T
>(key
): RenderedUiViewEntry
<T
>
Opens a view as a page and changes the current page to the opened view. This will close the current page and any open popups.
Type parameters
Name | Type |
---|---|
T | extends UiView <UiViewProps > = UiView <UiViewProps > |
Parameters
Name | Type | Description |
---|---|---|
key | string | The key of the view to open. |
Returns
The entry of the opened view.
Throws
Error if this view stack is not attached to a container, there is no view registered under the specified key, or the view to open is already open.
Defined in
src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiViewStack.tsx:632
closeAllOverlayViews
▸ closeAllOverlayViews(skipPopupCloseAnimation?
): RenderedUiViewEntry
Returns to the most recent history state of this view stack in which the overlay layer contains no open views.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
skipPopupCloseAnimation | boolean | false | Whether to skip playing the close animations for popups. Defaults to false . |
Returns
The active view entry in this stack after the operation is complete.
Throws
Error if this view stack is not attached to a container.
Defined in
src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiViewStack.tsx:926
goBack
▸ goBack(): RenderedUiViewEntry
Returns to the most recent previous history state of this view stack. If there is no previous history state to which to return, then this method does nothing.
Returns
The active view entry in this stack after the operation is complete.
Throws
Error if this view stack is not attached to a container.
Defined in
src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiViewStack.tsx:840
goBackTo
▸ goBackTo(selector
): RenderedUiViewEntry
Attempts to return to a previous history state of this view stack.
Parameters
Name | Type | Description |
---|---|---|
selector | (steps : number , stackPeeker : (depth : number ) => undefined | UiViewStackItem ) => boolean | A function which selects the history state to which to return. The function is called once for each history state in order of increasing age and takes two arguments: the number of steps from the present state to the selected state and a function which allows one to peek into the selected state's view stack. The function should return true if the operation should return to the selected state and false otherwise. If the function returns false for every selected state, then the operation is aborted. |
Returns
The active view entry in this stack after the operation is complete.
Defined in
src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiViewStack.tsx:899
goBackToEmptyPage
▸ goBackToEmptyPage(skipPopupCloseAnimation?
): RenderedUiViewEntry
Returns to the history state of this view stack in which only the empty page is open.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
skipPopupCloseAnimation | boolean | false | Whether to skip playing the close animations for popups. Defaults to false . |
Returns
The active view entry in this stack after the operation is complete.
Throws
Error if this view stack is not attached to a container.
Defined in
src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiViewStack.tsx:1033
goBackToPage
▸ goBackToPage(skipPopupCloseAnimation?
): RenderedUiViewEntry
Returns to the most recent history state of this view stack in which the active view is the open page. If the current active view is the open page, then this method does nothing.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
skipPopupCloseAnimation | boolean | false | Whether to skip playing the close animations for popups. Defaults to false . |
Returns
The active view entry in this stack after the operation is complete.
Throws
Error if this view stack is not attached to a container.
Defined in
src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiViewStack.tsx:961
isAwake
▸ isAwake(): boolean
Checks whether this view stack is awake.
Returns
boolean
Whether this view stack is awake.
Defined in
src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiViewStack.tsx:292
onUiInteractionEvent
▸ onUiInteractionEvent(event
): boolean
Handles a UiInteractionEvent.
Parameters
Name | Type | Description |
---|---|---|
event | UiInteractionEvent | The event to handle. |
Returns
boolean
Whether the event was handled.
Implementation of
UiInteractionHandler.onUiInteractionEvent
Defined in
src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiViewStack.tsx:489
openPopup
▸ openPopup<T
>(layer
, key
, options?
): RenderedUiViewEntry
<T
>
Opens a view as a popup. The opened view will be brought to the top of its view stack layer.
Type parameters
Name | Type |
---|---|
T | extends UiView <UiViewProps > = UiView <UiViewProps > |
Parameters
Name | Type | Description |
---|---|---|
layer | UiViewStackLayer | The view stack layer in which to open the view. |
key | string | The key of the view to open. |
options? | Readonly <UiPopupOpenOptions > | Options describing how to open the popup. If not defined, then the popup will default to type 'normal' and with a background occlusion type of 'darken' . |
Returns
The entry of the opened view.
Throws
Error if this view stack is not attached to a container, there is no view registered under the specified key, or the view to open is already open.
Defined in
src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiViewStack.tsx:660
registerView
▸ registerView(layer
, lifecyclePolicy
, key
, factory
): void
Registers a view (page or popup) with this view stack. Once a view is registered, it may be opened by referencing its key.
Parameters
Name | Type | Description |
---|---|---|
layer | UiViewStackLayer | The view stack layer to which to assign the view. |
lifecyclePolicy | UiViewLifecyclePolicy | The lifecycle policy to apply to the view. |
key | string | The key to register the view under. |
factory | (uiService : UiService , containerRef : NodeReference <HTMLElement >) => VNode | A function which renders the view. |
Returns
void
Throws
Error if the specified key is invalid.
Defined in
src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiViewStack.tsx:401
resetViewAnimations
▸ resetViewAnimations(): void
Resets the open and closing animations of all views in this view stack. Closed views will immediately be hidden and open views will immediately become visible at their final positions.
Returns
void
Defined in
src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiViewStack.tsx:1090
sleep
▸ sleep(): void
Puts this view stack to sleep.
Returns
void
Defined in
src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiViewStack.tsx:461
update
▸ update(time
): void
Updates this view stack. Has no effect if this view stack is asleep.
Parameters
Name | Type | Description |
---|---|---|
time | number | The current real (operating system) time, as a Javascript timestamp. |
Returns
void
Defined in
src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiViewStack.tsx:473
visitHistory
▸ visitHistory(visitor
): void
Visits each history state of this view stack.
Parameters
Name | Type | Description |
---|---|---|
visitor | (steps : number , stackPeeker : (depth : number ) => undefined | UiViewStackItem ) => boolean | A function which will visit each history state. The function is called once for each history state in order of increasing age (beginning with the present state) and takes two arguments: the number of steps from the present state to the selected state and a function which allows one to peek into the selected state's view stack. The function should return true if visitation should continue and false if visitation should stop. |
Returns
void
Defined in
src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiViewStack.tsx:569
wake
▸ wake(): void
Wakes this view stack.
Returns
void
Defined in
src/workingtitle-instruments-g3x-touch/html_ui/Pages/VCockpit/Instruments/NavSystems/G3XTouch/Shared/UiSystem/UiViewStack.tsx:450