public class IlvMapLayerTreeNode extends DefaultMutableTreeNode implements IlvPersistentObject
DefaultMutableTreeNode
attached with an IlvMapLayer
.
This class is used to encapsulate an IlvMapLayer
into a DefaultMutableTreeNode
.
This class is persistent in the way that it can be saved in an .ivl
file.
This class is intended to be used as nodes of a IlvMapLayerTreeModel
.allowsChildren, children, EMPTY_ENUMERATION, userObject
Constructor and Description |
---|
IlvMapLayerTreeNode(IlvInputStream stream)
Reads a
IlvMapLayerTreeNode from an IlvInputStream |
IlvMapLayerTreeNode(Object o)
Creates a
IlvMapLayerTreeNode . |
Modifier and Type | Method and Description |
---|---|
TreeNode |
getChildAt(int index)
Returns the (visible in tree) child at the specified index in this node's child array.
|
int |
getChildCount()
Returns the number of visible layers under the tree node.
|
int |
getIndex(TreeNode aChild) |
TreeNode |
getRealChildAt(int index)
Returns the node at the specified index, taking into account even invisible layers.
|
int |
getRealChildCount()
Returns the total number of layers contained (even if invisible).
|
void |
insert(MutableTreeNode newChild,
int childIndex)
Removes
newChild from its present parent (if it has a
parent), sets the parent of the child to this node, and then adds the child
to this node at index childIndex . |
boolean |
isChecked()
Indicates if the node is in a selected state.
|
boolean |
isReallyLeaf()
Indicates whether this node is a leaf, taking into account even invisible layers.
|
void |
remove(int childIndex)
Removes the child at the specified index from this node
and sets that nodeparent to null.
|
void |
setChecked(boolean sel)
Sets the selected state of the node.
|
String |
toString()
If the user object is a
IlvMapLayer , the name of the layer
is returned. |
void |
write(IlvOutputStream stream)
Writes this node into an
IlvOutputStream . |
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildBefore, getDepth, getFirstChild, getFirstLeaf, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject
public IlvMapLayerTreeNode(Object o)
IlvMapLayerTreeNode
.
If o is a IlvMapLayer
, the node
is attached to this layer using the IlvMapLayer.setNode
method.o
- The object to set as the user object to this node.public IlvMapLayerTreeNode(IlvInputStream stream) throws IlvReadFileException
IlvMapLayerTreeNode
from an IlvInputStream
stream
- The stream to read from.IlvReadFileException
public void write(IlvOutputStream stream) throws IOException
IlvOutputStream
.write
in interface IlvPersistentObject
stream
- The stream to write to.IOException
public String toString()
IlvMapLayer
, the name of the layer
is returned. If not the default implementation is called.toString
in class DefaultMutableTreeNode
IlvMapLayer
public void setChecked(boolean sel)
sel
- The selected state of the node.public boolean isChecked()
public int getChildCount()
getChildCount
in interface TreeNode
getChildCount
in class DefaultMutableTreeNode
DefaultMutableTreeNode.getChildCount()
public int getRealChildCount()
public TreeNode getChildAt(int index)
getChildAt
in interface TreeNode
getChildAt
in class DefaultMutableTreeNode
DefaultMutableTreeNode.getChildAt(int)
public TreeNode getRealChildAt(int index)
index
- Theindex of the child.public int getIndex(TreeNode aChild)
getIndex
in interface TreeNode
getIndex
in class DefaultMutableTreeNode
public void remove(int childIndex)
remove
in interface MutableTreeNode
remove
in class DefaultMutableTreeNode
DefaultMutableTreeNode.remove(int)
public void insert(MutableTreeNode newChild, int childIndex)
newChild
from its present parent (if it has a
parent), sets the parent of the child to this node, and then adds the child
to this node at index childIndex
.insert
in interface MutableTreeNode
insert
in class DefaultMutableTreeNode
public boolean isReallyLeaf()
true
if the node is a leaf.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.