harmonic.mz.data
Class ModelNode

java.lang.Object
  |
  +--harmonic.mz.data.ModelNode
All Implemented Interfaces:
java.awt.event.ActionListener, DataNode, Documentable, java.util.EventListener, Interpolater, harmonic.meshGeom.math.MarkableObject, NodeListener
Direct Known Subclasses:
AngleField, AxisField, BinaryField, BooleanField, ColorField, CoordSystemField, DumbGeometryShape.GeometryNode, FileField, FileNode, FontField, FunctionStarter, IntField, ListNode, MaterialField, Module, NodeSetField, PointField, PointSetField, ScalarField, ScalarSetField, ShapeGroup, ShapeNode, StringField, StringSetField, TableNode, UndoRecord, VectorField

public class ModelNode
extends java.lang.Object
implements DataNode, harmonic.meshGeom.math.MarkableObject, NodeListener, Interpolater, Documentable, java.awt.event.ActionListener

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

bDebug

public boolean bDebug
Tag this object for debuging. There are some built in print outs in the jv package, and developers add their own print outs: if(bDebug) System.out.println("yes!");


bCustomCS

public boolean bCustomCS

_thread_

public ValidationThread _thread_
Thread that owns the lock on this node


bValid

public boolean bValid
This node is invalid in any way. It will be validated by the database in response to a message loop hook


name

public java.lang.String name
The name of this node for listings. Ideally the name should be unique within the model, but this is not enforeced by jv package


_fileRoot_

public FileNode _fileRoot_
Name of hypothetical parent node to be used to store copies of this node, for purposes of getCurrent(), setCurrent().


ATTRIB_CONTROL_WIDGET

public static final java.lang.String ATTRIB_CONTROL_WIDGET
See Also:
Constant Field Values

ATTRIB_TYPE_FILTER

public static final java.lang.String ATTRIB_TYPE_FILTER
See Also:
Constant Field Values

ATTRIB_VALUE_GROUP

public static final java.lang.String ATTRIB_VALUE_GROUP
See Also:
Constant Field Values

ATTRIB_VE_LISTENER

public static final java.lang.String ATTRIB_VE_LISTENER
See Also:
Constant Field Values

ATTRIB_PRESENTABLE

public static final java.lang.String ATTRIB_PRESENTABLE
See Also:
Constant Field Values

ATTRIB_SHOW_CONTEXT_MENU

public static final java.lang.String ATTRIB_SHOW_CONTEXT_MENU
See Also:
Constant Field Values

ATTRIB_LISTABLE

public static final java.lang.String ATTRIB_LISTABLE
Allow this node to be listed in database tree or other lists

See Also:
Constant Field Values

ATTRIB_RENAMEABLE

public static final java.lang.String ATTRIB_RENAMEABLE
Tree interface wont allow editing if false

See Also:
Constant Field Values

ATTRIB_USERGROUP

public static final java.lang.String ATTRIB_USERGROUP
If true this node can be used as a parent node for groupings

See Also:
Constant Field Values

ATTRIB_REMOVEABLE

public static final java.lang.String ATTRIB_REMOVEABLE
Allow user to delete this node

See Also:
Constant Field Values

ATTRIB_PRIVATE

public static final java.lang.String ATTRIB_PRIVATE
Node will not be sent from collaboration source, or recieved as collaboration client if this is set

See Also:
Constant Field Values
Constructor Detail

ModelNode

public ModelNode()
Construct an un-attached tree node with no name.


ModelNode

public ModelNode(java.lang.String _name)
Construct a tree node with given name.

Parameters:
_name - Name of new node
Method Detail

getMark

public int getMark()
Implements Markable object

Specified by:
getMark in interface harmonic.meshGeom.math.MarkableObject

setMark

public void setMark(int mark)
Implements Markable object

Specified by:
setMark in interface harmonic.meshGeom.math.MarkableObject

hashKey

public java.lang.Object hashKey()
This is the recommended function for mapping from a ModelNode in a hashtable. Using this intead of a reference to the node avoids memory leaks in the hash table


defeatNodeEvents

public static void defeatNodeEvents(boolean bDefeatNodeEvents)
Set whether any ModelNode will fire any events at all. This should be used only if it will relyable be set back to the true state.


finalize

public void finalize()
Overridden to update applications object counting

Overrides:
finalize in class java.lang.Object

purge

