Package com.macrofocus.treemap
Class AbstractTreeMapNode<N extends AbstractTreeMapNode<N,Row,Column,Color,Font>,Row,Column,Color,Font>
- java.lang.Object
-
- com.macrofocus.treemap.AbstractTreeMapNode<N,Row,Column,Color,Font>
-
- Type Parameters:
N
- the type of nodes
- All Implemented Interfaces:
MutableTreeMapNode<N,Column,Color,Font>
,TreeMapNode<N,Column,Color,Font>
- Direct Known Subclasses:
LeafTreeMapNode
,ParentTreeMapNode
public abstract class AbstractTreeMapNode<N extends AbstractTreeMapNode<N,Row,Column,Color,Font>,Row,Column,Color,Font> extends java.lang.Object implements MutableTreeMapNode<N,Column,Color,Font>
This class provides a skeletal implementation of the TreeMapNode interface to minimize the effort required to implement this interface.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractTreeMapNode(TreeMapModel<N,Row,Column,Color,Font> model)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
add(N newChild)
abstract N
findChild(java.lang.Object name)
java.awt.geom.Rectangle2D
getBounds()
Gets the bounding rectangle of the item in the map.abstract int
getChildCount()
abstract java.lang.Iterable<N>
getChildren()
abstract java.lang.Iterable<N>
getChildrenOfTypeParent()
com.macrofocus.igraphics.CPColor<Color>
getColor()
com.macrofocus.igraphics.CPColor<Color>
getCushionColor()
com.macrofocus.igraphics.CPImage
getCushionImage()
java.lang.String
getLabelName()
The label of this node.int
getLevel()
Returns the number of levels above this node -- the distance from the root to this node.java.awt.Shape
getNestedShape()
Gets the shape after nesting of the item in the map.abstract java.lang.Object
getNodeName()
The name of this node.N
getParent()
AbstractTreeMapNode[]
getPath()
abstract Row
getRow()
Gets the row in the underlying TableModel, -1 if it doesn't relate to a leaf node.protected N
getSelf()
java.awt.Shape
getShape()
Gets the shape of the item in the map.double
getSize()
Corresponds to area in map.boolean
isRoot()
protected java.lang.Number
normalizedToWorld(java.lang.Number value, TreeMapField columnIndex)
void
setColor(com.macrofocus.igraphics.CPColor<Color> c)
Sets the color of the item in the map.void
setNestedShape(java.awt.Shape shape)
Sets the shape after nesting of the item in the map.void
setParent(N parent)
void
setShape(java.awt.Shape shape)
Sets the shape of the item in the map.void
setSize(double size)
Sets the size of the item.java.lang.String
toString()
protected java.lang.Number
worldToNormalized(java.lang.Number value, TreeMapField columnIndex)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.macrofocus.treemap.TreeMapNode
getChildrenGroupByField, getGroupByField, hasNoChildren, isLeaf
-
-
-
-
Method Detail
-
getChildCount
public abstract int getChildCount()
-
getLevel
public int getLevel()
Returns the number of levels above this node -- the distance from the root to this node. If this node is the root, returns 0.
-
getParent
public N getParent()
-
isRoot
public boolean isRoot()
-
getChildren
public abstract java.lang.Iterable<N> getChildren()
-
getChildrenOfTypeParent
public abstract java.lang.Iterable<N> getChildrenOfTypeParent()
-
getPath
public AbstractTreeMapNode[] getPath()
-
add
public abstract void add(N newChild)
-
setParent
public void setParent(N parent)
-
findChild
public abstract N findChild(java.lang.Object name)
-
getNodeName
public abstract java.lang.Object getNodeName()
The name of this node.- Returns:
- the name of this node.
-
getRow
public abstract Row getRow()
Gets the row in the underlying TableModel, -1 if it doesn't relate to a leaf node.- Returns:
- the row in the TableModel.
-
getLabelName
public java.lang.String getLabelName()
The label of this node.- Returns:
- the label of this node.
-
getColor
public com.macrofocus.igraphics.CPColor<Color> getColor()
-
worldToNormalized
protected java.lang.Number worldToNormalized(java.lang.Number value, TreeMapField columnIndex)
-
normalizedToWorld
protected java.lang.Number normalizedToWorld(java.lang.Number value, TreeMapField columnIndex)
-
getSize
public double getSize()
Description copied from interface:TreeMapNode
Corresponds to area in map.
-
setSize
public void setSize(double size)
Description copied from interface:MutableTreeMapNode
Sets the size of the item.
-
getShape
public java.awt.Shape getShape()
Description copied from interface:TreeMapNode
Gets the shape of the item in the map.
-
getNestedShape
public java.awt.Shape getNestedShape()
Description copied from interface:TreeMapNode
Gets the shape after nesting of the item in the map.- Specified by:
getNestedShape
in interfaceTreeMapNode<N extends AbstractTreeMapNode<N,Row,Column,Color,Font>,Row,Column,Color>
- Returns:
- the shape of the item in the map.
-
setColor
public void setColor(com.macrofocus.igraphics.CPColor<Color> c)
Description copied from interface:MutableTreeMapNode
Sets the color of the item in the map.
-
setShape
public void setShape(java.awt.Shape shape)
Description copied from interface:MutableTreeMapNode
Sets the shape of the item in the map.
-
setNestedShape
public void setNestedShape(java.awt.Shape shape)
Description copied from interface:MutableTreeMapNode
Sets the shape after nesting of the item in the map.- Specified by:
setNestedShape
in interfaceMutableTreeMapNode<N extends AbstractTreeMapNode<N,Row,Column,Color,Font>,Row,Column,Color>
- Parameters:
shape
- the shape of the item in the map.
-
getBounds
public java.awt.geom.Rectangle2D getBounds()
Description copied from interface:TreeMapNode
Gets the bounding rectangle of the item in the map.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getCushionImage
public com.macrofocus.igraphics.CPImage getCushionImage()
-
getCushionColor
public com.macrofocus.igraphics.CPColor<Color> getCushionColor()
-
getSelf
protected N getSelf()
-
-