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
The application this class belongs to
Optional. The library Id to be used for this class
Optional. The region this switcher should target. If not specified during construction, needs to be specified during initialization.
The region this view switcher will target and listen to in order to display tabs for all views hosted
Descriptors for the views hosted in the target region
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.
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 () { }); ```
Either an Observable (for observable bindings) or a regular object (if arg1 is a string)
If arg0 is an Observable, a function or scope object. Otherwise, an event name (to use with dojo.connect).
If arg0 is an Observable, a function handler.
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
Creates and returns the view descriptor for the given view. Override this method to return a custom view descriptor
The view for which we need to create the descriptor.
The view descriptor for the specified view.
Destroys the object completely
Disposes any bindings tracked by this object.
Looks up a view descriptor for a given view.
The view to retrieve the descriptor for
The retrived ViewDescriptor
Gets a language resource from the Application's resource dictionary, given a key, and optional locale. Returns null if the resource does not exist.
The locale of the resource to fetch. Defaults to the current application locale.
The handler for the ViewActivatedEvent
The view that was activated
The handler for the ViewActivatedEvent
The view that was activated
Handler for the ViewHostedEvent
An object containing the view that has been hosted and the region it has been hosted in
The handler for the ViewUnhostedEvent
An object containing the view that has been unhosted and the region it was hosted in
Initializes the ViewSwitcherViewModel.
Override or attach to provide custom clean-up behaviour.
Tracks a subscription to an {@link geocortex.framework.commands.Command}, disposing it when this object is disposed with the destroy method.
Tracks a subscription to an {@link geocortex.framework.events.Event}, disposing it when this object is disposed with the destroy method.
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.
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.