ilog.views.maps.beans
Class IlvMapLayerTreeNode

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by ilog.views.maps.beans.IlvMapLayerTreeNode
All Implemented Interfaces:
IlvPersistentObject, Serializable, Cloneable, MutableTreeNode, TreeNode

public class IlvMapLayerTreeNode
extends DefaultMutableTreeNode
implements IlvPersistentObject

A persistent DefaultMutableTreeNode attached with a IlvMapLayer. This class is used to encapsulate a IlvMapLayer into a DefaultMutableTreeNode. This class is persistent in the way that it can be saved in a .ivl file. This class is intended to be used as nodes of a IlvMapLayerTreeModel.

Since:
JViews 7.5
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, userObject
 
Constructor Summary
IlvMapLayerTreeNode(IlvInputStream stream)
          Reads a IlvMapLayerTreeNode from an IlvInputStream
IlvMapLayerTreeNode(Object o)
          Creates a IlvMapLayerTreeNode.
 
Method Summary
 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.
 TreeNode getRealChildAt(int index)
          Returns the node at index specified, taking even invisible layers into account.
 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 child's parent to this node, and then adds the child to this node's child array at index childIndex.
 boolean isChecked()
          Tells if the node is in selected state.
 boolean isReallyLeaf()
          Tells if this node is a leaf, taking even invisible layers into account.
 void remove(int childIndex)
          Removes the child at the specified index from this node's children and sets that node's parent 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.
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildBefore, getDepth, getFirstChild, getFirstLeaf, getIndex, 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
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IlvMapLayerTreeNode

public IlvMapLayerTreeNode(Object o)
Creates a IlvMapLayerTreeNode. If o is a IlvMapLayer, the node is attached to this layer using the IlvMapLayer.setNode method.

Parameters:
o - The object to set as the user object to this node.

IlvMapLayerTreeNode

public IlvMapLayerTreeNode(IlvInputStream stream)
                    throws IlvReadFileException
Reads a IlvMapLayerTreeNode from an IlvInputStream

Parameters:
stream - The stream to read from.
Throws:
IlvReadFileException
Method Detail

write

public void write(IlvOutputStream stream)
           throws IOException
Writes this node into an IlvOutputStream.

Specified by:
write in interface IlvPersistentObject
Parameters:
stream - The stream to write to.
Throws:
IOException

toString

public String toString()
If the user object is a IlvMapLayer, the name of the layer is returned. If not the default implementation is called.

Overrides:
toString in class DefaultMutableTreeNode
Returns:
The name of the layer if the user object of this node is a IlvMapLayer

setChecked

public void setChecked(boolean sel)
Sets the selected state of the node. This method does not set the selected state of the selection model.

Parameters:
sel - The selected state of the node.

isChecked

public boolean isChecked()
Tells if the node is in selected state.

Returns:
The selected state.

getChildCount

public int getChildCount()
Returns the number of visible layers under the tree node.

Specified by:
getChildCount in interface TreeNode
Overrides:
getChildCount in class DefaultMutableTreeNode
See Also:
DefaultMutableTreeNode.getChildCount()

getRealChildCount

public int getRealChildCount()
Returns the total number of layers contained (even if invisible).

Returns:
the total number of layers contained (even if invisible).
Since:
JViews 7.5

getChildAt

public TreeNode getChildAt(int index)
Returns the (visible in tree) child at the specified index in this node's child array.

Specified by:
getChildAt in interface TreeNode
Overrides:
getChildAt in class DefaultMutableTreeNode
See Also:
DefaultMutableTreeNode.getChildAt(int)

getRealChildAt

public TreeNode getRealChildAt(int index)
Returns the node at index specified, taking even invisible layers into account.

Parameters:
index - index of th child.
Returns:
a layer node.
Since:
JViews 7.5

remove

public void remove(int childIndex)
Removes the child at the specified index from this node's children and sets that node's parent to null.

Specified by:
remove in interface MutableTreeNode
Overrides:
remove in class DefaultMutableTreeNode
See Also:
DefaultMutableTreeNode.remove(int)

insert

public void insert(MutableTreeNode newChild,
                   int childIndex)
Removes newChild from its present parent (if it has a parent), sets the child's parent to this node, and then adds the child to this node's child array at index childIndex.

Specified by:
insert in interface MutableTreeNode
Overrides:
insert in class DefaultMutableTreeNode

isReallyLeaf

public boolean isReallyLeaf()
Tells if this node is a leaf, taking even invisible layers into account.

Returns:
true if the node is a leaf, false otherwise.
Since:
JViews 7.5


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.