Class: UiService
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:24
A service which manages the state of a G3X Touch instrument's UI panes and views.
Constructors
Constructor
new UiService(
instrumentIndex,config,instrumentConfig,bus,isPfdPaneVisible,isMfdPaneVisible,displaySettingManager):UiService
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:173
Creates a new instance of UiService.
Parameters
| Parameter | Type | Description |
|---|---|---|
instrumentIndex | number | The index of this service's parent instrument. |
config | AvionicsConfig | The general avionics configuration object. |
instrumentConfig | InstrumentConfig | The configuration object of this service's parent instrument. |
bus | EventBus | The event bus. |
isPfdPaneVisible | MutableSubscribable<boolean> | A MutableSubscribable which controls whether this service's parent instrument's PFD UI pane is visible. |
isMfdPaneVisible | MutableSubscribable<boolean> | A MutableSubscribable which controls whether this service's parent instrument's MFD UI pane is visible. |
displaySettingManager | UserSettingManager<DisplayUserSettingTypes> | A manager for display user settings for this service's parent instrument. |
Returns
UiService
Properties
bus
readonlybus:EventBus
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:177
The event bus.
gdu460EisLayout
readonlygdu460EisLayout:Subscribable<EisLayouts>
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:78
The current EIS layout. Only applicable for GDU460 displays.
gdu460EisSize
readonlygdu460EisSize:undefined|EisSizes
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:81
The current EIS size, or undefined if the EIS is not included. Only applicable for GDU460 displays.
gdu460PfdPaneSide
readonlygdu460PfdPaneSide:Subscribable<PfdPaneSide>
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:54
The side on which the PFD pane is positioned. Only applicable for GDU460 displays.
gduFormat
readonlygduFormat:GduFormat
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:35
The format of this service's parent GDU.
gduIndex
readonlygduIndex:number
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:32
The index of this service's parent GDU.
instrumentIndex
readonlyinstrumentIndex:number
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:174
The index of this service's parent instrument.
instrumentType
readonlyinstrumentType:InstrumentType
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:38
The instrument type of this service's parent instrument.
isInStartupPhase
readonlyisInStartupPhase:Subscribable<boolean>
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:50
Whether this service is in the startup phase.
isPaneSplit
readonlyisPaneSplit:Subscribable<boolean>
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:85
Whether the UI panes are currently displayed in split mode.
isReversionaryMode
readonlyisReversionaryMode:Subscribable<boolean>
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:42
Whether this service is operating in reversionary mode.
knobLabelState
readonlyknobLabelState:Readonly<Record<UiKnobId,Subscribable<string>>>
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:151
This service's computed label state for the bezel rotary knobs.
mfdPaneKnobControlSide
readonlymfdPaneKnobControlSide:Subscribable<number>
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:137
The side(s) for which the MFD pane controls the bezel rotary knobs.
operatingType
readonlyoperatingType:Subscribable<InstrumentType>
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:46
The current operating type of this service's parent instrument.
pfdPaneKnobControlSide
readonlypfdPaneKnobControlSide:Subscribable<number>
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:133
The side(s) for which the PFD pane controls the bezel rotary knobs.
selectedMfdMainPageKey
readonlyselectedMfdMainPageKey:Subscribable<string>
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:93
The key of the currently selected MFD main page.
selectedMfdNrstPageKey
readonlyselectedMfdNrstPageKey:Subscribable<string>
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:97
The key of the currently selected MFD NRST page.
selectedPfdPageKey
readonlyselectedPfdPageKey:Subscribable<string>
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:89
The key of the currently selected PFD page.
validKnobIds
readonlyvalidKnobIds: readonlyUiKnobId[]
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:100
An array of IDs of the valid bezel rotary knobs supported by this service's parent GDU.
Methods
attachViewStackContainers()
attachViewStackContainers(
pfdContainer,mfdContainer):void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:192
Attaches containers to this service's view stacks.
Parameters
| Parameter | Type | Description |
|---|---|---|
pfdContainer | UiViewStackContainer | The container to which to attach the PFD view stack. |
mfdContainer | UiViewStackContainer | The container to which to attach the MFD view stack. |
Returns
void
Throws
Error if this service's view stacks have already been attached to containers.
changeMfdPage()
changeMfdPage<
T>(key):null|RenderedUiViewEntry<T>
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:793
Changes the open MFD page. Changing the page also closes all open MFD popups. If the MFD pane is not visible, then this method does nothing.
Type Parameters
| Type Parameter | Default type |
|---|---|
T extends UiView<UiViewProps> | UiView<UiViewProps> |
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | The key of the view to open. |
Returns
null | RenderedUiViewEntry<T>
The entry of the opened view, or null if the MFD pane is not visible.
Throws
Error if this service is not initialized, the specified key is equal to UiViewKeys.EmptyPage, there is
no view registered under the specified key, or the view to open is already open.
closeAllMfdOverlayViews()
closeAllMfdOverlayViews(
closeMfdPaneIfEmpty):null|RenderedUiViewEntry
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:1034
Returns to the most recent history state of the MFD view stack in which the overlay layer contains no open views. If the MFD pane is not visible, then this method does nothing.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
closeMfdPaneIfEmpty | boolean | true | Whether to close the MFD pane if possible should the operation result in the MFD view stack containing no open views except the empty page. Defaults to true. |
Returns
null | RenderedUiViewEntry
The active view entry in the MFD view stack after the operation is complete, or null if the MFD pane is
not visible after the operation is complete.
Throws
Error if this service is not initialized.
closeAllMfdPopups()
closeAllMfdPopups(
closeMfdPaneIfEmpty):null|RenderedUiViewEntry
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:1062
Returns to the most recent history state of the MFD view stack in which the MFD view stack contains no open popups. If the MFD pane is not visible, then this method does nothing.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
closeMfdPaneIfEmpty | boolean | true | Whether to close the MFD pane if possible should the operation result in the MFD view stack containing no open views except the empty page. Defaults to true. |
Returns
null | RenderedUiViewEntry
The active view entry in the MFD view stack after the operation is complete, or null if the MFD pane is
not visible after the operation is complete.
Throws
Error if this service is not initialized.
closeAllPfdPopups()
closeAllPfdPopups():
null|RenderedUiViewEntry
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:739
Returns to the most recent history state of the PFD view stack in which the view stack contains no open popups. If the PFD pane is not visible, then this method does nothing.
Returns
null | RenderedUiViewEntry
The active view entry in the PFD view stack after the operation is complete, or null if the PFD pane is
not visible.
Throws
Error if this service is not initialized.
closeMfdPopup()
closeMfdPopup<
F>(filter,closeMfdPaneIfEmpty):boolean
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:988
Attempts to close a popup in the MFD view stack by rewinding the history state of the view stack until the target popup is no longer open. If the MFD pane is not visible, then this method does nothing.
Type Parameters
| Type Parameter | Default type |
|---|---|
F extends RenderedUiViewEntry | RenderedUiViewEntry |
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
filter | (popup) => boolean | undefined | A filter function which takes in a popup with the specified key and returns whether it is the popup to close. |
closeMfdPaneIfEmpty | boolean | true | Whether to close the MFD pane if possible should the operation result in the MFD view stack containing no open views except the empty page. Defaults to true. |
Returns
boolean
true if the specified popup was closed, or false if the popup was not open in the first place.
Throws
Error if this service is not initialized.
closePfdPopup()
closePfdPopup<
F>(filter):boolean
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:700
Attempts to close a popup in the PFD view stack by rewinding the history state of the view stack until the target popup is no longer open. If the PFD pane is not visible, then this method does nothing.
Type Parameters
| Type Parameter | Default type |
|---|---|
F extends RenderedUiViewEntry | RenderedUiViewEntry |
Parameters
| Parameter | Type | Description |
|---|---|---|
filter | (popup) => boolean | A filter function which takes in a popup with the specified key and returns whether it is the popup to close. |
Returns
boolean
true if the specified popup was closed, or false if the popup was not open in the first place.
Throws
Error if this service is not initialized.
enterStartupPhase()
enterStartupPhase():
void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:357
Enters the startup phase. When entering the startup phase, the MFD pane is made visible (split screen if this service's parent instrument is operating as a PFD, and full screen if operating as an MFD), all popups on both panes are closed, and the MFD startup view is opened.
Returns
void
exitStartupPhase()
exitStartupPhase():
void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:389
Exits the startup phase. When exiting the startup phase, the full/split screen mode defined by the
displayStartupSplitMode user setting is applied, and if the MFD pane is visible the MFD main view is opened.
Returns
void
goBackMfd()
goBackMfd(
closeMfdPaneIfEmpty):null|RenderedUiViewEntry
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:864
Returns to the most recent previous history state of the MFD view stack. If the MFD pane is not visible, then this method does nothing.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
closeMfdPaneIfEmpty | boolean | true | Whether to close the MFD pane if possible should there be no previous history state to which to return or should the operation result in the MFD view stack containing no open views except the empty page. Defaults to true. |
Returns
null | RenderedUiViewEntry
The active view entry in the MFD view stack after the operation is complete, or null if the MFD pane is
not visible after the operation is complete.
Throws
Error if this service is not initialized.
goBackPfd()
goBackPfd():
null|RenderedUiViewEntry
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:631
Returns to the most recent previous history state of the PFD view stack. If the PFD pane is not visible, then this method does nothing.
Returns
null | RenderedUiViewEntry
The active view entry in the PFD view stack after the operation is complete, or null if the PFD pane is
not visible.
Throws
Error if this service is not initialized.
goBackToMfd()
goBackToMfd(
selector,closeMfdPaneIfEmpty):null|RenderedUiViewEntry
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:930
Attempts to return to a previous history state of the MFD view stack. If the MFD pane is not visible, then this method does nothing.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
selector | (steps, stackPeeker) => boolean | undefined | 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. |
closeMfdPaneIfEmpty | boolean | true | Whether to close the MFD pane if possible should the operation result in the MFD view stack containing no open views except the empty page. Defaults to true. |
Returns
null | RenderedUiViewEntry
The active view entry in the MFD view stack after the operation is complete, or null if the MFD pane is
not visible after the operation is complete.
Throws
Error if this service is not initialized.
goBackToPfd()
goBackToPfd(
selector):null|RenderedUiViewEntry
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:662
Attempts to return to a previous history state of the PFD view stack. If the PFD pane is not visible, then this method does nothing.
Parameters
| Parameter | Type | Description |
|---|---|---|
selector | (steps, stackPeeker) => 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
null | RenderedUiViewEntry
The active view entry in the MFD view stack after the operation is complete, or null if the MFD pane is
not visible after the operation is complete.
Throws
Error if this service is not initialized.
initialize()
initialize():
void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:243
Initializes this service.
Returns
void
Throws
Error if this service's view stacks are not attached to containers.
openMfdPane()
openMfdPane(
openMfdPageKey):void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:505
Opens the MFD pane. This method does nothing if the MFD pane is already visible.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
openMfdPageKey | string | UiViewKeys.MfdMain | The MFD view page to open if the MFD pane is made visible as a result of this operation. Defaults to UiViewKeys.MfdMain. |
Returns
void
openMfdPopup()
openMfdPopup<
T>(layer,key,closeOtherPopups,popupOptions?):RenderedUiViewEntry<T>
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:824
Opens an MFD view as a popup. The opened view will be brought to the top of its view stack layer.
Type Parameters
| Type Parameter | Default type |
|---|---|
T extends UiView<UiViewProps> | UiView<UiViewProps> |
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
layer | UiViewStackLayer | undefined | The view stack layer in which to open the view. |
key | string | undefined | The key of the view to open. |
closeOtherPopups | boolean | false | Whether to close other popups before opening the new popup. If true and the new popup is opened in the overlay layer, then all popups in the overlay layer will be closed. If true and the new popup is opened in the main layer, then all popups in both the main and overlay layers will be closed. Defaults to false. |
popupOptions? | Readonly<UiPopupOpenOptions> | undefined | 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 service is not initialized, the specified key is equal to UiViewKeys.EmptyPage, there is
no view registered under the specified key, or the view to open is already open.
openPfdPopup()
openPfdPopup<
T>(key,closeOtherPopups,popupOptions?):RenderedUiViewEntry<T>
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:599
Opens a PFD view as a popup. The opened view will be brought to the top of the view stack.
Type Parameters
| Type Parameter | Default type |
|---|---|
T extends UiView<UiViewProps> | UiView<UiViewProps> |
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
key | string | undefined | The key of the view to open. |
closeOtherPopups | boolean | false | Whether to close other popups before opening the new popup. If true and the new popup is opened in the overlay layer, then all popups in the overlay layer will be closed. If true and the new popup is opened in the main layer, then all popups in both the main and overlay layers will be closed. Defaults to false. |
popupOptions? | Readonly<UiPopupOpenOptions> | undefined | 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 service is not initialized, the specified key is equal to UiViewKeys.EmptyPage, there is
no view registered under the specified key, or the view to open is already open.
registerMfdView()
registerMfdView(
layer,lifecyclePolicy,key,factory):void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:230
Registers and renders a view with this service's MFD view stack. Once a view is registered, it may be opened by referencing its key.
Parameters
| Parameter | 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, containerRef) => VNode | A function which renders the view. |
Returns
void
Throws
Error if the specified key is invalid.
registerPfdView()
registerPfdView(
layer,lifecyclePolicy,key,factory):void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:212
Registers and renders a view with this service's PFD view stack. Once a view is registered, it may be opened by referencing its key.
Parameters
| Parameter | 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, containerRef) => VNode | A function which renders the view. |
Returns
void
Throws
Error if the specified key is invalid.
resetMfdToPage()
resetMfdToPage<
T>(key):null|RenderedUiViewEntry<T>
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:761
Resets the state of the MFD pane such that the open page and active view is a page with a given key. First, an attempt is made to rewind the history state of the MFD pane until the above conditions are met. If this is not possible, then the history state is rewound until only the empty page is open and then the page with the specified key is opened. If the MFD pane is not visible, then this method does nothing.
Type Parameters
| Type Parameter | Default type |
|---|---|
T extends UiView<UiViewProps> | UiView<UiViewProps> |
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | The key of the page view to which to reset. |
Returns
null | RenderedUiViewEntry<T>
The entry of the page view to which the MFD pane was reset, or null if the MFD pane is not visible.
Throws
Error if this service is not initialized, the specified key is equal to UiViewKeys.EmptyPage, or there
is no view registered under the specified key.
selectMfdMainPage()
selectMfdMainPage(
key):void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:1085
Selects an MFD main page to display.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | The key of the page to select. |
Returns
void
selectMfdNrstPage()
selectMfdNrstPage(
key):void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:1093
Selects an MFD NRST page to display.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | The key of the page to select. |
Returns
void
setReversionaryMode()
setReversionaryMode(
isReversionaryMode):void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:416
Sets whether this service is operating in reversionary mode.
Parameters
| Parameter | Type | Description |
|---|---|---|
isReversionaryMode | boolean | Whether this service is operating in reversionary mode. |
Returns
void
sleep()
sleep():
void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:341
Puts this service to sleep.
Returns
void
toggleSplitPaneMode()
toggleSplitPaneMode(
force?,openMfdPageKey?):void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:519
Toggles whether the UI panes should be displayed in split mode.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
force? | boolean | undefined | The split mode state to which to toggle (true = split, false = full). If not defined, then the state will be toggled to the opposite of the current state. |
openMfdPageKey? | string | UiViewKeys.MfdMain | The MFD view page to open if the MFD pane is made visible as a result of turning split mode on. Defaults to UiViewKeys.MfdMain. |
Returns
void
Throws
Error if this service is not initialized.
updateMfdViewStack()
updateMfdViewStack(
time):void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:494
Updates this service's MFD view stack. Has no effect if this service is not initialized or is asleep.
Parameters
| Parameter | Type | Description |
|---|---|---|
time | number | The current real (operating system) time, as a Javascript timestamp. |
Returns
void
updatePfdViewStack()
updatePfdViewStack(
time):void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:484
Updates this service's PFD view stack. Has no effect if this service is not initialized or is asleep.
Parameters
| Parameter | Type | Description |
|---|---|---|
time | number | The current real (operating system) time, as a Javascript timestamp. |
Returns
void
wake()
wake():
void
Defined in: src/workingtitle-instruments-g3x-touch/html_ui/Shared/UiSystem/UiService.ts:327
Wakes this service.
Returns
void