public void purge()
Called by database purging system to just free unneeded memory, while still alowing nodes to return to fully functional state. Override to purge non essential memory that can be re computed based on other memory. Be sure to call super.purge(), which sets the isPurged flag.

Specified by:
purge in interface DataNode

isPurged

public boolean isPurged()
Return whether this node has been purged since a validation


purgeFinal

public 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. Override to purge all memory usded by this node. Its easy to think that just removing the node from the tree would cause it to be garbage collected, but references to nodes can be hard to compleatly remove, so this function exists to minimize the damage of a leaked node.

Specified by:
purgeFinal in interface DataNode

getDataTransferTypes

public java.lang.String[] getDataTransferTypes()
Override to let users of node know what types of data this node represents. The default returns an empty array.


getDataTransfer

public DataTransfer[] getDataTransfer(java.lang.String type)
Return all data transfer nodes returnable for the type. The default returns an empty array.


applyDataTransfer

public void applyDataTransfer(DataTransfer transfer)
Apply the data transfer node. This enables node output data to be modified and given back to the node. This modification system is for one time applications of operations to a node. The modifier object cannot stay in the network because the source data could then be potentialy be modified again and again without end.


addToCurrent

public void addToCurrent()
Add to database at current group. If this has already been added, no change will be made, the assumption being the current place is intended.


addWithUndo

public void addWithUndo()
Attach to database in current group, after going through undo system


addToGlobals

public void addToGlobals()
Add to place in database for objects that should stay, but arn't part of a model.


addToTemps

public void addToTemps()
Add this to place in database for temporary objects. If object is intended to be removed by the module that added it, it is a good idea add it to the temporaries, incase something goes wrong the user can clear the temp group.


setRemoteOwner

public void setRemoteOwner(java.lang.String owner)
Sets remote owner name, for collaboration system

Specified by:
setRemoteOwner in interface DataNode

getRemoteOwner

public java.lang.String getRemoteOwner()
Gets remote owner name, for collaboration system

Specified by:
getRemoteOwner in interface DataNode

setUpdateTime

public void setUpdateTime(long time)
Sets update time, for collaboration system

Specified by:
setUpdateTime in interface DataNode

getUpdateTime

public long getUpdateTime()
Gets update time, for collaboration system

Specified by:
getUpdateTime in interface DataNode

setIsLeaf

public void setIsLeaf(boolean b)
Sets a flag indicating this node will always be a leaf


getIsLeaf

public boolean getIsLeaf()
Returns leaf flag


isField

public boolean isField()
Return whether this is "field" node. A field node is a fixed member of its parent

Specified by:
isField in interface DataNode

getNodeID

public int getNodeID()
This is an integer that is unique for all nodes in application. It is better than the serialNo for some things, because the serial number is unique only per file. The id however, will not persist.


findNode

public DataNode findNode(java.lang.String searchName)
Recusrively search this nodes children for node of given name

Parameters:
searchName - Name to search for

printChildren

public void printChildren()
Do debuging print of this nodes children. Not recusive.


isTemporary

public boolean isTemporary()
Return whether this node will should be considered temporary. For example a node user for a sequenced input function is temporary. This implementation only returns if the parent is null


makeFixed

public void makeFixed(boolean bFixed,
                      boolean bRecurse)
Convenience that calls setRenameable(!bFixed); setRemoveable(!bFixed); setPrivate(bFixed);


getUnfoldedChildren

public java.util.Vector getUnfoldedChildren()
Convinence function to unfolds ownership tree into a linear vector that may be easier to traverse.

Returns:
Vector of all children and this.

fileRoot

public FileNode fileRoot()
Returns the FileNode node that this is indirectly parented to.

Specified by:
fileRoot in interface DataNode

createCopy

public 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. It then uses the set() function to set the pieces of the copy to the original. Note this does not make a deep copy. Use deepCopy() for that.


copyFrom

public void copyFrom(ModelNode field)
Copys given node so this one, or the node this is referenced to to this one.


deepCopy

public ModelNode deepCopy()
This is a convienience: return (ModelNode)(new TreeCopier()).deepCopy(this);


set

public void set(DataNode _other)
Default version calls setValue(), and recuses over children. Override to set as needed. Sets this to other.

Specified by:
set in interface DataNode

setChildrenExcept

public void setChildrenExcept(DataNode _other,
                              DataNode[] exept)
