repast.simphony.gis.legend
Class LegendEntry

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by repast.simphony.gis.legend.LegendEntry
All Implemented Interfaces:
Serializable, Cloneable, MutableTreeNode, TreeNode
Direct Known Subclasses:
LegendLayerEntry, LegendRuleEntry

public class LegendEntry
extends DefaultMutableTreeNode
implements Serializable

This represents a generic entry in the legend. This will be selectable and have children.

Version:
$Revision: 1.6 $
Author:
$Author: howe $
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
LegendEntry()
          Default Constructor, this will be an empty entry in the legend.
LegendEntry(Object userObject)
          Create the legend entry based on the supplied user object.
 
Method Summary
 Color getBackground(boolean selected)
          Get the background color for this node based on whether the node is selected or not.
 Icon getIcon(boolean selected)
          Get the icon for this entry.
 String getName()
          Get the name of this Legend Entry
 boolean isDataVisible()
          Is this entry currently selected?
 void setDataVisible(boolean dataVisible)
          Set the selected status of this entry.
 void setDataVisible(boolean dataVisible, boolean propogateChanges)
          Set the selected status of this entry and whether or not the selected status should be propogated to children.
 void setName(String name)
          Set the name of this Legend Entry.
 String toString()
           
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LegendEntry

public LegendEntry()
Default Constructor, this will be an empty entry in the legend.


LegendEntry

public LegendEntry(Object userObject)
Create the legend entry based on the supplied user object. The name of the entry will be the value of the user object.

Parameters:
userObject - The object on which to base this legend entry.
Method Detail

setName

public void setName(String name)
Set the name of this Legend Entry.

Parameters:
name - The name for this legend entry.

getName

public String getName()
Get the name of this Legend Entry

Returns:
The name of this legend entry.

getIcon

public Icon getIcon(boolean selected)
Get the icon for this entry. The generic legend entry has no icon associated with it.

Parameters:
selected - Is this entry selected?
Returns:
The icon, null in the general case.

getBackground

public Color getBackground(boolean selected)
Get the background color for this node based on whether the node is selected or not.

Parameters:
selected - Is this entry currently selected?
Returns:
The background color for this entry.

isDataVisible

public boolean isDataVisible()
Is this entry currently selected?

Returns:
Whether the entry is selected or not.

setDataVisible

public void setDataVisible(boolean dataVisible)
Set the selected status of this entry.

Parameters:
dataVisible -

setDataVisible

public void setDataVisible(boolean dataVisible,
                           boolean propogateChanges)
Set the selected status of this entry and whether or not the selected status should be propogated to children.

Parameters:
dataVisible -
propogateChanges - whether not the changes should be propogated to children

toString

public String toString()
Overrides:
toString in class DefaultMutableTreeNode