Options
All
  • Public
  • Public/Protected
  • All
Menu

The ViewSwicherView is a lightweight tab strip representing the various views hosted in any "target" region. The ViewSwitcher will 'listen' for all views hosted in the target region and will pop up a tab to represent the view so users can easily switch between the hosted views. This is a much more lightweight solution than using a full fledged ViewContainerView though that has it's own merits.

Hierarchy

Index

Constructors

constructor

  • Constructs a new instance of the ViewSwitcherViewModel. Note that if the optional targetRegion parameter is supplied, the initialize method need not be explicitly invoked. If not specified during creation, the initialize method needs to be called to configure the target region

    Parameters

    • app: Application

      The application this class belongs to

    • Optional libraryId: string

      Optional. The library Id to be used for this class

    • Optional targetRegion: string

      Optional. The region this switcher should target. If not specified during construction, needs to be specified during initialization.

    Returns ViewSwitcherViewModel

Properties

Protected _isDestroyed

_isDestroyed: boolean

app

id

id: string

libraryId

libraryId: string

targetRegion

targetRegion: string

The region this view switcher will target and listen to in order to display tabs for all views hosted

viewDescriptors

Descriptors for the views hosted in the target region

viewSwitcherActive

viewSwitcherActive: Observable<boolean>

Indicates whether to enable or disable the view switcher based on various criteria - most common being that multiple views have been hosted in the target region.

Methods

auto

  • auto(arg0: any, arg1: any, arg2: any): void
  • Binds a handler to an Observable or to a dojo.connect. Binding to an Observable:

    ``` this.auto(someObservable, function (newValue) { });

    with explicit scope:

    this.auto(someObservable, this, function (newValue) { });

    Alternately, pass an event name as a string to use dojo.connect:

    this.auto(window, "onclick", function () { }); ```

    Parameters

    • arg0: any

      Either an Observable (for observable bindings) or a regular object (if arg1 is a string)

    • arg1: any

      If arg0 is an Observable, a function or scope object. Otherwise, an event name (to use with dojo.connect).

    • arg2: any

      If arg0 is an Observable, a function handler.

    Returns void

Protected checkIfSwitcherActive

  • checkIfSwitcherActive(): boolean
  • Returns true if the view switcher is to be enabled. This function checks whether there are multiple views and enables it if there are. If additional checks are required, this method may be overridden. Called each time a new view is added or removed from this view switcher

    Returns boolean

Protected createDescriptorForView

  • Creates and returns the view descriptor for the given view. Override this method to return a custom view descriptor

    Parameters

    • view: ViewBase

      The view for which we need to create the descriptor.

    Returns ViewDescriptorInterface

    The view descriptor for the specified view.

destroy

  • destroy(): void
  • Destroys the object completely

    Returns void

destroyBindings

  • destroyBindings(): void

getDescriptorForView

  • Looks up a view descriptor for a given view.

    Parameters

    • view: ViewBase

      The view to retrieve the descriptor for

    Returns ViewDescriptorInterface

    The retrived ViewDescriptor

getResource

  • getResource(resourceKey: string, locale?: string): string
  • Gets a language resource from the Application's resource dictionary, given a key, and optional locale. Returns null if the resource does not exist.

    Parameters

    • resourceKey: string
    • Optional locale: string

      The locale of the resource to fetch. Defaults to the current application locale.

    Returns string

Protected handleViewActivatedEvent

  • handleViewActivatedEvent(view: ViewBase): void
  • The handler for the ViewActivatedEvent

    Parameters

    • view: ViewBase

      The view that was activated

    Returns void

Protected handleViewDeactivatedEvent

  • handleViewDeactivatedEvent(view: ViewBase): void
  • The handler for the ViewActivatedEvent

    Parameters

    • view: ViewBase

      The view that was activated

    Returns void

Protected handleViewHostedEvent

  • handleViewHostedEvent(args: object): void
  • Handler for the ViewHostedEvent

    Parameters

    • args: object

      An object containing the view that has been hosted and the region it has been hosted in

    Returns void

Protected handleViewUnHostedEvent

  • handleViewUnHostedEvent(args: object): void
  • The handler for the ViewUnhostedEvent

    Parameters

    • args: object

      An object containing the view that has been unhosted and the region it was hosted in

    Returns void

initialize

  • initialize(config?: object): void
  • Initializes the ViewSwitcherViewModel.

    Parameters

    • Optional config: object
      • targetRegion: string

    Returns void

onDestroy

  • onDestroy(): void
  • Override or attach to provide custom clean-up behaviour.

    Returns void

trackCommandHandler

  • trackCommandHandler(command: any, token: any): void
  • Tracks a subscription to an {@link geocortex.framework.commands.Command}, disposing it when this object is disposed with the destroy method.

    Parameters

    • command: any
    • token: any

    Returns void

trackSubscription

  • trackSubscription(event: any, token: any): void
  • Tracks a subscription to an {@link geocortex.framework.events.Event}, disposing it when this object is disposed with the destroy method.

    Parameters

    • event: any
    • token: any

    Returns void

Protected updateViewSwitcherState

  • updateViewSwitcherState(): void
  • Updates the state (enabled/disabled) for the View Switcher. Can be overridden if custom behaviour is needed. Called each time a new view is added or removed from the View Switcher.

    Returns void