Assign all children to children of _other. Other is the source. Assign all children by the source references in the exept array.


setValue

public 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()


getValue

public 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)


makePrototype

public ModelNode makePrototype()
Works in conjuection with setFromPrototype. Override to return a node of same type. Default just calls deepCopy(). An subclass might return version of node that doesnt have copies of some fields, if these fields are not considered appropriate for prototypes. (not general)


setFromPrototype

public void setFromPrototype(ModelNode copy)
Works in conjuection with setFromPrototype. Override to not set all fields. Default calls set().


setTransient

public void setTransient(boolean b)
Set whether or not this object is gradually changing. This effects a few things, such as how the viewport is updated and the avalibility of point snap to the object. Also, parent nodes will not be notified of changes to this if it is transient. Transientness is usually controled by the user interface that controls the node.


getTransient

public boolean getTransient()
Return whether or not this object is gradually changing.

See Also:
setTransient()

setTransientChildren

public void setTransientChildren(boolean b)

setIsSet

public void setIsSet(boolean b)
Sets set flag. True by default.


isSet

public boolean isSet()
Returns whether user interface effecting this node has set its value yet. Nodes are created with the set flag on by default. A user interface may turn it off to let dependancies know ther user has not set its value yet.


isFinal

public boolean isFinal()
Returns !getTransient()


setRenameable

public void setRenameable(boolean b)
Convience function, uses ATTRIB_RENAMEABLE. Default is true


getRenameable

public boolean getRenameable()
Convenience function, uses ATTRIB_RENAMEABLE


setListable

public void setListable(boolean b)
Conveniece function, uses ATTRIB_LISTABLE. Default is true


getListable

public boolean getListable()
Convenience function, uses ATTRIB_LISTABLE


setRemoveable

public void setRemoveable(boolean b)
Convenience function, uses ATTRIB_REMOVEABLE. Default is true


getRemoveable

public boolean getRemoveable()
Convenience function, uses ATTRIB_REMOVEABLE


setPresentable

public void setPresentable(boolean b)
Convenience function, uses ATTRIB_PRESENTABLE. Sets if should be in user input systems. Default is true


getPresentable

public boolean getPresentable()
Convenience function, uses ATTRIB_PRESENTABLE.


setSequenced

public void setSequenced(boolean b)
Sets whether this sould appear in sequential input


getSequenced

public boolean getSequenced()
Returns whether this sould appear in sequential input


setSaveable

public void setSaveable(boolean b)
Sets whether this node should be saved to files


getSaveable

public boolean getSaveable()
Gets whether this node should be saved to files


setDeleted

public void setDeleted(boolean b)
Sets whether this node has been removed from database


getDeleted

public boolean getDeleted()
Sets whether this node has been removed from database


setUserGroup

public void setUserGroup(boolean b)
Convenience function, uses ATTRIB_USERGROUP. Default is true.


getUserGroup

public boolean getUserGroup()
Convenience function, uses ATTRIB_USERGROUP. Default is true.


setPrivate

public void setPrivate(boolean b)
Convenience function, uses ATTRIB_PRIVATE. Default is false.


getPrivate

public boolean getPrivate()
Convenience function, uses ATTRIB_PRIVATE. Default is false.


linksChildren

public boolean linksChildren()
Return whether this nodes children should be skipped in file write. If true, children are skipped, if false, they are included. False is the default


checkNetworkInput

public java.lang.String checkNetworkInput(ModelNode input)
Supports network editor. Return whether the given node can be linked to this in the network editor The default implementation checks that this is assignable from the input


addNetworkInput

public void addNetworkInput(ModelNode input)
Supports network editor. The default behaviour is to call makeReferenced(input)


addNetworkOutput

public void addNetworkOutput(ModelNode output)
Supports network editor. The default behaiviour is to do nothing! This is called right before addNetworkInput(), which is enough for simple linking


removeNetworkInput

public void removeNetworkInput(ModelNode input)
Supports network editor. The default behaviour here is to make this linked to the input.


removeNetworkOutput

public void removeNetworkOutput(ModelNode output)
Supports network editor. The default behaviour here is to make this linked to the output.


setValidates

public void setValidates(boolean b)
A node may be set to never validate - good for prototype nodes


getValidates

public boolean getValidates()
A node may be set to never validate - good for prototype nodes


mayValidate

