Skip to main content

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

NameTypeDescription
uiServiceUiServiceThe UI service controlling this view stack.

Returns

UiViewStack

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

NameTypeDescription
containerUiViewStackContainerThe 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

NameType
Textends UiView<UiViewProps> = UiView<UiViewProps>

Parameters

NameTypeDescription
keystringThe key of the view to open.

Returns

RenderedUiViewEntry<T>

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

NameTypeDefault valueDescription
skipPopupCloseAnimationbooleanfalseWhether to skip playing the close animations for popups. Defaults to false.

Returns

RenderedUiViewEntry

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

RenderedUiViewEntry

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

NameTypeDescription
selector(steps: number, stackPeeker: (depth: number) => undefined | UiViewStackItem) => booleanA 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

RenderedUiViewEntry

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

NameTypeDefault valueDescription
skipPopupCloseAnimationbooleanfalseWhether to skip playing the close animations for popups. Defaults to false.

Returns

RenderedUiViewEntry

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

NameTypeDefault valueDescription
skipPopupCloseAnimationbooleanfalseWhether to skip playing the close animations for popups. Defaults to false.

Returns

RenderedUiViewEntry

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

NameTypeDescription
eventUiInteractionEventThe 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

NameType
Textends UiView<UiViewProps> = UiView<UiViewProps>

Parameters

NameTypeDescription
layerUiViewStackLayerThe view stack layer in which to open the view.
keystringThe 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

RenderedUiViewEntry<T>

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

NameTypeDescription
layerUiViewStackLayerThe view stack layer to which to assign the view.
lifecyclePolicyUiViewLifecyclePolicyThe lifecycle policy to apply to the view.
keystringThe key to register the view under.
factory(uiService: UiService, containerRef: NodeReference<HTMLElement>) => VNodeA 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

NameTypeDescription
timenumberThe 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

NameTypeDescription
visitor(steps: number, stackPeeker: (depth: number) => undefined | UiViewStackItem) => booleanA 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