class Model
All Implemented Interfaces:
Direct Known Subclasses:
The abstract base class that defines the JSX DOM. Instances of this class exist as nodes in a tree, each with
a single parent and multiple children. This class includes all the methods for querying and manipulating the DOM's
tree structure, such as getChild(), adoptChild(), getParent(), etc.
| Field Summary |
|---|
| static int | The number of milliseconds before asynchronous component loads time out. |
| static String | Minimum supported version CIF formatted serialization files |
| static String | Minimum supported version for serialization files
|
| static int | The normal load type for a DOM branch. |
| static int | Load type indicating that the DOM branch will deserialize and paint as needed when it becomes visible. |
| static int | Load type indicating that the DOM branch will paint as needed when it becomes visible. |
| static int | Load type indicating that the DOM branch will deserialize and paint after its parent deserializes and the
call stack resets. |
| static int | Load type indicating that the DOM branch will paint after its parent paints and the call stack resets. |
| static int | Load type indicating that the DOM branch will deserialize after its parent deserializes and the call stack
resets and will paint after its parent paints and the call stack resets. |
| static Object<String, boolean> | The allowed meta data fields. |
| static int | Normal persistance value for a child that will be persisted. |
| static int | Persistance value fora child that is temporarily part of the DOM tree and will not be persisted. |
| static int | Persistance value for a child that exists in an external serialization file and is referenced by URI. |
| static int | Persistance value for a child that exists in an external serialization file and is referenced by URI. |
| Constructor Summary |
|---|
| void | The instance initializer. |
| Method Summary |
|---|
| void | Appends a DOM node to this object after removing the node from its former parent reference. |
| jsx3.app.Model | Creates and returns an exact replica of the object. |
| jsx3.app.Model | Returns the first ancestor passing the given test function. |
| jsx3.app.Model | Array<jsx3.app.Model> | Finds all DOM nodes descending from this DOM node that pass the given test function. |
| jsx3.app.Model | Returns the first ancestor with the given name. |
| jsx3.app.Model | Returns the first ancestor of the given type. |
| jsx3.app.Model | Returns the child DOM node of this node at the given index or with the given name. |
| int | Returns the zero-based index for this DOM node in relation to its siblings. |
| Array<jsx3.app.Model> | Returns an array containing all the child DOM nodes of this object. |
| jsx3.app.Model | Finds the first descendant of this DOM node with a the given name. |
| Array<jsx3.app.Model> | Finds all descendants of the given type. |
| jsx3.app.Model | Returns the first child. |
| jsx3.app.Model | Finds the first child of the given type. |
| String | Returns the help ID of this object. |
| String | Returns the custom JSX-generated id for the object (i.e. |
| jsx3.app.Model | Returns the last child. |
| int | Returns the load type of this DOM node and the descending branch. |
| String | Returns one of the meta data values stored at the top of the serialization file that this object was loaded from. |
| String | Returns the namespace that distinguishes this object's server (owner) from other server instances. |
| String | Returns the custom developer-defined name of this object. |
| jsx3.app.Model | Returns the next sibling. |
| jsx3.app.Model | Returns the parent DOM node of this object. |
| int | Returns the persistence bit for this model object. |
| jsx3.app.Model | Returns the previous sibling. |
| jsx3.app.Server | Returns an object reference to the server that owns this object. |
| jsx3.net.URIResolver | Returns the URI resolver for this DOM node. |
| static String | |
| boolean | Assigns objMoveChild as the previousSibling of objPrecedeChild |
| jsx3.app.Model | Deserializes a JSX serialization file and appends the deserialized objects as children of this DOM node. |
| void | Loads a component file and caches the document in an XML cache. |
| jsx3.app.Model | Deserializes a JSX serialization file and appends the deserialized objects as children of this DOM node. |
| protected void | Called during deserialization of this object. |
| protected void | Called during deserialization of this object. |
| protected void | Called during deserialization of this object. |
| protected void | Called when the server owning this DOM node changes. |
| protected void | The finalizer method. |
| protected void | Hook that notifies this model object that one of its children has been removed. |
| protected boolean | Hook that allows for a prospective parent DOM node to veto the adoption of a child. |
| protected boolean | Hook that allows for a prospective child DOM node to veto its adoption by a parent. |
| jsx3.app.Model | Removes a DOM child from this object. |
| jsx3.app.Model | Removes some or all children of this object. |
| jsx3.app.Model | boolean | Appends a child DOM node to this parent DOM node. |
| void | Sets the help ID of this object. |
| void | Sets the load type of this DOM node and the descending branch. |
| void | setS one of the meta data values stored at the top of a component's serialization file. |
| void | Sets the custom developer-defined name of this object. |
| jsx3.app.Model | Sets the persistence bit for this model object. |
| String | Returns a string representation of this object. |
| String | Returns this object serialized as XML by calling toString() on the result of toXMLDoc()
called on this object. |
| jsx3.xml.Document | Serializes this object as an XML document. |
| Methods Inherited From jsx3.lang.Object |
|---|
| clone, equals, eval, getClass, getInstanceOf, getInstanceOfClass, getInstanceOfPackage, instanceOf, isInstanceOf, isSubclassOf, jsxmix, jsxsuper, jsxsupermix, setInstanceOf |
static
int ASYNC_LOAD_TIMEOUT
The number of milliseconds before asynchronous component loads time out.
Minimum supported version CIF formatted serialization files
Minimum supported version for serialization files
static final
int LT_NORMAL
The normal load type for a DOM branch. The DOM branch deserializes and paints with its parent.
static final
int LT_SHOW_DESER
Load type indicating that the DOM branch will deserialize and paint as needed when it becomes visible.
It is left to subclasses of Model to implement this functionality.
static final
int LT_SHOW_PAINT
Load type indicating that the DOM branch will paint as needed when it becomes visible. It is left to
subclasses of Model to implement this functionality.
static final
int LT_SLEEP_DESER
Load type indicating that the DOM branch will deserialize and paint after its parent deserializes and the
call stack resets.
static final
int LT_SLEEP_PAINT
Load type indicating that the DOM branch will paint after its parent paints and the call stack resets.
static final
int LT_SLEEP_PD
Load type indicating that the DOM branch will deserialize after its parent deserializes and the call stack
resets and will paint after its parent paints and the call stack resets.
The allowed meta data fields. See getMetaValue() and setMetaValue().
static final
int PERSISTEMBED
Normal persistance value for a child that will be persisted.
static final
int PERSISTNONE
Persistance value fora child that is temporarily part of the DOM tree and will not be persisted.
static final
int PERSISTREF
Persistance value for a child that exists in an external serialization file and is referenced by URI.
static final
int PERSISTREFASYNC
Persistance value for a child that exists in an external serialization file and is referenced by URI. The
loading of a child with this persistence value will happen asynchronously after the file that references it is
loaded.
void init(strName
: String, strInstanceOf
: ?)
The instance initializer.
Parameters:
strName – a unique name distinguishing this object from all other JSX GUI objects in the JSX application
strInstanceOf –
Appends a DOM node to this object after removing the node from its former parent reference. If the node to append
does not already have a DOM parent, setChild() should be used instead of this method.
Parameters:
objChild – the child to adopt
bRepaint – if true or null, the object being adopted will be added to
the parent's view via the parent's paintChild() method.
This parameter is made available for those situations where a loop is executing and multiple
objects are being adopted. As view operations are the most CPU intensive, passing false
while looping through a collection of child objects to adopt will improve performance. After the
last child is adopted, simply call repaint() on the parent to immediately synchronize the view.
bForce – if true, the adoption is forced, even if the parent/child don't accept such adoptions (onSetChild() and onSetParent() will still be called)
See Also:
Creates and returns an exact replica of the object. The clone will be appended as a new child node of this
object's parent node.
Parameters:
intPersist – the persistance value of the clone.
intMode – 0 for insert as the last child of the parent of this object and paint,
1 for insert as the last child of this parent of this object and do not paint, or 2
for load as a fragment.
Throws:
Returns:
the clone.
Returns the first ancestor passing the given test function.
Parameters:
fctTest – test function, takes a single jsx3.app.Model parameter and returns
true if the node matches.
bIncludeSelf – if true, include this object in the search
Returns:
Finds all DOM nodes descending from this DOM node that pass the given test function. Results are guaranteed to be
returned in order according to the search order used.
Parameters:
fctTest – test function, takes a single jsx3.app.Model parameter and returns
true if the node matches.
bDepthFirst – specifies whether to do a depth first or breadth first search.
bMultiple – if true, return an array of matches, otherwise just the first match.
bShallow – if true, only search direct children.
bIncludeSelf – if true, include this node in the search.
Returns:
the match (bMultiple = false) or matches (bMultiple = true).
Returns the first ancestor with the given name.
Parameters:
strName – the name to query on.
Returns:
the first ancestor with the given name or null if none found.
Returns the first ancestor of the given type.
Parameters:
strType – the fully-qualified class name, class constructor function,
or jsx3.Class instance.
Returns:
the first ancestor of the given type or null if none found.
Returns the child DOM node of this node at the given index or with the given name. If a name is supplied, the
children are searched in order and the first matching child is returned.
Parameters:
vntIndexOrName – either the integer index or the string name of the child.
Returns:
the child at the given index or with the given name, or null if no such
child exists.
Returns the zero-based index for this DOM node in relation to its siblings.
Returns:
the index or -1 if this object does not have a parent.
Returns an array containing all the child DOM nodes of this object. The return value is the original array rather
than a copy and should not be modified.
Returns:
Finds the first descendant of this DOM node with a the given name.
Parameters:
strName – the name to query on.
bDepthFirst – specifies whether to do a depth first or breadth first search.
bChildOnly – if true, only search the children of this DOM node.
Returns:
the descendant with the given name or null if none found.
Finds all descendants of the given type.
Parameters:
strType – the fully-qualified class name, class constructor function,
or jsx3.Class instance.
bShallow – if true, only search direct children, not all descendants.
Returns:
an array of matching descendants
Returns the first child.
Returns:
Finds the first child of the given type.
Parameters:
strType – the fully-qualified class name, class constructor function,
or jsx3.Class instance.
bExact – if true then only return objects whose class is exactly strType
(rather than returning subclasses too).
Returns:
the child of the given type or null if none found.
Returns the help ID of this object.
Returns:
Since:
3.5
See Also:
Returns the custom JSX-generated id for the object (i.e., _jsx2384098324509823049).
Returns:
JSX id
Returns the last child.
Returns:
Returns the load type of this DOM node and the descending branch. The load type determines how this DOM branch
deserializes and paints in relation to its parent DOM node.
Returns:
LT_NORMAL, LT_SLEEP_PAINT, LT_SLEEP_DESER,
LT_SLEEP_PD, LT_SHOW_PAINT, or LT_SHOW_DESER.
Since:
3.5
See Also:
Returns one of the meta data values stored at the top of the serialization file that this object was loaded from.
Parameters:
strKey – the name of the meta data field, one of the keys in META_FIELDS.
Returns:
the meta data value or empty string.
See Also:
Returns the namespace that distinguishes this object's server (owner) from other server instances. The namespace
is set when this object is bound to a DOM tree.
Returns:
the namespace of the server that owns this object instance.
Returns the custom developer-defined name of this object.
Returns:
Returns the next sibling.
Returns:
Returns the parent DOM node of this object.
Returns:
Returns the persistence bit for this model object.
Returns:
one of PERSISTNONE, PERSISTEMBED, PERSISTREF,
PERSISTREFASYNC.
See Also:
Finds the first descendant of this DOM node with a the given name.
Parameters:
strName – the name to query on.
bDepthFirst – specifies whether to do a depth first or breadth first search.
bChildOnly – if true, only search the children of this DOM node.
Returns:
the descendant with the given name or null if none found.
Finds all descendants of the given type.
Parameters:
strType – the fully-qualified class name, class constructor function,
or jsx3.Class instance.
bShallow – if true, only search direct children, not all descendants.
Returns:
an array of matching descendants
Returns the first child.
Returns:
Finds the first child of the given type.
Parameters:
strType – the fully-qualified class name, class constructor function,
or jsx3.Class instance.
bExact – if true then only return objects whose class is exactly strType
(rather than returning subclasses too).
Returns:
the child of the given type or null if none found.
Returns the help ID of this object.
Returns:
Since:
3.5
See Also:
Returns the custom JSX-generated id for the object (i.e., _jsx2384098324509823049).
Returns:
JSX id
Returns the last child.
Returns:
Returns the load type of this DOM node and the descending branch. The load type determines how this DOM branch
deserializes and paints in relation to its parent DOM node.
Returns:
LT_NORMAL, LT_SLEEP_PAINT, LT_SLEEP_DESER,
LT_SLEEP_PD, LT_SHOW_PAINT, or LT_SHOW_DESER.
Since:
3.5
See Also:
Returns one of the meta data values stored at the top of the serialization file that this object was loaded from.
Parameters:
strKey – the name of the meta data field, one of the keys in META_FIELDS.
Returns:
the meta data value or empty string.
See Also:
Returns the namespace that distinguishes this object's server (owner) from other server instances. The namespace
is set when this object is bound to a DOM tree.
Returns:
the namespace of the server that owns this object instance.
Returns the custom developer-defined name of this object.
Returns:
Returns the next sibling.
Returns:
Returns the parent DOM node of this object.
Returns:
Returns the persistence bit for this model object.
Returns:
one of PERSISTNONE, PERSISTEMBED, PERSISTREF,
PERSISTREFASYNC.
See Also:
Returns the previous sibling.
Returns:
Returns an object reference to the server that owns this object. This method returns null if this
object is part of a DOM fragment. Until an object is added to a DOM tree by passing it as the parameter to
setChild(), the object will be a DOM fragment.
Returns:
Returns the URI resolver for this DOM node. This method returns the server of this object unless this node
or its ancestor was loaded into the DOM with an explicit URI resolver.
Returns:
Deprecated.
Returns the release/build for the class (i.e., "3.0.00")
Returns:
Assigns objMoveChild as the previousSibling of objPrecedeChild
Parameters:
objMoveChild – the one being moved. Can belong to this object, another object, or can be a GUI fragment
objPrecedeChild – the one to insert before
bRepaint – if false the repaint will be suppressed (useful for multiple obejct updates
that would lead to unnecessary updates to the VIEW)
Returns:
true if successful
Deserializes a JSX serialization file and appends the deserialized objects as children of this DOM node.
Parameters:
strURL – URL (either relative or absolute) of the serialization file to deserialize.
This URL is resolved relative to objResolver, if provided, or the URI resolver of this DOM node.
bRepaint – if true or null the deserialized objects will be
added to the parent's view via the parent object's paintChild() method.
objResolver – If this parameter is provided, strURL is resolved
relative to it. Additionally, this resolver is stored as the URI resolver for this DOM node and its descendants.
Throws:
Returns:
the deserialized object. A serialization file may specify more than one root
object, in which case this method returns the first deserialized object.
See Also:
Loads a component file and caches the document in an XML cache. If the component file already exists in the cache
then it is loaded from the cache. All component files loaded as a result of this call (referenced files) are also
cached. This method is a useful replacement for load() when the same URL will be loaded multiple
times in one application.
Parameters:
strURL – URL (either relative or absolute) of the serialization file to deserialize.
This URL is resolved relative to objResolver, if provided, or the URI resolver of this DOM node.
bRepaint – if true or null the deserialized objects will be
added to the parent's view via the parent object's paintChild() method.
objCache – the cache to store the component XML documents in. If not provided, the cache
of the server of this model object is used.
objResolver – If this parameter is provided, strURL is resolved
relative to it. Additionally, this resolver is stored as the URI resolver for this DOM node and its descendants.
Throws:
See Also:
Deserializes a JSX serialization file and appends the deser
Deserializes a JSX serialization file and appends the deserialized objects as children of this DOM node.
Parameters:
strXML – the XML content of a JSX serialization file.
bRepaint – if true or null the deserialized objects will be
added to the parent's view via the parent object's paintChild() method.
objResolver –
Throws:
Returns:
the deserialized object. A serialization file may specify more than one root
object, in which case this method returns the first deserialized object.
Called during deserialization of this object. This method provides a hook for initializing
an object during deserialization since init() is not called. Called after this object has been instantiated and
after its fields and children have been assembled.This method is called before this object is attached to the
DOM, therefore getParent(), getServer(), getXML(), etc. return null.
Parameters:
objParent – the parent of this object once it is attached to the DOM.
objServer – the server that this DOM object will attach to.
protected void onAfterAttach()
Called during deserialization of this object. This method provides a hook for initializing
an object during deserialization since
init() is not called. Called after this object has been
instantiated and after it has been attached to the DOM. Methods overriding this method should usually finish
with a call to
jsxsuper().
When a new branch is attached to the DOM, this method is executed on each node in the branch. The order is
reverse-breadth-first meaning that child nodes are notified from oldest to youngest and before the parent node.
This implementation of this method executes the on-after-deserialize script of this object.
Called during deserialization of this object. This method provides a hook for initializing
an object during deserialization since init() is not called. Called after this object has been instantiated but
before its fields and children have been assembled. This method is called before this object is attached to the
DOM, therefore getParent(), getServer(), getXML(), etc. return null.
Parameters:
objParent – the parent of this object once it is attached to the DOM.
objServer – the server that this DOM object will attach to.
Called when the server owning this DOM node changes.
Parameters:
objNewServer –
objOldServer –
Since:
3.5
The finalizer method. This method provides a hook for subclasses of this class to perform custom logic
when an instance of this class is removed from the DOM. Methods that override this method should begin with
a call to
jsxsuper().
Note that this method is called after this object has been removed from the DOM tree. Therefore
this.getParent() and
this.getServer() will return
null. Use the
objParent parameter for access to the DOM tree.
Parameters:
objParent – reference to the former parent
Hook that notifies this model object that one of its children has been removed. This hook exists simply to allow
this object to perform cleanup/re-render, and does not provide a veto mechanism. This method is called after
the child has been removed from the model (
this.getChildren() does not contain
objChild)
and after the child has been removed from the view (
objChild.getRendered() is also null).
This method is only called if the child is being removed from the DOM but this object (the parent) is not
being removed. Therefore, this hook cannot be relied upon for garbage collection.
If
removeChildren() is called on this object, this hook is called exactly once after all children
have been removed. In that case, the first parameter to this method will be the array of children and the
second parameter will be
null.
In general a method overriding this method should begin by calling
jsxsuper.
Parameters:
objChild – the child that was removed
intIndex – the index of the removed child
protected
boolean onSetChild(objChild
: ?)
Hook that allows for a prospective parent DOM node to veto the adoption of a child.
Parameters:
Returns:
true to allow the set, false to veto
protected
boolean onSetParent(objParent
: ?)
Hook that allows for a prospective child DOM node to veto its adoption by a parent. This method is only called if
the prospective parent has not already vetoed the adoption in the onSetChild() method.
Parameters:
Returns:
true to allow the set, false to veto
Removes a DOM child from this object. This method removes the on-screen DHTML of the removed object. The removed
child will be completely derefenced from the DOM and will be prepped for garbage collection. If a DOM child must
continue to exist after removing it from this parent, adoptChild() should be used instead of this
method.
Parameters:
vntItem – either the index of the child to remove or the child itself.
Returns:
this object
See Also:
Returns:
this object
See Also:
Removes some or all children of this object.
Parameters:
arrChildren – the children to remove. If this parameter is not provided then all
children are removed.
Returns:
this object.
See Also:
Appends a child DOM node to this parent DOM node. If the child already has a parent, adoptChild()
should be used instead to ensure that the child is removed from its current parent.
Parameters:
objChild – the root node of a DOM fragment.
intPersist – defines how the child will be persisted/serialized. The valid values are the four
persistence values defined as static fields in this class.
strSourceURL – the path to the serialization file where the child exists. This parameter is only
relevant if the given intPersist is PERSISTREF or PERSISTREFASYNC.
strNS – the namespace of the child to append. This parameter is normally not required but is useful
when sharing DOM nodes between servers with different namespaces.
Throws:
{jsx3.lang.Exception} –
if this object is part of a DOM fragment (the namespace is null) and the
strNS parameter is not specified. Returns:
this object or false if the set was vetoed
See Also:
void setHelpId(strId
: String)
Sets the help ID of this object.
Parameters:
Since:
3.5
See Also:
void setLoadType(intLoadType
: int)
Sets the load type of this DOM node and the descending branch.
Parameters:
intLoadType – LT_NORMAL, LT_SLEEP_PAINT, LT_SLEEP_DESER,
LT_SLEEP_PD, LT_SHOW_PAINT, or LT_SHOW_DESER.
Since:
3.5
See Also:
setS one of the meta data values stored at the top of a component's serialization file.
Parameters:
strKey – the name of the meta data field, one of the keys in META_FIELDS
strValue – the new value of the meta data field.
See Also:
void setName(strName
: String)
Sets the custom developer-defined name of this object.
Parameters:
strName – a name unique among all DOM nodes currently loaded in the application.
Sets the persistence bit for this model object.
Parameters:
intPersist – one of PERSISTNONE, PERSISTEMBED, PERSISTREF,
PERSISTREFASYNC.
Returns:
this object
See Also:
Returns a string representation of this object.
Returns:
Overrides:
Returns this object serialized as XML by calling toString() on the result of toXMLDoc()
called on this object.
Parameters:
objProperties – name-value pairs that affect the serialization. See
toXMLDoc() for a description.
Returns:
this object serialized as an XML string.
See Also:
Serializes this object as an XML document.
The
objProperties parameter may include the following keys:
- onafter {String} - the value of the
onAfterDeserialize element
- onbefore {String} - the value of the
onBeforeDeserialize element
- name {String} - the value of the
name element
- icon {String} - the value of the
icon element
- description {String} - the value of the
description element
- children {boolean} - if
true the children of this object, rather than this object, are
serialized
- persistall {boolean} - if
true all descendants with persistence PERSISTNONE are included in the
serialization
Parameters:
objProperties – name-value pairs that affect the serialization. See above for
valid names and how they affect serialization.
Returns:
this object serialized as an XML document.
Copyright © 2001-2007, TIBCO Software Inc.