public boolean mayValidate()
Return whether node may be validated given the current state of this nodes dependants. Of false is returned, the node is removed from the invalid list, and will have to be invalidated again be have another chance at validating.


expectedValidationTime

public int expectedValidationTime()
Return expected computation time in milli seconds for validation. Effects whether to tell user when this node is validated. The default returns 0. This should be overridden by nodes to return a larger time if the current situaion will require a second or more to validate. ShapeNode.expectedValidationTime() returns 10 ms if geometry is invalid, and shape is not marked transient. User can set the time threshold he wants to hear about.


validate

public void validate()
Called by the database durring its scene validation if node is invalid. Default version does nothing


invalidate

public void invalidate()
Marks this node as invalid, and add to the invalid object list. This may be subclassed to cause a redraw.


isValid

public boolean isValid()
Returns if this has been marked invalid


makeReferenced

public void makeReferenced(DataNode _linkInput)
Link this node to the given node so that if the given node is changed this node will follow. If the given node is already a link it self, the lind pointed to this will be used. It is no problem to make this dependant on an node in different file. The given node must be of the same type. In the MVG document this node will use the dependencies serial number.

Specified by:
makeReferenced in interface DataNode

makeUnreferenced

public void makeUnreferenced()
Make this node independant of any it points to, in other words dereference this node.

Specified by:
makeUnreferenced in interface DataNode

setToLink

public void setToLink(ModelNode linkInput)
Called by to make this node follow its linkInput. The default version simply calls set(input). How a node is copied from its dependacy (what is linked and what may be independant) is defined by this function. This makes it possible for example for the geometrical objects of md to link only the geometry and let rendering attributes vary.


isLinked

public boolean isLinked()
Returns whether this node is following another.

See Also:
makeReferenced

linkedTo

public DataNode linkedTo()
Returns the node this is follows, null if is independent.

Specified by:
linkedTo in interface DataNode
See Also:
makeReferenced

hasExternalRef

public boolean hasExternalRef()
Returns whether this node is linked to another node out side the nodes model.

See Also:
makeReferenced

hasValidationLock

public boolean hasValidationLock()
Nodes can do a manual mutex lock for thread saftey. The lock state is set and looked at by the validation manager for purposes of validating the scene in a secondary thread. This is considered better in terms of thread livelyness issues than using the synchronized attribute. Users of this are to check the validate lock before getting any data out.


setValidationLock

public void setValidationLock(boolean b)
Sets if this has the validation lock


tag

public void tag(java.lang.String s)
Tag this node with string tag. The human user may use that tag to select all node with a certain tag. Tags enable a node to be catagorized multiple ways.


untag

public void untag(java.lang.String s)
Untag this node with string tag.

See Also:
tag

getTags

public java.util.Vector getTags()
Return tags.

See Also:
tag

printTags

public void printTags()
For debuging: print the tags of this node

See Also:
tag

makeVisibleInGUI

public void makeVisibleInGUI()
Sends the NodeEvent.SHOW_IN_GUI event


startRename

public void startRename()
Sends the NodeEvent.RENAME_IN_GUI event


setCoordSystem

public 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. This alows setting of the coordinate system for relevant fields.


addNodeListener

public void addNodeListener(java.lang.Object listener,
                            java.lang.String callback,
                            int eventID)
Add a listener to this node that will send node events. This version uses the listener/callback system.

Parameters:
listener - Object or string to fully specified class name that owns call back
callback - Function name to callback

addNodeListener

public void addNodeListener(NodeListener listener)
Add a listener to this node that will send node events.

Specified by:
addNodeListener in interface DataNode
Parameters:
listener - Object to receive events

removeNodeListener

public boolean removeNodeListener(NodeListener sd)
Remove NodeListener. This does a thourogh job to avoid memory leaks.

Specified by:
removeNodeListener in interface DataNode

isNotified

public static boolean isNotified(NodeEvent event)
Returns whether this object has notified listeners since the last AWT event que processing. This is part of a system to prevent infinite recursion from change notifications.


markNotified

public static void markNotified(NodeEvent event)
Mark this object as having sent its change events already.


unmarkNotified

public static void unmarkNotified(NodeEvent event)
Mark this object as not having sent its change events already.


clearNotified

public static void clearNotified()
Clear notifed table.

See Also:
isNotified(), markNotified()

notifyListeners

public void notifyListeners(NodeEvent event)
Send the event to regestered listeners

