OverviewSingleDeprecated

jsx3.app

class DOM

Object
->jsx3.lang.Object
  ->jsx3.app.DOM

All Implemented Interfaces:

jsx3.util.EventDispatcher

class DOM
extends jsx3.lang.Object
Registers all DOM nodes in an instance of jsx3.app.Server and publishes related events. This class keeps all contained JSX objects indexed on id and name.

Field Summary
static int
TYPEADD
0
static int
TYPEREARRANGE
2
static int
TYPEREMOVE
1
Constructor Summary
void
The instance initializer.
Method Summary
void
add(objJSX : jsx3.app.Model)
Adds a JSX object to this DOM and indexes it by its id and name.
void
The instance finalizer.
jsx3.app.Model
get(strId : String)
Looks up a DOM object contained in this DOM by id or name.
Array<jsx3.app.Model>
getAllByName(strName : String)
Returns all the DOM nodes in this DOM with a name of strName.
jsx3.app.Model
getById(strId : String)
Looks up a DOM object contained in this DOM by id.
jsx3.app.Model
getByName(strName : String)
Looks up a DOM object contained in this DOM by name.
static String
newId(strNameSpace : String)
Creates a new unique system id.
void
onChange(TYPE : int, JSXPARENTID : String, JSXID : String)
called when a change to the JSX DOM occurs for this server instance (adopt, load, delete, etc); publishes an event object (javascript object) with the following named properties: subject (jsx3.app.DOM.EVENT_CHANGE); type (jsx3.app.DOM.TYPEADD | jsx3.app.DOM.TYPEREMOVE); parentId (id of JSX parent); jsxId (id of element added or removed)
void
onNameChange(objJSX : jsx3.app.Model, oldName : String)
A method that must be called after changing the name of a contained DOM node.
void
Removes a JSX object from this DOM and removes it from the indices.
Methods Inherited From jsx3.util.EventDispatcher
publish, subscribe, unsubscribe, unsubscribeAll
Methods Inherited From jsx3.lang.Object
clone, equals, eval, getClass, getInstanceOf, getInstanceOfClass, getInstanceOfPackage, instanceOf, isInstanceOf, isSubclassOf, jsxmix, jsxsuper, jsxsupermix, setInstanceOf, toString
Field Detail

TYPEADD

static final int TYPEADD
0

TYPEREARRANGE

static final int TYPEREARRANGE
2

TYPEREMOVE

static final int TYPEREMOVE
1
Constructor Detail

init

void init()
The instance initializer.
Method Detail

add

void add(objJSX : jsx3.app.Model)
Adds a JSX object to this DOM and indexes it by its id and name.

Parameters:

objJSX

destroy

void destroy()
The instance finalizer.

get

jsx3.app.Model get(strId : String)
Looks up a DOM object contained in this DOM by id or name.

Parameters:

strIdeither the id of the object to return or its name.

Returns:

the matching DOM object or null if none found.  

getAllByName

Array<jsx3.app.Model> getAllByName(strName : String)
Returns all the DOM nodes in this DOM with a name of strName. The name index keeps a bucket of DOM nodes for each unique name. Therefore, this method performs efficiently.

Parameters:

strNamethe name of the objects to return.

Returns:

an array of the matching DOM nodes. This return value should not be mutated as that will effect the internal functioning of this DOM. 

Since:

3.2

See Also:

getByName()

getById

jsx3.app.Model getById(strId : String)
Looks up a DOM object contained in this DOM by id.

Parameters:

strIdthe id of the object to return.

Returns:

the matching DOM object or null if none found.  

getByName

jsx3.app.Model getByName(strName : String)
Looks up a DOM object contained in this DOM by name. It is left to the developer to specify unique names for all DOM nodes that must be accessed in this manner. If more than one DOM nodes exist with a name of strName the behavior of this method is undefined.

Parameters:

strNamethe name of the object to return.

Returns:

the matching DOM object or null if none found. 

See Also:

getAllByName()

newId

static String newId(strNameSpace : String)
Creates a new unique system id.

Parameters:

strNameSpacethe application namespace for which to generate the id.

Returns:

 

onChange

void onChange(TYPE : int, JSXPARENTID : String, JSXID : String)
called when a change to the JSX DOM occurs for this server instance (adopt, load, delete, etc); publishes an event object (javascript object) with the following named properties: subject (jsx3.app.DOM.EVENT_CHANGE); type (jsx3.app.DOM.TYPEADD | jsx3.app.DOM.TYPEREMOVE); parentId (id of JSX parent); jsxId (id of element added or removed)

Parameters:

TYPEone of: jsx3.app.DOM.TYPEADD, jsx3.app.DOM.TYPEREMOVE
JSXPARENTIDid of dom parent
JSXIDid of dom element either added or removed

onNameChange

void onNameChange(objJSX : jsx3.app.Model, oldName : String)
A method that must be called after changing the name of a contained DOM node. This method updates the name index appropriately.

Parameters:

objJSX
oldNamethe name before it was changed

remove

void remove(objJSX : jsx3.app.Model)
Removes a JSX object from this DOM and removes it from the indices.

Parameters:

objJSX