class ModelHelper view source

Helper to ease AUI tree access for customized widgets, Manages client side life cycle representation of the node.

Constructor

new ModelHelper(widget : WidgetBase)

Parameters

widget WidgetBase the widget to handle
Instance members

addAuiUpdateListener(listener : function) : (function)

Registers a listener which will be called when any DVM answer is received. You can update your widget in the provided callback This listening method is general to all started applications. If your UI updates are heavy, prefer more fine grained update notification mechanisms

Parameters

listener function the function to call when a new application is started

Returns

(function) The unregister handler. Simply call this function to stop listening for new applications

addCloseApplicationListener(listener : function) : (function)

Registers a listener which will be called when an application is closed

Parameters

listener function the function to call when an application is closed

Returns

(function) The unregister handler. Simply call this function to stop listening for closed applications

addCurrentWindowChangeListener(listener : function) : (function)

Registers a listener which will be called when the current window changes

Parameters

listener function the function to call when the current window changes

Returns

(function) The unregister handler. Simply call this function to stop listening for window changes

addNewApplicationListener(listener : function) : (function)

Registers a listener which will be called when a new application is started

Parameters

listener function the function to call when a new application is started

Returns

(function) The unregister handler. Simply call this function to stop listening for new applications

addSessionEndListener(listener : function) : (function)

Registers a listener which will be called when all applications are closed and session end page is displayed.

Parameters

listener function the function to call when session end page is displayed

Returns

(function) The unregister handler. Simply call this function to stop listening for session end

emit(type : string, arguments… : any)
[inherits from EventListener]

Emit an event

Parameters

type string event type to emit
arguments any arguments (excluding type) will be set in event.data

executeActionByName(name : string) : (boolean)

Try to find & execute an action by name (search in the active Dialog/Menu of the current Window). Note that the focused widget with pending changes will send its value to the VM

Parameters

name string of the action

Returns

(boolean) true if an action has been found and executed, false otherwise.

getAnchorNode() : (NodeBase)

Get Anchor Node of the widget

Returns

(NodeBase) the AUI anchor node of this widget. Generally the corresponding node or the node holding the displayed value

getApplication() : (VMApplication)

Get the widget application

Returns

(VMApplication) the VM application to which this widget is attached. null if the widget isn't below a VM application

getCurrentApplication() : (VMApplication)

Get the current application

Returns

(VMApplication) the currently visible application or null if it cannot be found.

getDecorationNode() : (NodeBase)

Applies only to entry fields (FormField, Matrix or TableColumn) A decoration node is the node holding visual information (Edit, CheckBox, ComboBox, etc...)

Returns

(NodeBase) the decoration node corresponding to the widget or null if it doesn't apply

getFieldNode() : (NodeBase)

Applies only to entry fields (FormField, Matrix or TableColumn)

Returns

(NodeBase) the field node corresponding to the widget or null if it doesn't apply

getNode(idRef : number) : (NodeBase)

Get a node with its id

Parameters

idRef number the VM id of the node to return

Returns

(NodeBase) the requested node or null if it couldn't be found

getUserInterfaceNode() : (NodeBase)

Get the UserInterface Node

Returns

(NodeBase) the UserInterface node of the current application or null if it coulnd't be found

isDestroyed() : (boolean)
[inherits from EventListener]

Returns if the node is destroyed

Returns

(boolean) true if node is destroyed

when(type : string, handler : Hook, once : boolean) : (HandleRegistration)
[inherits from EventListener]

Registers a handler for this event type

Parameters

type string event type (e.g. "attribute changed")
handler Hook handler to trigger when the event type is emitted
once boolean if true, will only fire once

Returns

(HandleRegistration) a registration handle (for unbind purpose)