Specified by:
notifyListeners in interface DataNode

selfNodeChanged

public 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). Override this function to listen. The default is a no-op.


hasDependants

public boolean hasDependants()
Return whether any nodes are listening to this


unlinkListeners

public void unlinkListeners()
Called to clean up node by database when it closes file


getEffectors

public java.util.Vector getEffectors(java.lang.String type)

enableEvents

public void enableEvents()
Decrements event enabled counter. Events are sent if couter is zero. Remember this effects all listeners - it is usually better to remove/add individual listeners.


disableEvents

public void disableEvents()
Decrements event enabled counter. Events are sent if couter is zero. Remember this effects all listeners - it is usually better to remove/add individual listeners.


valChanged

public void valChanged()
This is short cut that calles notifyListeners(VALUE_CHANGED), with this as the event producer, and invalidate().


valChanged

public void valChanged(DataNode producer)
This is short cut that calles notifyListeners(VALUE_CHANGED), with the given event producer, and invalidate().


setEntryListener

public void setEntryListener(EntryListener listener)
The EntryListener given here is passed on to any ValueEntry created by this node.


getEntryListener

public EntryListener getEntryListener()
The EntryListener returned here is passed on to any ValueEntry created by this node.


compare

public boolean compare(java.lang.Object _o)
Compare function to be overridden by sub classes. This is used instead of Object.equals because so many things are using Vector.indexOf() which calls equals(). We prefer this search be done with the default reference comparison always.


allFieldsAreFinal

public boolean allFieldsAreFinal()
Checks that all fields of this node are non transient and set


nodeChanged

public void nodeChanged(NodeEvent event)
ModelNode implements NodeListener to give a default version for nodeChanged. The default version calls valChanged(), propogating event.producer along unchanged

Specified by:
nodeChanged in interface NodeListener

setName

public void setName(java.lang.String s)
Sets name of this node. This name may be changed by DataManager.nameUnique(). The value given for the name here is returned by getPreferredName().

Specified by:
setName in interface DataNode

setActualName

public void setActualName(java.lang.String s)
Sets the name of this node, without changing the preferred name


getTreeName

public java.lang.String getTreeName()
Override to return lable for tree interface

Specified by:
getTreeName in interface DataNode

setValueGroup

public 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().


setCurrentNames

public void setCurrentNames(java.lang.String[] cts)
Set names called for by functions looking for a current value


getCurrentNames

public java.lang.String[] getCurrentNames()
Get names called for by functions looking for a current value


bind

public void bind()
Some nodes can take effect in a globally. Override this Override to do something special like setting the current viewpoint. Called by any user interface with a list of bindable nodes.


updateBindable

public 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. Called by the database before the file is saved.


getBound

public boolean getBound()

setBound

public void setBound(boolean bBound)

castSelection

public ModelNode castSelection(java.lang.String castFunc,
                               harmonic.viewer3D.PaintStruct painter,
                               int iPart,
                               harmonic.meshGeom.math.Pnt3f pickedPoint)
Called by object selector during viewport picking. Override this to return an object other than this node, causing the returned object to be selected rather than this. Since at different times different casting methods may be needed, castFunc is used to indicate type of casting to do. This must be recoginzed specially by overriding funciton. Returning null means there is no cast.

Parameters:
castFunc - Extension defined casting function
painter - PaintStruct picked with mouse
iPart - Part of geometry of painter
pickedPoint - Point in geometries coordinate system where ray intersected
See Also:
NodeSetEntry.setCastFunction

getObjectRep

public ShapeNode getObjectRep()
It is possible for any node to be represented by a geometrical object. This is called when a node is selected to make it renderable in the viewport. Override to return special shape.


canSelect

public boolean canSelect()
Called by object selector to ask if it is OK to selcted this node

Specified by:
canSelect in interface DataNode

setSelect

public void setSelect(boolean b)
This version assumes Selector.getModelSelector()

Specified by:
setSelect in interface DataNode

setSelect

public void setSelect(boolean b,
                      Selector selector)
Sets the selection state of this node. Various elements of a graphical user interface are updated to reflect the change via invalidateUI, and the node is added to the selection list of the active object selector. Notifies listeners with SELECTED or DESELECTED

Parameters:
b - true to select, false to unselect

getSelect

public boolean getSelect()
Returns the selection state of thie node

Specified by:
getSelect in interface DataNode
See Also:
setSelect

