|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.metamatrix.common.tree.basic.BasicTreeNode
public class BasicTreeNode
Field Summary | |
---|---|
static java.lang.String |
DELIMITER
|
static char |
DELIMITER_CHAR
|
Constructor Summary | |
---|---|
BasicTreeNode(BasicTreeNode parent,
java.lang.String name,
ObjectDefinition defn,
ObjectID guid)
Construct a new instance by specifying the parent that owns this entity, the name of the instance, the type of the instance and the global UID for the instance. |
Method Summary | |
---|---|
void |
add(BasicTreeNode child)
Insert the node as a child of this node, and place it at the end of this node's list of children. |
void |
add(BasicTreeNode child,
int index)
Insert the node as a child of this node, and place it at the end of this node's list of children. |
protected void |
addChild(BasicTreeNode child,
ObjectDefinition childType,
int index)
|
protected boolean |
addChildIsValid(BasicTreeNode child)
This method is called prior to adding the specified child to this TreeNode allowing any subclass to provide specific behavior if necessary. |
protected java.lang.StringBuffer |
addFullName(java.lang.StringBuffer sb,
java.lang.String delimiter)
Helper method to build a string of the full name without having to construct a new StringBuffer in each node. |
protected void |
addMarkedNodesToSet(java.util.Set result)
Return the set of marked nodes for this view. |
protected boolean |
areDuplicateChildNamesAllowed()
This method is used to determine whether two child nodes under a single parent are allowed to have the same name. |
protected BasicTreeNode |
assertBasicTreeNode(TreeNode obj)
|
int |
compareTo(java.lang.Object obj)
Compares this object to another. |
boolean |
containsChildWithName(java.lang.String name)
|
protected java.lang.Object |
convertTypeToString(java.lang.Object value,
PropertyDefinition def)
hook to allow some PropertyDefinition values to be converted non-string values into Strings before they are set on the PropertiedObject. |
protected void |
ensureNameIsValid()
Set the name of the new node (before its been added as a sibling to the nodes in siblings |
boolean |
equals(java.lang.Object obj)
Returns true if the specified object is semantically equal to this instance. |
boolean |
exists()
Return whether this TreeNode represents an existing metadata entity. |
protected TreeNode |
find(ObjectID globalUID)
|
void |
findLeafNodes(java.util.Set leafNodes)
Go through the tree and find out the leaf nodes beneath this object. |
boolean |
findMarkedAndUnmarkedNodes(java.util.Set unmarkedNodes,
java.util.Set markedLeafNodes)
Go through the tree and find out the top-level objects that are not marked and that do not have marked nodes beneath them, and find the leaf-level marked objects. |
void |
findTopLevelMarkedNodes(java.util.Set markedTopLevelNodes)
Go through the tree and find out the top-level objects that are not marked and that do not have marked nodes beneath them, and find the leaf-level marked objects. |
TreeNode |
getChild(java.lang.String name,
ObjectDefinition defn,
boolean ignoreCase)
Return the immediate child of this object that has the specified name. |
int |
getChildCount()
|
java.util.List |
getChildren()
Return the ordered list of children. |
java.util.List |
getChildren(java.lang.String name,
boolean ignoreCase)
Return the immediate child of this object that has the specified name. |
java.util.Collection |
getDecendant(java.lang.String pathWithName,
boolean ignoreCase)
|
java.util.Collection |
getDecendant(java.lang.String pathWithName,
java.lang.String delimiter,
boolean ignoreCase)
|
protected java.lang.String |
getDefaultName()
This method is used to determine the default name for a node when that node has no name. |
protected PropertyDefinition |
getDescriptionPropertyDefinition()
This method is used to determine which, if any, of the property definitions for this object are used to access the description. |
protected java.lang.String |
getEntityForm()
|
java.lang.String |
getFullName()
Get the actual or programmatic name of this property. |
java.lang.String |
getFullName(java.lang.String delimiter)
Get the actual or programmatic name of this property. |
ObjectID |
getGlobalUID()
|
int |
getIndexOfChild(TreeNode child)
|
java.lang.String |
getName()
Get this name of this entity. |
protected PropertyDefinition |
getNamePropertyDefinition()
This method is used to determine which, if any, of the property definitions for this object are used to access the name. |
java.lang.String |
getNamespace()
Get the actual or programmatic name of this property. |
BasicTreeNode |
getParent()
Get the model entity which which is the parent of this entity. |
java.util.Map |
getProperties()
|
protected java.util.List |
getPropertyDefinitions()
This method is used to determine the property definitions for this object. |
java.lang.Object |
getPropertyValue(PropertyDefinition propertyDefn)
|
java.lang.String |
getSeparator()
Obtain the character (as a String) that is used to separate names in a path sequence for the abstract path. |
char |
getSeparatorChar()
Obtain the character that is used to separate names in a path sequence for the abstract path. |
ObjectDefinition |
getType()
Get this type for this entity. |
boolean |
hasChildren()
Return true if this node currently does have any children. |
void |
insert(BasicTreeNode child,
int index)
Insert the node as a child of this node. |
boolean |
isAncestorOf(TreeNode node)
Determine whether this handle is an ancestor of the specified handle, The result of this method is equivalent to calling the following, although this method uses a much more efficient algorithm that does not rely upon string comparisons: |
boolean |
isMarked()
Return the marked state of the specified node. |
boolean |
isModified()
Return whether this node has undergone changes. |
boolean |
isParentOf(TreeNode node)
Determine whether this handle is the parent of the specified handle. |
protected boolean |
isValidNewName(java.lang.String newName)
|
java.util.Iterator |
iterator()
|
void |
moveChild(BasicTreeNode child,
int newIndex)
Move the child to a new index under the same parent. |
void |
print(java.io.PrintStream stream)
|
protected void |
printInfo(java.io.PrintStream stream)
|
void |
remove(BasicTreeNode child)
Remove from this node the specified child, null the parent reference of the node, and mark the node as non-existant. |
void |
remove(int index)
Remove from this node the child specified by the index, null the parent reference of the node, and mark the node as non-existant. |
void |
removeAll()
Remove from this node the child specified by the index, null the parent reference of the node, and mark the node as non-existant. |
java.lang.Object |
removePropertyValue(PropertyDefinition propertyDefn)
|
protected java.lang.Object |
resolveTypeFromString(java.lang.Object value,
PropertyDefinition def)
hook to allow some PropertyDefinition values to be converted from String values before they are sent to clients of this Editor. |
void |
setExists(boolean value)
Ensure that the existance flag on this instance is set to the specified value. |
protected void |
setGlobalUID(ObjectID newID)
Use this with extreme care!!!! |
void |
setMarked(boolean marked)
Set the marked state of the TreeNode node. Default behavior is to mark the whole subtree from this node. |
void |
setMarked(boolean marked,
boolean recursive)
Set the marked state of the TreeNode node. |
void |
setModified(boolean modified)
Set the modified state of the TreeNode node. Default behavior is to set as modified the whole subtree starting with this node. |
void |
setModified(boolean modified,
boolean recursive)
Set the modified state of the TreeNode node. |
void |
setName(java.lang.String newName)
Set the name of this node. |
protected void |
setNameOfNode(java.lang.String newName)
|
java.lang.Object |
setPropertyValue(PropertyDefinition propertyDefn,
java.lang.Object value)
|
java.lang.String |
toString()
Returns a string representing the current state of the object. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final char DELIMITER_CHAR
public static final java.lang.String DELIMITER
Constructor Detail |
---|
public BasicTreeNode(BasicTreeNode parent, java.lang.String name, ObjectDefinition defn, ObjectID guid)
parent
- the parent that is considered the owning namespace for this
instance; may be null if the new instance is to be the rootname
- the name for the new entity instance; may be null or zero length
if the node name is to be determinedtype
- the reference to the MetaModelEntity that defines the type
of entity; may not be nullguid
- the globally-unique identifier for this instance; may not be nullMethod Detail |
---|
public java.lang.String getName()
getName
in interface TreeNode
public java.lang.String getFullName()
getFullName
in interface TreeNode
public java.lang.String getFullName(java.lang.String delimiter)
delimiter
- the string delimiter to use between the names of nodes
protected java.lang.StringBuffer addFullName(java.lang.StringBuffer sb, java.lang.String delimiter)
This method is implemented by having the node invoke this method on its parent (so that the parent can add its full name first), and then this node adds the delimiter and its name.
sb
- the StringBuffer to which the name of this node should be appended
public java.lang.String getNamespace()
getNamespace
in interface TreeNode
public ObjectDefinition getType()
getType
in interface TreeNode
public boolean exists()
This attribute is set to true any time the object is part of a model, and it is set to false whenever the object is removed (deleted) from a model.
exists
in interface TreeNode
public void setExists(boolean value)
public char getSeparatorChar()
getSeparatorChar
in interface TreeNode
public java.lang.String getSeparator()
getSeparator
in interface TreeNode
public boolean equals(java.lang.Object obj)
compareTo()
.
equals
in interface TreeNode
equals
in class java.lang.Object
obj
- the object that this instance is to be compared to.
public int compareTo(java.lang.Object obj)
equals()
, meaning
that (compare(x, y)==0) == (x.equals(y))
.
compareTo
in interface TreeNode
compareTo
in interface java.lang.Comparable
obj
- the object that this instance is to be compared to; may not be null.
java.lang.ClassCastException
- if the specified object's type prevents it
from being compared to this instance.public java.lang.String toString()
toString
in interface TreeNode
toString
in class java.lang.Object
public ObjectID getGlobalUID()
protected void setGlobalUID(ObjectID newID)
public java.util.Iterator iterator()
public java.util.List getChildren(java.lang.String name, boolean ignoreCase)
name
- the name of the child to find; may not be null or zero-lengthignoreCase
- flag specifying true if the names should be compared in
a case-insensitive manner, or false if the names should compare in a
case-sensitive manner.
public TreeNode getChild(java.lang.String name, ObjectDefinition defn, boolean ignoreCase)
name
- the name of the child to find; may not be null or zero-lengthignoreCase
- flag specifying true if the names should be compared in
a case-insensitive manner, or false if the names should compare in a
case-sensitive manner.
public int getIndexOfChild(TreeNode child)
public java.util.List getChildren()
public boolean hasChildren()
public int getChildCount()
public boolean containsChildWithName(java.lang.String name)
public void setName(java.lang.String newName)
protected void setNameOfNode(java.lang.String newName)
protected BasicTreeNode assertBasicTreeNode(TreeNode obj)
public BasicTreeNode getParent()
public boolean isParentOf(TreeNode node)
return this.getFullName().equals( node.getNamespace() )
public boolean isAncestorOf(TreeNode node)
return node.getNamespace().startsWith( this.getFullName() )
public boolean isModified()
isModified
in interface TreeNode
public void setModified(boolean modified)
marked
- the marked state of the node.public void setModified(boolean modified, boolean recursive)
modified
- the marked state of the node.recursive
- true if the whole subtree starting from this node should
be set as modified, or false if only this node is to be set as modified.public boolean isMarked()
public void setMarked(boolean marked)
marked
- the marked state of the node.public void setMarked(boolean marked, boolean recursive)
marked
- the marked state of the node.recursive
- mark the whole subtree starting from this node.protected void addMarkedNodesToSet(java.util.Set result)
the
- unmodifiable set of marked nodes; never nullpublic void findLeafNodes(java.util.Set leafNodes)
public boolean findMarkedAndUnmarkedNodes(java.util.Set unmarkedNodes, java.util.Set markedLeafNodes)
public void findTopLevelMarkedNodes(java.util.Set markedTopLevelNodes)
public java.util.Collection getDecendant(java.lang.String pathWithName, java.lang.String delimiter, boolean ignoreCase)
public java.util.Collection getDecendant(java.lang.String pathWithName, boolean ignoreCase)
public void remove(BasicTreeNode child)
child
- the child entitypublic void removeAll()
index
- the index of the child to be removed
java.lang.IndexOutOfBoundsException
- if the index is not within the range
0 <= newIndex < this.getChildCount()
public void remove(int index)
index
- the index of the child to be removed
java.lang.IndexOutOfBoundsException
- if the index is not within the range
0 <= newIndex < this.getChildCount()
public void moveChild(BasicTreeNode child, int newIndex)
child
- the child entitynewIndex
- the location
java.lang.IndexOutOfBoundsException
- if the index is not within the range
0 <= newIndex < this.getChildCount()
public void insert(BasicTreeNode child, int index)
child
- the child entitynewIndex
- the location
java.lang.IndexOutOfBoundsException
- if the index is not within the range
0 <= newIndex <= this.getChildCount()
public void add(BasicTreeNode child)
Note: this method does NOT verify that the child's name is valid within this namespace
child
- the child entitypublic void add(BasicTreeNode child, int index)
Note: this method does NOT verify that the child's name is valid within this namespace
child
- the child entityprotected void addChild(BasicTreeNode child, ObjectDefinition childType, int index)
public java.lang.Object getPropertyValue(PropertyDefinition propertyDefn)
public java.lang.Object setPropertyValue(PropertyDefinition propertyDefn, java.lang.Object value)
protected java.lang.Object resolveTypeFromString(java.lang.Object value, PropertyDefinition def)
protected java.lang.Object convertTypeToString(java.lang.Object value, PropertyDefinition def)
public java.lang.Object removePropertyValue(PropertyDefinition propertyDefn)
public java.util.Map getProperties()
public void print(java.io.PrintStream stream)
protected java.lang.String getEntityForm()
protected void printInfo(java.io.PrintStream stream)
protected TreeNode find(ObjectID globalUID)
protected java.util.List getPropertyDefinitions()
protected PropertyDefinition getNamePropertyDefinition()
protected PropertyDefinition getDescriptionPropertyDefinition()
protected boolean areDuplicateChildNamesAllowed()
true
.
protected java.lang.String getDefaultName()
protected boolean isValidNewName(java.lang.String newName)
protected boolean addChildIsValid(BasicTreeNode child)
protected void ensureNameIsValid()
siblings
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |