|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--harmonic.mz.data.ModelNode
This class is the main element of the application wide database. This class
is to be extended to hold specialized data, either as java primatives or in more
DataNodes that are children of this. Storing data in the database provides
a uniform file saving mechanism, data dependancy tracking, automatic user
interface building, and peace of mind for the user since they can see the
data struture of their model. Extensions may ignore the ModelNodes to a
degree by instead using their own specialized data storage mechanism that is
referred to possibly just one ModelNode in the file.
Many members of this class are public for the purpose of memory introspection to find leeks. Try to use the access functions.
A tree node uses 80 bytes minimum, and allocates no additional objects with no children or listeners.
| Field Summary | |
FileNode |
_fileRoot_
Name of hypothetical parent node to be used to store copies of this node, for purposes of getCurrent(), setCurrent(). |
ValidationThread |
_thread_
Thread that owns the lock on this node |
static java.lang.String |
ATTRIB_CONTROL_WIDGET
|
static java.lang.String |
ATTRIB_LISTABLE
Allow this node to be listed in database tree or other lists |
static java.lang.String |
ATTRIB_PRESENTABLE
|
static java.lang.String |
ATTRIB_PRIVATE
Node will not be sent from collaboration source, or recieved as collaboration client if this is set |
static java.lang.String |
ATTRIB_REMOVEABLE
Allow user to delete this node |
static java.lang.String |
ATTRIB_RENAMEABLE
Tree interface wont allow editing if false |
static java.lang.String |
ATTRIB_SHOW_CONTEXT_MENU
|
static java.lang.String |
ATTRIB_TYPE_FILTER
|
static java.lang.String |
ATTRIB_USERGROUP
If true this node can be used as a parent node for groupings |
static java.lang.String |
ATTRIB_VALUE_GROUP
|
static java.lang.String |
ATTRIB_VE_LISTENER
|
boolean |
bCustomCS
|
boolean |
bDebug
Tag this object for debuging. |
boolean |
bValid
This node is invalid in any way. |
java.lang.String |
name
The name of this node for listings. |
| Constructor Summary | |
ModelNode()
Construct an un-attached tree node with no name. |
|
ModelNode(java.lang.String _name)
Construct a tree node with given name. |
|
| Method Summary | |
void |
actionPerformed(java.awt.event.ActionEvent event)
Implements actionPerformed to call showControlWidget(). |
void |
addAll(DataNode[] child)
Convinience function thats adds all given nodes. |
void |
addAlphaed(DataNode child)
Add child to this node in alphabetical order! |
void |
addField(DataNode f)
Short version of addField() |
void |
addField(java.lang.String name,
DataNode f)
Short version of addField() |
void |
addField(java.lang.String name,
java.lang.String catagory,
DataNode f)
This is a version of addNode() that makes the added node a field rather that an ordinary variable existance node. |
void |
addFields(java.util.Vector nodes)
Convinience function thats adds all given nodes as fields |
void |
addNetworkInput(ModelNode input)
Supports network editor. |
void |
addNetworkOutput(ModelNode output)
Supports network editor. |
void |
addNode(DataNode child)
Add child |
void |
addNodeListener(NodeListener listener)
Add a listener to this node that will send node events. |
void |
addNodeListener(java.lang.Object listener,
java.lang.String callback,
int eventID)
Add a listener to this node that will send node events. |
void |
addNodes(DataNode[] nodes)
Convinience function thats adds all given nodes |
void |
addNodes(java.util.Vector nodes)
Convinience function thats adds all given nodes |
void |
addToCurrent()
Add to database at current group. |
void |
addToGlobals()
Add to place in database for objects that should stay, but arn't part of a model. |
void |
addToNetworkEditor()
Add this to network editor user interface |
void |
addToTemps()
Add this to place in database for temporary objects. |
void |
addWithUndo()
Attach to database in current group, after going through undo system |
boolean |
allFieldsAreFinal()
Checks that all fields of this node are non transient and set |
void |
applyDataTransfer(DataTransfer transfer)
Apply the data transfer node. |
java.lang.String |
areFieldsValid()
Override to return an error string if there is a problem with any field, else return null. |
void |
assignFromMetaFields(MetaFields mf)
Assign this node from given meta fields. |
void |
assignFromXMLAttributes(MVGFileOpener opener,
org.xml.sax.Attributes node)
Assign this node from XML element. |
void |
assignFromXMLString(MVGFileOpener opener,
java.lang.String string)
Assign from the XML node text section. |
void |
assignToMetaFields(MetaFields mf)
Assign this node to given meta fields. |
void |
assignToXMLAttributes(MVGFileSaver saver,
org.xml.sax.helpers.AttributesImpl attrs,
boolean bUpdate)
Assign to the XML element |
java.lang.String |
assignToXMLString(MVGFileSaver saver)
Return string for XML text section. |
DataNode |
at(int i)
Return child at givin index |
void |
bind()
Some nodes can take effect in a globally. |
boolean |
canSelect()
Called by object selector to ask if it is OK to selcted this node |
ModelNode |
castSelection(java.lang.String castFunc,
harmonic.viewer3D.PaintStruct painter,
int iPart,
harmonic.meshGeom.math.Pnt3f pickedPoint)
Called by object selector during viewport picking. |
void |
checkFileRead()
This is called for all nodes created during a file read, after the entire file read is complete. |
java.lang.String |
checkNetworkInput(ModelNode input)
Supports network editor. |
int |
childCount()
Return number of chilren owned by this node |
void |
clean()
Null any references in child array past good size |
void |
clearAttrib(java.lang.Object key)
Remove attribute from table, making things as if it were never set. |
static void |
clearNotified()
Clear notifed table. |
boolean |
compare(java.lang.Object _o)
Compare function to be overridden by sub classes. |
void |
copyFrom(ModelNode field)
Copys given node so this one, or the node this is referenced to to this one. |
java.awt.Component |
createControlWidget()
Nodes may create gui interface widgets to enable the setting of their value. |
ModelNode |
createCopy()
Overrideable function to create and return a copy of this node Default version uses introspection to create a new copy using the newInstance() function, which requires a no argument public constructor. |
org.w3c.dom.Element |
createXMLElement(org.w3c.dom.Document doc)
Create XML element for this node |
ModelNode |
deepCopy()
This is a convienience:
return (ModelNode)(new TreeCopier()).deepCopy(this); |
static void |
defeatNodeEvents(boolean bDefeatNodeEvents)
Set whether any ModelNode will fire any events at all. |
void |
disableEvents()
Decrements event enabled counter. |
void |
enableEvents()
Decrements event enabled counter. |
int |
expectedValidationTime()
Return expected computation time in milli seconds for validation. |
FileNode |
fileRoot()
Returns the FileNode node that this is indirectly parented to. |
void |
finalize()
Overridden to update applications object counting |
static org.w3c.dom.Element |
findFieldElement(org.w3c.dom.Element group,
java.lang.String name)
A file concern. |
DataNode |
findNode(java.lang.String searchName)
Recusrively search this nodes children for node of given name |
void |
fromXMLNodes(XMLTransferNode[] nodes)
Implement to create XMLTransferNodes for file reading. |
java.lang.Object |
getAttrib(java.lang.Object key)
Get a special attribute from this node added for internal use. |
boolean |
getBound()
|
java.lang.String |
getCatagory()
Returns catagory name |
java.awt.Component |
getControlWidget()
Returns control widget created by createControlWidget() |
java.lang.String[] |
getCurrentNames()
Get names called for by functions looking for a current value |
DataTransfer[] |
getDataTransfer(java.lang.String type)
Return all data transfer nodes returnable for the type. |
java.lang.String[] |
getDataTransferTypes()
Override to let users of node know what types of data this node represents. |
boolean |
getDeleted()
Sets whether this node has been removed from database |
java.util.Vector |
getDirectInputs()
Return list of DataNodes this listens too. |
java.util.Vector |
getDirectOutputs()
Return list of objects listening to this |
java.util.Vector |
getEffectors(java.lang.String type)
|
EntryListener |
getEntryListener()
The EntryListener returned here is passed on to any ValueEntry created by this node. |
java.lang.String |
getErrorState()
Returns the the error state string |
java.lang.String |
getFilterType()
|
java.lang.String |
getFullName()
Returns long name that indicates ownership from the parent, for example objects.circle.radius |
java.util.Vector |
getHandles(java.lang.String type)
This recursively goes down tree looking for handles, and returns a list of all handles found. |
java.lang.String |
getInstanceURL()
This implements the Documentable interface by first checking if this.docURL is not null and returning it if it is not, then it asks its parent for the URL, if this is a named field. |
Interpolater |
getInterpolater()
Override to return an object that implements Interpolater. |
boolean |
getIsLeaf()
Returns leaf flag |
boolean |
getListable()
Convenience function, uses ATTRIB_LISTABLE |
int |
getMark()
Implements Markable object |
MetaFields |
getMetaFields()
Return the meta fields of this node. |
java.lang.String |
getName()
Return current name of this node |
java.util.Vector |
getNodeChildren_V()
Return children of node in vector form. |
DataNode[] |
getNodeChildren()
Return children of node |
int |
getNodeID()
This is an integer that is unique for all nodes in application. |
DataNode |
getNodeParent()
Return nodes parent |
ShapeNode |
getObjectRep()
It is possible for any node to be represented by a geometrical object. |
boolean |
getPresentable()
Convenience function, uses ATTRIB_PRESENTABLE. |
boolean |
getPrivate()
Convenience function, uses ATTRIB_PRIVATE. |
java.lang.String |
getReferencePoolName()
|
java.lang.String |
getRemoteOwner()
Gets remote owner name, for collaboration system |
boolean |
getRemoveable()
Convenience function, uses ATTRIB_REMOVEABLE |
boolean |
getRenameable()
Convenience function, uses ATTRIB_RENAMEABLE |
boolean |
getSaveable()
Gets whether this node should be saved to files |
DataNode[] |
getSavedChildren()
|
boolean |
getSelect()
Returns the selection state of thie node |
java.util.Vector |
getSeparateDirectInputs()
Return list of inputs that arnt its children |
java.util.Vector |
getSeparateDirectOutputs()
Return list of objects listening to this that aren't its parent |
boolean |
getSequenced()
Returns whether this sould appear in sequential input |
int |
getSerialNo()
Returns node's persistant serial number |
java.util.Vector |
getTags()
Return tags. |
boolean |
getTentativeSelect()
Return the tentative selection state of this node. |
Transformable |
getTransformable()
Override to return an object that implements Transformable. |
Transformable |
getTransformableParent()
This goes up the tree untill it finds a node that is transformable, starting at the parent |
boolean |
getTransient()
Return whether or not this object is gradually changing. |
java.lang.String |
getTreeName()
Override to return lable for tree interface |
java.awt.Image |
getTypeImage()
Returns the image to be used for this node in list interfaces that may put an image by node |
java.lang.String |
getTypeURL()
This implements the Documentable interface by like this: |
java.util.Vector |
getUnfoldedChildren()
Convinence function to unfolds ownership tree into a linear vector that may be easier to traverse. |
long |
getUpdateTime()
Gets update time, for collaboration system |
boolean |
getUserGroup()
Convenience function, uses ATTRIB_USERGROUP. |
boolean |
getValidates()
A node may be set to never validate - good for prototype nodes |
java.lang.Object |
getValue()
If this node represents a value that it keeps internally, such as an integer, this function should be overridden to do something like: return new Integer(myValue) |
XMLTransferNode[] |
getXMLNodes()
Implement to create XMLTransferNodes for file saving. |
boolean |
hasDependants()
Return whether any nodes are listening to this |
boolean |
hasExternalRef()
Returns whether this node is linked to another node out side the nodes model. |
java.lang.Object |
hashKey()
This is the recommended function for mapping from a ModelNode in a hashtable. |
boolean |
hasValidationLock()
Nodes can do a manual mutex lock for thread saftey. |
void |
hideControlWidget()
Remove any dialogs controling this node |
int |
indexOf(DataNode child)
|
void |
initControlWidget(ValueEntry e)
Update the control widget to follow this nodes current value |
void |
insertNode(DataNode child,
int index)
Insert child at given index |
void |
interpolate_Linear(ModelNode ret,
ModelNode value0,
ModelNode value1,
float b0,
float b1)
Implementation of Interpolater. |
void |
interpolate_Quadratic(ModelNode ret,
ModelNode value0,
ModelNode value1,
ModelNode value2,
float b0,
float b1,
float b2)
Implementation of Interpolater. |
void |
invalidate()
Marks this node as invalid, and add to the invalid object list. |
boolean |
isField()
Return whether this is "field" node. |
boolean |
isFinal()
Returns !getTransient() |
boolean |
isInSubtree(DataNode root)
Returns true if this some child of given node |
boolean |
isInTree()
Returns true if this is in the database tree. |
boolean |
isLinked()
Returns whether this node is following another. |
static boolean |
isNotified(NodeEvent event)
Returns whether this object has notified listeners since the last AWT event que processing. |
boolean |
isPurged()
Return whether this node has been purged since a validation |
boolean |
isSet()
Returns whether user interface effecting this node has set its value yet. |
boolean |
isTemporary()
Return whether this node will should be considered temporary. |
boolean |
isValid()
Returns if this has been marked invalid |
DataNode |
linkedTo()
Returns the node this is follows, null if is independent. |
boolean |
linksChildren()
Return whether this nodes children should be skipped in file write. |
void |
makeContextMenu(HWM_GroupData menu)
May be overrideen to add functions pertaining to this node to context menu. |
void |
makeFixed(boolean bFixed,
boolean bRecurse)
Convenience that calls setRenameable(!bFixed); setRemoveable(!bFixed); setPrivate(bFixed); |
ModelNode |
makePrototype()
Works in conjuection with setFromPrototype. |
void |
makeReferenced(DataNode _linkInput)
Link this node to the given node so that if the given node is changed this node will follow. |
void |
makeUnreferenced()
Make this node independant of any it points to, in other words dereference this node. |
void |
makeVisibleInGUI()
Sends the NodeEvent.SHOW_IN_GUI event |
static void |
markNotified(NodeEvent event)
Mark this object as having sent its change events already. |
boolean |
mayValidate()
Return whether node may be validated given the current state of this nodes dependants. |
void |
nodeChanged(NodeEvent event)
ModelNode implements NodeListener to give a default version for nodeChanged. |
void |
notifyListeners(NodeEvent event)
Send the event to regestered listeners |
void |
postAssignFromXMLElement()
Override to prepare anything after node is assigned from xml file |
void |
preAssignToXMLElement()
Override to prepare anything before node is assigned to xml file |
void |
printChildren()
Do debuging print of this nodes children. |
void |
printTags()
For debuging: print the tags of this node |
void |
printTree()
|
void |
printTree(java.io.PrintStream os,
int nn)
Prints name/value pairs of this sub tree |
void |
purge()
Called by database purging system to just free unneeded memory, while still alowing nodes to return to fully functional state. |
void |
purgeFinal()
Called by database when node is intended to never come back, such as when a file is closed or node is deleted out of the undo system. |
java.lang.String |
pythonString()
String for represention in python. |
void |
remove()
Remove this node its parent |
void |
removeAll()
Remove all children |
void |
removeAll(DataNode[] child)
Remove all given nodes |
void |
removeHandles()
Remove any handles created to contol this node |
void |
removeNetworkInput(ModelNode input)
Supports network editor. |
void |
removeNetworkOutput(ModelNode output)
Supports network editor. |
void |
removeNode(DataNode child)
Remove child from this node |
void |
removeNode(DataNode child,
boolean bUnlink)
Remove child from this node. |
void |
removeNode(int i)
Remove child at index |
boolean |
removeNodeListener(NodeListener sd)
Remove NodeListener. |
void |
replace(DataNode old,
DataNode niw)
Find old among children and replace it with niw |
void |
selfNodeChanged(NodeEvent event)
This is a cheap event listening function, called the notifyListeners, alowing a node to listen to events generated by itself without regeistering with this.addNodeListener(this). |
void |
set(DataNode _other)
Default version calls setValue(), and recuses over children. |
void |
setActualName(java.lang.String s)
Sets the name of this node, without changing the preferred name |
void |
setAttrib(java.lang.Object key,
java.lang.Object value)
Add a special attribute to this node for internal use. |
void |
setBound(boolean bBound)
|
void |
setCatagory(java.lang.String catagory)
Sets catagory name |
void |
setChildrenExcept(DataNode _other,
DataNode[] exept)
Assign all children to children of _other. |
void |
setCoordSystem(harmonic.viewer3D.CoordSystem cs)
Some fields are such as PointField are are floating in space without a coord system that defines them in global space. |
void |
setCurrentControlWidget(java.awt.Component cmp)
Sets the current control widget. |
void |
setCurrentNames(java.lang.String[] cts)
Set names called for by functions looking for a current value |
void |
setDeleted(boolean b)
Sets whether this node has been removed from database |
void |
setEntryListener(EntryListener listener)
The EntryListener given here is passed on to any ValueEntry created by this node. |
void |
setErrorState(java.lang.String error)
Sets the error state of this node, which may be displayable by some user interface. |
void |
setFromPrototype(ModelNode copy)
Works in conjuection with setFromPrototype. |
void |
setIsField(boolean b)
Implement to set if this node is a field. |
void |
setIsLeaf(boolean b)
Sets a flag indicating this node will always be a leaf |
void |
setIsSet(boolean b)
Sets set flag. |
void |
setListable(boolean b)
Conveniece function, uses ATTRIB_LISTABLE. |
void |
setMark(int mark)
Implements Markable object |
void |
setMetaFields(MetaFields mf)
Set this nodes meta fields if it has any. |
void |
setName(java.lang.String s)
Sets name of this node. |
void |
setNodeParent(DataNode parent)
Normllay this should not be used. |
void |
setPresentable(boolean b)
Convenience function, uses ATTRIB_PRESENTABLE. |
void |
setPrivate(boolean b)
Convenience function, uses ATTRIB_PRIVATE. |
void |
setRemoteOwner(java.lang.String owner)
Sets remote owner name, for collaboration system |
void |
setRemoveable(boolean b)
Convenience function, uses ATTRIB_REMOVEABLE. |
void |
setRenameable(boolean b)
Convience function, uses ATTRIB_RENAMEABLE. |
void |
setSaveable(boolean b)
Sets whether this node should be saved to files |
void |
setSelect(boolean b)
This version assumes Selector.getModelSelector() |
void |
setSelect(boolean b,
Selector selector)
Sets the selection state of this node. |
void |
setSequenced(boolean b)
Sets whether this sould appear in sequential input |
void |
setSerialNo(int sn)
Set node's persistant serial number |
void |
setTentativeSelect(boolean b)
This version assumes Selector.getModelSelector() |
void |
setTentativeSelect(boolean b,
Selector selector)
Sets the tentative selection state of this node. |
void |
setToLink(ModelNode linkInput)
Called by to make this node follow its linkInput. |
void |
setTransient(boolean b)
Set whether or not this object is gradually changing. |
void |
setTransientChildren(boolean b)
|
void |
setUpdateTime(long time)
Sets update time, for collaboration system |
void |
setUserGroup(boolean b)
Convenience function, uses ATTRIB_USERGROUP. |
void |
setValidates(boolean b)
A node may be set to never validate - good for prototype nodes |
void |
setValidationLock(boolean b)
Sets if this has the validation lock |
void |
setValue(java.lang.Object obj)
If this node represents a value that it keeps internally, such as an integer, this function should be overridden to do something like: this.myValue = ((Integer)obj).intValue() |
void |
setValueGroup(java.lang.String s)
Set name of hypothetical parent node to be used to store copies of this node, for purposes of getCurrent(), setCurrent(). |
void |
showControlWidget()
Shows special controls returned by createControlWidget() Calls showControlWidget(-1, -1, false) |
void |
showControlWidget(boolean bModal)
Shows special controls returned by createControlWidget() Calls showControlWidget(-1, -1, bModal) |
void |
showControlWidget(int x,
int y,
boolean bModal)
Shows special controls returned by createControlWidget() the the given location |
void |
showHandles(java.lang.String type)
This gets handles getHandles() and shows them. |
void |
startRename()
Sends the NodeEvent.RENAME_IN_GUI event |
void |
tag(java.lang.String s)
Tag this node with string tag. |
java.lang.String |
toString()
Prints name for large nodes (with children), the value for small nodes. |
void |
unlinkListeners()
Called to clean up node by database when it closes file |
static void |
unmarkNotified(NodeEvent event)
Mark this object as not having sent its change events already. |
void |
untag(java.lang.String s)
Untag this node with string tag. |
void |
updateBindable()
This is the opposite of bind: update the bindable object to hold the information is will effect when bind() is called - like write the current viewpoint information to a viewpoint node. |
void |
valChanged()
This is short cut that calles notifyListeners(VALUE_CHANGED), with this as the event producer, and invalidate(). |
void |
valChanged(DataNode producer)
This is short cut that calles notifyListeners(VALUE_CHANGED), with the given event producer, and invalidate(). |
void |
validate()
Called by the database durring its scene validation if node is invalid. |
java.lang.String |
valueString()
String to represent value |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public boolean bDebug
public boolean bCustomCS
public ValidationThread _thread_
public boolean bValid
public java.lang.String name
public FileNode _fileRoot_
public static final java.lang.String ATTRIB_CONTROL_WIDGET
public static final java.lang.String ATTRIB_TYPE_FILTER
public static final java.lang.String ATTRIB_VALUE_GROUP
public static final java.lang.String ATTRIB_VE_LISTENER
public static final java.lang.String ATTRIB_PRESENTABLE
public static final java.lang.String ATTRIB_SHOW_CONTEXT_MENU
public static final java.lang.String ATTRIB_LISTABLE
public static final java.lang.String ATTRIB_RENAMEABLE
public static final java.lang.String ATTRIB_USERGROUP
public static final java.lang.String ATTRIB_REMOVEABLE
public static final java.lang.String ATTRIB_PRIVATE
| Constructor Detail |
public ModelNode()
public ModelNode(java.lang.String _name)
_name - Name of new node| Method Detail |
public int getMark()
getMark in interface harmonic.meshGeom.math.MarkableObjectpublic void setMark(int mark)
setMark in interface harmonic.meshGeom.math.MarkableObjectpublic java.lang.Object hashKey()
public static void defeatNodeEvents(boolean bDefeatNodeEvents)
public void finalize()
finalize in class java.lang.Objectpublic void purge()
purge in interface DataNodepublic boolean isPurged()
public void purgeFinal()
purgeFinal in interface DataNodepublic java.lang.String[] getDataTransferTypes()
public DataTransfer[] getDataTransfer(java.lang.String type)
public void applyDataTransfer(DataTransfer transfer)
public void addToCurrent()
public void addWithUndo()
public void addToGlobals()
public void addToTemps()
public void setRemoteOwner(java.lang.String owner)
setRemoteOwner in interface DataNodepublic java.lang.String getRemoteOwner()
getRemoteOwner in interface DataNodepublic void setUpdateTime(long time)
setUpdateTime in interface DataNodepublic long getUpdateTime()
getUpdateTime in interface DataNodepublic void setIsLeaf(boolean b)
public boolean getIsLeaf()
public boolean isField()
isField in interface DataNodepublic int getNodeID()
public DataNode findNode(java.lang.String searchName)
searchName - Name to search forpublic void printChildren()
public boolean isTemporary()
public void makeFixed(boolean bFixed,
boolean bRecurse)
public java.util.Vector getUnfoldedChildren()
public FileNode fileRoot()
fileRoot in interface DataNodepublic ModelNode createCopy()
public void copyFrom(ModelNode field)