setTentativeSelect

public void setTentativeSelect(boolean b)
This version assumes Selector.getModelSelector()


setTentativeSelect

public void setTentativeSelect(boolean b,
                               Selector selector)
Sets the tentative selection state of this node. This works just like setSelect


getTentativeSelect

public boolean getTentativeSelect()
Return the tentative selection state of this node.


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
Implements actionPerformed to call showControlWidget(). Nodes may be attached to gui buttons or menus - this function is called to handle the resulting action events.

Specified by:
actionPerformed in interface java.awt.event.ActionListener

areFieldsValid

public java.lang.String areFieldsValid()
Override to return an error string if there is a problem with any field, else return null.


setErrorState

public void setErrorState(java.lang.String error)
Sets the error state of this node, which may be displayable by some user interface. The database will not try to validate a node that has an error state.


getErrorState

public java.lang.String getErrorState()
Returns the the error state string


showHandles

public void showHandles(java.lang.String type)
This gets handles getHandles() and shows them. The creator of the handles is responsible for assigning the handles coordinates system. It is not changed here.


getHandles

public java.util.Vector getHandles(java.lang.String type)
This recursively goes down tree looking for handles, and returns a list of all handles found. Override to return a list of handles for manipulating this.


removeHandles

public void removeHandles()
Remove any handles created to contol this node


createControlWidget

public java.awt.Component createControlWidget()
Nodes may create gui interface widgets to enable the setting of their value. Override to return the specialized widget for this node. The default returns new NodeValuesDialog(this);


initControlWidget

public void initControlWidget(ValueEntry e)
Update the control widget to follow this nodes current value


showControlWidget

public void showControlWidget()
Shows special controls returned by createControlWidget()
Calls showControlWidget(-1, -1, false)


showControlWidget

public void showControlWidget(boolean bModal)
Shows special controls returned by createControlWidget()
Calls showControlWidget(-1, -1, bModal)


showControlWidget

public void showControlWidget(int x,
                              int y,
                              boolean bModal)
Shows special controls returned by createControlWidget() the the given location


hideControlWidget

public void hideControlWidget()
Remove any dialogs controling this node


getControlWidget

public java.awt.Component getControlWidget()
Returns control widget created by createControlWidget()


setCurrentControlWidget

public void setCurrentControlWidget(java.awt.Component cmp)
Sets the current control widget. This is normally done by showControlWidget().


makeContextMenu

public void makeContextMenu(HWM_GroupData menu)
May be overrideen to add functions pertaining to this node to context menu. The default makes a small general menu.


getInstanceURL

public 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. This goes on untill there is no parent. Then if the creating module is known it returns
MZ.help().helpRoot(MZ.creatingModule(this))+"fields/"+name+".html";

Specified by:
getInstanceURL in interface Documentable

getTypeURL

public java.lang.String getTypeURL()
This implements the Documentable interface by like this:

 Module mod = MZ.definingModule(this);
 if(mod != null)
    return MZ.help().helpRoot(mod)+"fields/"+name+".html";
 else
 	  return null;
 

Specified by:
getTypeURL in interface Documentable

getTypeImage

public java.awt.Image getTypeImage()
Returns the image to be used for this node in list interfaces that may put an image by node

Specified by:
getTypeImage in interface DataNode

getReferencePoolName

public java.lang.String getReferencePoolName()

at

public DataNode at(int i)
Return child at givin index

Specified by:
at in interface DataNode
Parameters:
i - index of child node

childCount

public int childCount()
Return number of chilren owned by this node

Specified by:
childCount in interface DataNode

getFullName

public java.lang.String getFullName()
Returns long name that indicates ownership from the parent, for example objects.circle.radius


getName

public java.lang.String getName()
Return current name of this node

Specified by:
getName in interface DataNode

getCatagory

public java.lang.String getCatagory()
Returns catagory name


setCatagory

public void setCatagory(java.lang.String catagory)
Sets catagory name


getFilterType

public java.lang.String getFilterType()

isInSubtree

public boolean isInSubtree(DataNode root)
Returns true if this some child of given node

Parameters:
root - Root of subtree

isInTree

public boolean isInTree()
Returns true if this is in the database tree. Links need to exists all the way up to the database root for this to be considered in the tree.


getNodeParent

public DataNode getNodeParent()
Return nodes parent

Specified by:
getNodeParent in interface DataNode

