SimileAjax/WindowManager

From SIMILE Widgets
Jump to: navigation, search

Contents

SimileAjax.WindowManager

This is a singleton that keeps track of UI layers (modal and modeless) and enables/disables UI elements based on which layers they belong to. It also provides window-wide dragging implementation.

Code: http://api.simile-widgets.org/ajax/2.2.1/scripts/window-manager.js

Migration Notes

This is probably entirely handled by jQuery UI. This may not come with.

Back to SimileAjax.

Attributes

SimileAjax.WindowManager._initialized

Type: boolean
Default: false
Description: If the system's been started

SimileAjax.WindowManager._listeners

Type: Array
Default: []
Description:

SimileAjax.WindowManager._draggedElement

Type: Element
Default: null
Description:

SimileAjax.WindowManager._draggedElementCallback

Type: function
Default: null
Description:

SimileAjax.WindowManager._dropTargetHighlightElement

Type: Element
Default: null
Description:

SimileAjax.WindowManager._lastCoords

Type: object
Default: null
Description:

SimileAjax.WindowManager._ghostCoords

Type: object
Default: null
Description:

SimileAjax.WindowManager._draggingMode

Type: string
Default: ""
Description:

SimileAjax.WindowManager._dragging

Type: boolean
Default: false
Description: Whether we're in dragging mode or not

SimileAjax.WindowManager._layers

Type: Array
Default: []
Description: Collection of layers being managed

SimileAjax.WindowManager._historyListener

Type: object
Default: See source
Description: Provides event handlers defined in SimileAjax/History

Classes

implicit Layer

Layers managed by the WindowManager are objects with the following attributes and methods. index the only required object attribute.

Attributes

index
Type: int
Description: Which position in collection of layers this layer occupies
ephemeral
Type: boolean
Description: Whether the layer is short lived or not
elmt
Type: Element
Description: The document element associated with this layer

Methods

onPop
Arguments: None
Returns: Nothing
Description: A callback function to be called when a layer is popped to

Methods

SimileAjax.WindowManager.initialize

Arguments: None
Returns: Nothing
Description: Sets up subsystem with initial values, event registration, listeners, etc.

SimileAjax.WindowManager.getBaseLayer

Arguments: None
Returns: implicit Layer
Description: Returns the lowest layer tracked by the manager

SimileAjax.WindowManager.getHighestLayer

Arguments: None
Returns: implicit Layer
Description: Returns the highest layer tracked by the manager

SimileAjax.WindowManager.registerEventWithObject

Arguments:
elmt: Element, the Element on which to register the event
eventName: string, a browser event name, minus the "on" prefix
obj: object, a hashed array with keys and functions, the keys corresponding to handlers, the functions being handlers
handler: string, a key into the object
layer: implicit Layer, the layer to pop to when the event comes up
Returns: Nothing
Description:

SimileAjax.WindowManager.registerEvent

Arguments:
elmt: Element, the Element on which to register the event
eventName: string, a browser event name, minus the "on" prefix
handler: function, of the form function(elmt, evt, target), to handle the event
layer: implicit Layer, the layer to pop to when the event comes up
Returns: Nothing
Description: Registers a handler for a browser event, automatically moving to the associated layer

SimileAjax.WindowManager.pushLayer

Arguments:
f: function, the onPop function
ephemeral: boolean expression, evaluating to whether the layer is ephemeral or not
elmt: Element, the element associated with the layer
Returns: implicit Layer
Description: Creates an implicit layer and pushes it on the top of the layer stack

SimileAjax.WindowManager.popLayer

Arguments:
layer: implicit Layer, the layer to pop to
Returns: Nothing
Description: Pops all layers above the target layer, putting it on top

SimileAjax.WindowManager.popAllLayers

Arguments: None
Returns: Nothing
Description: Pops all layers down to the base layer

SimileAjax.WindowManager.registerForDragging

Arguments:
elmt: Element, the Element to register an event on
callback: function, the object to use for callback elements when dragging is done, should have attributes ghost, droppable and methods onDragStart, canDropOn, onDragEnd, onDropOn
layer: implicit Layer, the layer that can be dragged
Returns: Nothing
Description: Register a layer for the ability to be dragged and dropped

SimileAjax.WindowManager.cancelPopups

Arguments:
evt: Event, a browser event
Returns: Nothing
Description: Pops down to the highest non-short lived layer, unless the event was in a short-lived layer

SimileAjax.WindowManager._popToLayer

Arguments:
level: int, the index to bring to the top
Returns: Nothing
Description: Implements popLayer using the index instead of the object

SimileAjax.WindowManager._canProcessEventAtLayer

Arguments:
layer: implicit Layer
Returns: boolean
Description: Whether the layer provided can handle the event - which it can only if it's the highest non-short lived layer

SimileAjax.WindowManager._onBodyMouseDown

Arguments:
elmt:
evt:
target:
Returns: Nothing
Description: Low level event handler for mouse clicks on the document

SimileAjax.WindowManager._handleMouseDown

Arguments:
elmt:
evt:
callback:
Returns: boolean, always false
Description: Low level event handler for mouse clicks on an element

SimileAjax.WindowManager._onBodyKeyDown

Arguments:
elmt:
evt:
target:
Returns: Nothing
Description: Low level event handler for key presses

SimileAjax.WindowManager._onBodyKeyUp

Arguments:
elmt:
evt:
target:
Returns: Nothing
Description: Low level event handler for key releases

SimileAjax.WindowManager._onBodyMouseMove

Arguments:
elmt:
evt:
target:
Returns: boolean
Description: Low level event handler for mouse movement

SimileAjax.WindowManager._onBodyMouseUp

Arguments:
elmt:
evt:
target:
Returns: boolean
Description: Low level event handler for mouse click finishes on the document

SimileAjax.WindowManager._cancelDragging

Arguments: None
Returns: Nothing
Description: Stops dragging an element

SimileAjax.WindowManager._findDropTarget

Arguments:
elmt:
Returns: Element
Description: Given an element, determine which of it or its parents can handle the drop event

Back to SimileAjax.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox