Options
All
  • Public
  • Public/Protected
  • All
Menu

MenuRegistry is a central management component for creating and accessing menu's from any module across the viewer.

Hierarchy

  • MenuRegistry

Index

Constructors

constructor

  • Initializes a new instance of the MenuRegistry class.

    Parameters

    • app: ViewerApplication

      The {@link geocortex.essentialsHtmlViewer.ViewerApplication} that this menu registry belongs to.

    Returns MenuRegistry

Properties

Protected _menuConfig

_menuConfig: MenuEntryConfig[]

Array of configurations for each Menu.

Protected _viewMenuEntries

_viewMenuEntries: object

Array of viewId's mapped to their contained menu widget parameters.

Type declaration

app

The ViewerApplication that this menu registry belongs to.

menuList

menuList: MenuModel[]

An array containing references to all the menus registered in the system.

Methods

Protected _validMenuId

  • _validMenuId(id: string): boolean
  • Checks if a given menu id is valid or not. For a menu id to be valid, it should be unique i.e. there should be no exisiting menu's registered with the same name.

    Parameters

    • id: string

      The menu ID to check for validity.

    Returns boolean

    A boolean which returns true if the given menu ID is valid; false otherwise.

Protected _validateMenuModel

  • _validateMenuModel(menuModel: MenuModel): boolean
  • Validates a given menu model to ensure that it meets the minimum requirements for a valid menu.

    Parameters

    • menuModel: MenuModel

      The {@link geocortex.essentialsHtmlViewer.mapping.infrastructure.menus.MenuModel} object to validate.

    Returns boolean

    A boolean that returns true if the given MenuModel is valid; false otherwise.

createMenuWidget

  • Generates a menu view based on dom attributes. The attributes that should be present on the DOM element being passed in are:

    • data-menu-id: (Required) This defines the menu to populate within the created menu view
    • data-menu-template: (Optional) If provided, this will be used as the template for the menu view being created. Default is Mapping/infrastructure/menus/MenuView.html
    • data-menu-type: (Optional) If provided, this will be used as the code behind for the menu view being created. Default is geocortex.essentialsHtmlViewer.mapping.infrastructure.menus.MenuView
    • data-menu-library-id: (Optional) If provided, this will be used as the library id for this menu View. This will override the manual libraryId input parameter if specified.
    • data-menu-hoist-disabled: (Optional) If present, the menu will not be hoisted.

    Parameters

    • view: ViewBase

      The view that is requesting the menu widget.

    • context: any

      The current context of the widget, if available.

    • binding: BindingExpression

      The binding expression passed in to the 'resolveWidget' method from which this method will typically be called.

    • Optional libraryId: string

      The library ID for the created menu widget.

    • Optional dynamicMenuId: string

      An optional id for the menu to be passed at runtime

    Returns ViewBase

    A {@link geocortex.framework.ui.ViewBase}, bound, view widget object.

destroyMenuWidget

  • destroyMenuWidget(menuWidgetView: MenuView): void
  • Destroys the menu widget and all it's associated view model bindings and subscriptions. Automatically called when the widget view is destroyed.

    Parameters

    • menuWidgetView: MenuView

      The menu widget view to destroy.

    Returns void

getDefaultIconUri

  • getDefaultIconUri(id: string): string
  • Fetches the default icon URI for a given menu.

    Parameters

    • id: string

    Returns string

    the URI of default icon for given menu.

getMenu

  • Fetches a menu by id.

    Parameters

    • id: string

    Returns MenuModel

    The requested {@link geocortex.essentialsHtmlViewer.mapping.infrastructure.menus.MenuModel} object or null if not found.

getMenuWidgetsForView

  • Given a view, returns descriptors of any menu widgets created by that view.

    Parameters

    • view: ViewBase

      The {@link framework.ui.ViewBase} object whose associated menu widget(s) we want to retrieve.

    Returns MenuWidgetParameters[]

    An array of {@link geocortex.essentialsHtmlViewer.mapping.infrastructure.menus.MenuWidgetParameters} objects containing the requested widget(s).

loadMenus

  • Creates and registers menu's based on the passed in configuration.

    Parameters

    • config: MenuConfig

      A {@link geocortex.essentialsHtmlViewer.mapping.infrastructure.menus.MenuConfig} configuration object.

    Returns void

register

  • Registers a menu, given from either a MenuEntryConfig or MenuModel object.

    Parameters

    • menu: MenuModel | MenuEntryConfig

      The instance of {@link geocortex.essentialsHtmlViewer.mapping.infrastructure.menus.MenuModel} or {@link geocortex.essentialsHtmlViewer.mapping.infrastructure.menus.MenuEntryConfig} to be registered.

    Returns void

unregister

  • unregister(menuId: string): void
  • Unregisters a menu.

    Parameters

    • menuId: string

      The ID of the menu to be unregistered.

    Returns void