getNodeChildren

public DataNode[] getNodeChildren()
Return children of node

Specified by:
getNodeChildren in interface DataNode

getNodeChildren_V

public java.util.Vector getNodeChildren_V()
Return children of node in vector form.


getDirectOutputs

public java.util.Vector getDirectOutputs()
Return list of objects listening to this


getSeparateDirectOutputs

public java.util.Vector getSeparateDirectOutputs()
Return list of objects listening to this that aren't its parent


getDirectInputs

public java.util.Vector getDirectInputs()
Return list of DataNodes this listens too. This list is not kept explicitly, instead it is created when this funciton is called, using this rule: if this is a NodeSetField, NodeSetField.getSelection() is returned. If this node contains NodeSetFields as fixed fields, the union of nodes in these is returned. If this node is a link copy of another node, this node is returned. And all the regular fields are added. This will recurse down the tree any futher than the NodeSetFields that are fixed members - it only returns direct dependancies


getSeparateDirectInputs

public java.util.Vector getSeparateDirectInputs()
Return list of inputs that arnt its children


setAttrib

public void setAttrib(java.lang.Object key,
                      java.lang.Object value)
Add a special attribute to this node for internal use. That the user will not see this value. This makes use of the memory effient harmonic.meshGeom.math.AttributeTable, although access is proportional to entry count. This system has the advantage of allowing data members to be attached to a node without subclassing it, and equally important it saves memory by not requiring real member variables in the class that may have unintersting values most of the time. This alows the memory requirement of a tree node to be smaller.

Specified by:
setAttrib in interface DataNode

getAttrib

public java.lang.Object getAttrib(java.lang.Object key)
Get a special attribute from this node added for internal use.

Specified by:
getAttrib in interface DataNode

clearAttrib

public void clearAttrib(java.lang.Object key)
Remove attribute from table, making things as if it were never set.

Specified by:
clearAttrib in interface DataNode

setMetaFields

public void setMetaFields(MetaFields mf)
Set this nodes meta fields if it has any. A large group of nodes is expected to share the same meta fields object.


getMetaFields

public MetaFields getMetaFields()
Return the meta fields of this node.


getSerialNo

public int getSerialNo()
Returns node's persistant serial number

Specified by:
getSerialNo in interface DataNode

setSerialNo

public void setSerialNo(int sn)
Set node's persistant serial number

Specified by:
setSerialNo in interface DataNode

assignFromMetaFields

public void assignFromMetaFields(MetaFields mf)
Assign this node from given meta fields.


assignToMetaFields

public void assignToMetaFields(MetaFields mf)
Assign this node to given meta fields.


addField

public 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.


addField

public void addField(java.lang.String name,
                     DataNode f)
Short version of addField()

Specified by:
addField in interface DataNode

addField

public void addField(DataNode f)
Short version of addField()


setIsField

public void setIsField(boolean b)
Description copied from interface: DataNode
Implement to set if this node is a field. Fields cannot come and go.

Specified by:
setIsField in interface DataNode

clean

public void clean()
Null any references in child array past good size


indexOf

public int indexOf(DataNode child)

insertNode

public void insertNode(DataNode child,
                       int index)
Insert child at given index


setNodeParent

public void setNodeParent(DataNode parent)
Normllay this should not be used. Implements DataNode

Specified by:
setNodeParent in interface DataNode

addAll

public void addAll(DataNode[] child)
Convinience function thats adds all given nodes. Try to use addNodes().


addNodes

public void addNodes(DataNode[] nodes)
Convinience function thats adds all given nodes


addFields

public void addFields(java.util.Vector nodes)
Convinience function thats adds all given nodes as fields


addNodes

public void addNodes(java.util.Vector nodes)
Convinience function thats adds all given nodes


addNode

public void addNode(DataNode child)
Add child

Specified by:
addNode in interface DataNode

replace

public void replace(DataNode old,
                    DataNode niw)
Find old among children and replace it with niw


addAlphaed

public void addAlphaed(DataNode child)
Add child to this node in alphabetical order!


remove

public void remove()
Remove this node its parent


removeAll

public void removeAll(DataNode[] child)
Remove all given nodes


removeNode

public void removeNode(DataNode child)
Remove child from this node


removeNode

public void removeNode(DataNode child,
                       boolean bUnlink)
Remove child from this node.

