|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectat.spardat.xma.mdl.tree.TreeNode
Represents a node in a tree widget model.
| Constructor Summary | |
protected |
TreeNode()
Internal use constructor. |
|
TreeNode(java.lang.Object parent,
int index,
java.lang.String key,
java.lang.String text,
int imageId)
Constructs a TreeNode and makes it the child of parent at a specified zero based index in the child sequence. |
|
TreeNode(java.lang.Object parent,
int index,
java.lang.String key,
java.lang.String text,
int imageId,
boolean addDummyNode)
Constructs a TreeNode and makes it the child of parent at a specified zero based index in the child sequence. |
|
TreeNode(java.lang.Object parent,
java.lang.String key,
java.lang.String text,
int imageId)
Constructs a TreeNode and makes it the last child of parent. |
|
TreeNode(java.lang.Object parent,
java.lang.String key,
java.lang.String text,
int imageId,
boolean addDummyNode)
Constructs a TreeNode and makes it the last child of parent. |
| Method Summary | |
boolean |
addDummyNode()
Adds a dummy node as child to this node to make this node expandable. |
protected TreeNode |
cloneSubTree(java.lang.Object parent)
This method makes a copy of the subtree rooted at this and returns it. |
void |
deselect()
Deselects this tree node if it is selected. |
protected void |
externalize(XmaOutput o)
Writes this node to the output stream. |
NodeColor |
getBackgroundColor()
Returns the foreground color set of null, if no color is set. |
TreeNode |
getChild(int i)
Returns the child at the zero based index i which must be greater equal zero and less than getChildCount(). |
int |
getChildCount()
Returns the number of childs this node has. |
TreeNode[] |
getChilds()
Returns an array of TreeNode objects that are the childs of this TreeNode. |
NodeColor |
getForegroundColor()
Returns the foreground color set of null, if no color is set. |
short |
getImageId()
Returns the image id of the image of this node or 0 if none has been set. |
java.lang.String |
getKey()
Returns the key of this node. |
TreeNode |
getParent()
Returns the parent of this tree node or null, if this node is a root node. |
protected java.lang.String |
getParentKey()
Returns the key of the parent node of this if this node is an inner node or null, if this node is a root. |
java.lang.String |
getProperty(java.lang.String key)
Returns an auxiliary property for a given key. |
java.lang.String |
getText()
Returns the text of this node. |
static TreeNode |
getTreeNodeFor(java.lang.Object uiTreeItem)
This is the inverse method to getUITreeItem. |
java.lang.Object |
getUITreeItem()
At the client side, this TreeNode has a representation in a UI library. |
boolean |
hasDummyNode()
Tests if a dummy node exists to this node. |
protected void |
internalize(XmaInput in)
Reads the instance variables text_, key_ and imageId_ from the stream. |
boolean |
isDummyNode()
Tests if a node is a dummy node created by addDummyNode() or by the TreeNode constructor. |
boolean |
isLazy()
Shows if this node supports the lazy loading of child nodes. |
boolean |
isLeaf()
Returns true if this node does not have child nodes. |
static boolean |
isReservedPropertyKey(java.lang.String s)
Returns true if s denotes a reserved property key. |
boolean |
isRoot()
Returns true if this node is a root node, i.e., there is no other node where one of its childs is this node. |
boolean |
isSelected()
Returns true if this tree node is selected, false otherwise. |
void |
remove()
Removes this tree node from the tree. |
boolean |
removeDummyNode()
Removes a dummy node created by addDummyNode() or by the TreeNode constructor. |
void |
select()
Marks this tree node to be selected. |
void |
setBackgroundColor(NodeColor c)
Sets the foreground color of this TreeNode. |
void |
setExpanded(boolean expanded)
Sets the expansion status of this tree node. |
void |
setForegroundColor(NodeColor c)
Sets the foreground color of this TreeNode. |
void |
setImageId(short s)
Sets a new image id. |
void |
setProperty(java.lang.String key,
java.lang.String value)
Sets an auxiliary property. |
void |
setText(java.lang.String string)
Sets a new text. |
protected int |
streamedSize()
Returns the size of the hypothetical byte stream if this node would be externalized. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public TreeNode(java.lang.Object parent,
int index,
java.lang.String key,
java.lang.String text,
int imageId,
boolean addDummyNode)
parent - may be ITreeWM in which case this node becomes a
root node or a TreeNode in which case this becomes
a direct child of parent.index - the zero based index into the sequence of childs this node should
get. 0 inserts in front, getChildCount() inserts at the tail
of the childs.key - the key of the new node. This key must not already be contained
in the tree.text - the text that is displayed in the nodeimageId - an optinal id of an image to be displayed. Specify 0 if
no image should be displayed.addDummyNode - adds a dummy node as child to this node to make this node expandable.
The dummy node is automatically removed at the client side if an expand event occurs on this node.
java.lang.RuntimeException - on invalid arguments.
public TreeNode(java.lang.Object parent,
int index,
java.lang.String key,
java.lang.String text,
int imageId)
parent - may be ITreeWM in which case this node becomes a
root node or a TreeNode in which case this becomes
a direct child of parent.index - the zero based index into the sequence of childs this node should
get. 0 inserts in front, getChildCount() inserts at the tail
of the childs.key - the key of the new node. This key must not already be contained
in the tree.text - the text that is displayed in the nodeimageId - an optinal id of an image to be displayed. Specify 0 if
no image should be displayed.
java.lang.RuntimeException - on invalid arguments.
public TreeNode(java.lang.Object parent,
java.lang.String key,
java.lang.String text,
int imageId,
boolean addDummyNode)
parent - may be TreeWM in which case this node becomes a
root node or a TreeNode in which case this becomes
a direct child of parent.key - the key of the new node. This key must not already be contained
in the tree.text - the text that is displayed in the nodeimageId - an optinal id of an image to be displayed. Specify 0 if
no image should be displayed.addDummyNode - adds a dummy node as child to this node to make this node expandable.
The dummy node is automatically removed at the client side if an expand event occurs on this node.
java.lang.RuntimeException - on invalid arguments.
public TreeNode(java.lang.Object parent,
java.lang.String key,
java.lang.String text,
int imageId)
parent - may be TreeWM in which case this node becomes a
root node or a TreeNode in which case this becomes
a direct child of parent.key - the key of the new node. This key must not already be contained
in the tree.text - the text that is displayed in the nodeimageId - an optinal id of an image to be displayed. Specify 0 if
no image should be displayed.
java.lang.RuntimeException - on invalid arguments.protected TreeNode()
| Method Detail |
public boolean hasDummyNode()
public boolean addDummyNode()
public boolean removeDummyNode()
public boolean isDummyNode()
public TreeNode[] getChilds()
public TreeNode getChild(int i)
i - zero based index of the child
java.lang.RuntimeException - if index is invalidpublic TreeNode getParent()
public int getChildCount()
public short getImageId()
public java.lang.String getKey()
public java.lang.String getText()
public void setImageId(short s)
public void setText(java.lang.String string)
java.lang.IllegalArgumentException - if text is null.public void remove()
public void select()
public void deselect()
public boolean isSelected()
public void setExpanded(boolean expanded)
This method must not be called at the server side, but only on the client side in the state where the UI is created. If the UI is not created yet or this method is called in server side code, this method does nothing.
expanded - true, if this tree node should be shown in an expanded
state.public java.lang.Object getUITreeItem()
You must not change the text or the image of the returned SWT TreeItem. If you want to change these attributes, use either setText or setImageId in this class.
public static TreeNode getTreeNodeFor(java.lang.Object uiTreeItem)
uiTreeItem - SWT-TreeItem if SWT the UI-library you are using. Must not be null.
The SWT-TreeItem must not be disposed.
public boolean isRoot()
public boolean isLeaf()
public void setForegroundColor(NodeColor c)
c - object denoting the foreground color or null if the
color should be cleared.public void setBackgroundColor(NodeColor c)
c - object denoting the foreground color or null if the
color should be cleared.public NodeColor getForegroundColor()
public NodeColor getBackgroundColor()
public void setProperty(java.lang.String key,
java.lang.String value)
key - the key of the property. Must not be a key of length 1 because
those are reserved. Must not be null.value - the value. If null, the property is cleared.public java.lang.String getProperty(java.lang.String key)
key - the key of the property. Must not be a key of length 1 because
those are reserved. Must not be null.
protected int streamedSize()
protected java.lang.String getParentKey()
protected TreeNode cloneSubTree(java.lang.Object parent)
parent - the new parent of the returned TreeNode.
protected void externalize(XmaOutput o)
throws java.io.IOException
java.io.IOException
protected void internalize(XmaInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundExceptionpublic static boolean isReservedPropertyKey(java.lang.String s)
public boolean isLazy()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||