ui/viewmangager

class ViewManager(container, listenerTarget)
Extends:UINodeCollection

This window manager allows for multiple abitrary arranged MainView() by using Split() and Tabber().

Arguments:
  • container (JQuery) – The JQuery container DOM node in which all content will be rendered.
  • listenerTarget (Emitter) – The Emitter whichi is watched for focus/blur and close events to take action upon.
read-onlyscope
Type:String

An UUID. This is internally needed to prevent the attached UINodes from escapeing when they are dragged around.

read-onlyinstances
Type:Array(MainView)

An array of all attached instances.

read-onlyvisiableInstances
Type:Array(MainView)

An array of all currently visivle instances (shown).

read-onlyfocusInstance
Type:MainView
Default:undefined

The currently focused instance or undefined if none is focused.

isManaged(instance)

Test wether the instance is attached.

Arguments:
  • instance (MainView) – The instance to test.
Returns:

Is the instance attached?

Return type:

Bool

isVisible(instance)

Test wether the instance is visible.

Arguments:
  • instance (MainView) – The instance to test.
Returns:

Is the instance visible?

Return type:

Bool

isFocused(instance)

Test wether the instance is focused.

Arguments:
  • instance (MainView) – The instnace to test.
Returns:

Has the instance focus?

Return type:

Bool

attach(instance[, viewArgs])

Attaches an instance.

Arguments:
  • instance (MainView) – The instance to attach.
  • viewArgs (Object) – An object holding further options for the placeing of the instance.
  • viewArgs.replace (MainView) – Replaces this currently attached instance. If it is not valid instance to replace, this option will be ignored entirely.
  • viewArgs.tabber (Tabber) – Attach the instance inside this tabber. Will attempt to resprect the following 2 parameters (for numeric placement). If it is not valid tabber, this option will be ignored entirely.
  • viewArgs.leftOf (MainView|Number) – See attach() of UINodeCollection().
  • viewArgs.rightOf (MainView|Number) – See attach() of UINodeCollection().
  • viewArgs.focusIndex (Number) – The focus index for the instance to attach. The higher the index the more recent this instance had focus. The currently focused instance has the highest index. If this value is not present or 0 it will default to the currently highest index. Negative values will be used as and offset from the currently highest value.
  • viewArgs.activeIndex (Number) – The active index. See attach() of Tabber().

Note

Both viewArgs.leftOf and viewArgs.rightOf are interpreted this way:
  • If it is not a valid Number it will be set to the highest index.
  • Negative numbers will be substracted from the currently highest active index, but are clipped at 0.
detach(instance)

Detaches a currently attached instance.

Arguments:
  • instance (MainView) – Instance to detach.
focusNeighbor(dir)

Focuses the neighboring instance left/right of the currently focused one.

Arguments:
  • dir (String) – The direction of the neighbor. Valid values are “+” for left or “-“ for right.
destroy()

Destroys itself: Detaches all instances, stops listening to events and renders itself unusable.

byId(id)

Retrieves an attached view by id.

Arguments:
  • id (String) – The id of the view to retrieve.
Returns:

The view, if available, else null.

Return type:

MainView|null