Specified by:
removeNode in interface DataNode
Parameters:
child - Node to remove
bUnlink - Indicates a more thorough removeal is done.

removeNode

public void removeNode(int i)
Remove child at index


removeAll

public void removeAll()
Remove all children


addToNetworkEditor

public void addToNetworkEditor()
Add this to network editor user interface


toString

public java.lang.String toString()
Prints name for large nodes (with children), the value for small nodes.

Overrides:
toString in class java.lang.Object

pythonString

public java.lang.String pythonString()
String for represention in python. Thie is deprecated. Use valueString().


valueString

public java.lang.String valueString()
String to represent value

Specified by:
valueString in interface DataNode

checkFileRead

public void checkFileRead()
This is called for all nodes created during a file read, after the entire file read is complete. Override to check that the values in the node are ok, and fix problems that may have happened due to file version changes.


findFieldElement

public static org.w3c.dom.Element findFieldElement(org.w3c.dom.Element group,
                                                   java.lang.String name)
A file concern. Find element for node of given name.


createXMLElement

public org.w3c.dom.Element createXMLElement(org.w3c.dom.Document doc)
Create XML element for this node

Specified by:
createXMLElement in interface DataNode

assignFromXMLAttributes

public void assignFromXMLAttributes(MVGFileOpener opener,
                                    org.xml.sax.Attributes node)
Assign this node from XML element. The default assigns:
  • the node name
  • the bind flat
  • the tags
  • the current tags
  • the potential currents
  • Override to do more. Specialized values should be keeped in the XML text section.

    Specified by:
    assignFromXMLAttributes in interface DataNode

    assignFromXMLString

    public void assignFromXMLString(MVGFileOpener opener,
                                    java.lang.String string)
    Assign from the XML node text section. Default does nothing


    preAssignToXMLElement

    public void preAssignToXMLElement()
    Override to prepare anything before node is assigned to xml file


    postAssignFromXMLElement

    public void postAssignFromXMLElement()
    Override to prepare anything after node is assigned from xml file


    getSavedChildren

    public DataNode[] getSavedChildren()

    assignToXMLAttributes

    public void assignToXMLAttributes(MVGFileSaver saver,
                                      org.xml.sax.helpers.AttributesImpl attrs,
                                      boolean bUpdate)
    Assign to the XML element

    Specified by:
    assignToXMLAttributes in interface DataNode

    assignToXMLString

    public java.lang.String assignToXMLString(MVGFileSaver saver)
    Return string for XML text section. Default returns empty string.


    getXMLNodes

    public XMLTransferNode[] getXMLNodes()
    Implement to create XMLTransferNodes for file saving.

    Specified by:
    getXMLNodes in interface DataNode

    fromXMLNodes

    public void fromXMLNodes(XMLTransferNode[] nodes)
    Implement to create XMLTransferNodes for file reading.

    Specified by:
    fromXMLNodes in interface DataNode

    printTree

    public void printTree()

    printTree

    public void printTree(java.io.PrintStream os,
                          int nn)
    Prints name/value pairs of this sub tree


    getInterpolater

    public Interpolater getInterpolater()
    Override to return an object that implements Interpolater.


    getTransformable

    public Transformable getTransformable()
    Override to return an object that implements Transformable. Default returns null, makeing the basic tree node un transformable


    getTransformableParent

    public Transformable getTransformableParent()
    This goes up the tree untill it finds a node that is transformable, starting at the parent


    interpolate_Linear

    public void interpolate_Linear(ModelNode ret,
                                   ModelNode value0,
                                   ModelNode value1,
                                   float b0,
                                   float b1)
    Implementation of Interpolater. Default interpolater interpolates children

    Specified by:
    interpolate_Linear in interface Interpolater
    Parameters:
    ret - Return value
    value0 - Value 0
    value1 - Value 1
    b0 - Basis function value 0
    b1 - Basis function value 1

    interpolate_Quadratic

    public void interpolate_Quadratic(ModelNode ret,
                                      ModelNode value0,
                                      ModelNode value1,
                                      ModelNode value2,
                                      float b0,
                                      float b1,
                                      float b2)
    Implementation of Interpolater. Default interpolater interpolates children

    Specified by:
    interpolate_Quadratic in interface Interpolater
    Parameters:
    value0 - Value 0
    value1 - Value 1
    value2 - Value 1
    b0 - Basis function value 0
    b1 - Basis function value 1