JIDE 3.5.15

com.jidesoft.treemap
Class DefaultTreeMapModel<N extends AbstractTreeMapNode>

java.lang.Object
  extended by com.jidesoft.treemap.AbstractTreeMapModel<AbstractTreeMapNode>
      extended by com.jidesoft.treemap.DefaultTreeMapModel<N>
Type Parameters:
N - the type of nodes
All Implemented Interfaces:
TreeMapModel<AbstractTreeMapNode>

public class DefaultTreeMapModel<N extends AbstractTreeMapNode>
extends AbstractTreeMapModel<AbstractTreeMapNode>

Default implementation of a TreeMapModel. This class provides an easy way to integration with Swing's TableModel.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.jidesoft.treemap.AbstractTreeMapModel
AbstractTreeMapModel.Worker
 
Field Summary
protected  TableModel _tableModel
           
 
Fields inherited from class com.jidesoft.treemap.AbstractTreeMapModel
_settings, PROPERTY_HIGHLIGHTING, PROPERTY_PROBING, PROPERTY_SELECTION
 
Fields inherited from interface com.jidesoft.treemap.TreeMapModel
PROPERTY_PROGRESS
 
Constructor Summary
DefaultTreeMapModel(TableModel tableModel)
           
 
Method Summary
protected  void addChild(AbstractTreeMapNode parent, AbstractTreeMapNode child)
          
protected  void addChild(AbstractTreeMapNode parent, List<Object> path, List<TreeMapField> groupBy, List<TreeMapField> childrenGroupBy, int row)
          Add a child according to its path in the hierarchy.
 MutableColorMap createDefaultColorMap(TreeMapField field)
           
protected  AbstractTreeMapNode createLeafNode(int row)
          
protected  AbstractTreeMapNode createParentNode(Object name, TreeMapField<AbstractTreeMapNode> groupByField, TreeMapField<AbstractTreeMapNode> childrenGroupByField)
          
protected  AbstractTreeMapNode createRootNode(TreeMapField<AbstractTreeMapNode> childrenGroupByField)
          
protected  TreeMapField createTreeMapField(int columnIndex)
           
protected  boolean doGroupBy(AbstractTreeMapNode parent, TreeMapWorker worker)
           
protected  AbstractTreeMapNode getChild(AbstractTreeMapNode parent, Object name)
          
 int getChildCount(AbstractTreeMapNode node)
          Returns the number of children of a given node.
 Iterable<AbstractTreeMapNode> getChildren(AbstractTreeMapNode parent)
          Returns an iterator of the children of the given node.
 Color getColor(AbstractTreeMapNode node)
          Gets the color of the given node.
 Class<?> getColumnClass(int columnIndex)
          Returns the most specific superclass for all the cell values in the column.
 int getColumnCount()
          Returns the number of columns in the model.
 String getColumnName(int columnIndex)
          Returns the name of the column at columnIndex.
 Color getCushionColor(AbstractTreeMapNode node)
          Returns the color of the cushion.
 BufferedImage getCushionImage(AbstractTreeMapNode node)
          Returns the image used for painting the cushion.
 String getLabelName(AbstractTreeMapNode node)
          Gets the label of the given node.
 Double getNumericMax(TreeMapField columnIndex)
          Gets the maximum value contained in the specified column.
 Double getNumericMin(TreeMapField columnIndex)
          Gets the minimum value contained in the specified column.
 AbstractTreeMapNode getParent(AbstractTreeMapNode node)
          Gets the parent node of the given node.
 TableModel getTableModel()
           
 TreeMapField getTreeMapField(int columnIndex)
          Gets the field corresponding to the specified column index.
 TreeMapField getTreeMapField(String columnName)
          Gets the field corresponding to the specified column name.
 Object getValueAt(AbstractTreeMapNode node, int columnIndex)
          Returns the value for the cell at columnIndex and of node.
 boolean isEveryValueUnique(TreeMapField<AbstractTreeMapNode> field)
          Indicates whether all the values in the given field are unique.
 boolean isRoot(AbstractTreeMapNode node)
          Tells whether the given node is the root node or not.
 void setNumericMax(TreeMapField columnIndex, double max)
          Sets the maximum value contained in the specified column.
 void setNumericMin(TreeMapField columnIndex, double min)
          Sets the minimum value contained in the specified column.
 void setTableModel(TableModel tableModel)
          Change the underlying TableModel.
 
Methods inherited from class com.jidesoft.treemap.AbstractTreeMapModel
addListener, addPropertyChangeListener, addPropertyChangeListener, breadthFirstIterator, computeSize, createSettings, depthFirstIterator, doColors, doLayout, doLayoutChildren, firePropertyChange, firePropertyChange, firePropertyChange, getBackgroundModel, getBounds, getChildrenGroupByField, getColorModel, getCurrentRoot, getFilter, getGroupByField, getGroupByModel, getHeightModel, getHighlighting, getLabelModel, getLevel, getNode, getNormalizedLightSourceX, getNormalizedLightSourceY, getNormalizedLightSourceZ, getProbing, getPropertyChangeListeners, getPropertyChangeListeners, getRoot, getSearch, getSelection, getSettings, getShape, getSize, getSizeModel, getStringValue, getSumSize, getTreeMapFields, getTreeMapFields, getViewport, getWorker, getWorkerFuture, initDefaults, isLeaf, preorderEnumeration, removeListener, removePropertyChangeListener, removePropertyChangeListener, scheduleUpdateColors, scheduleUpdateGroupBy, scheduleUpdateLayout, setColor, setCurrentRoot, setHighlighting, setProbing, setSelection, setShape
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.jidesoft.treemap.TreeMapModel
setColor
 

Field Detail

_tableModel

protected TableModel _tableModel
Constructor Detail

DefaultTreeMapModel

public DefaultTreeMapModel(TableModel tableModel)
Method Detail

setTableModel

public void setTableModel(TableModel tableModel)
Change the underlying TableModel. It is currently assumed that the structure of the TableModel doesn't change, i.e. that the number, name, and type of columns stay the same.

Parameters:
tableModel - the new TableModel

getLabelName

public String getLabelName(AbstractTreeMapNode node)
Gets the label of the given node.

Parameters:
node - the node.
Returns:
its label.

getColor

public Color getColor(AbstractTreeMapNode node)
Gets the color of the given node.

Parameters:
node - the node.
Returns:
its color.

getParent

public AbstractTreeMapNode getParent(AbstractTreeMapNode node)
Gets the parent node of the given node.

Parameters:
node - the node
Returns:
its parent

isRoot

public boolean isRoot(AbstractTreeMapNode node)
Tells whether the given node is the root node or not.

Parameters:
node - the node
Returns:
true if it is the root node, false otherwise.

getChildCount

public int getChildCount(AbstractTreeMapNode node)
Returns the number of children of a given node.

Parameters:
node - the parent node.
Returns:
the number of children

getChildren

public Iterable<AbstractTreeMapNode> getChildren(AbstractTreeMapNode parent)
Returns an iterator of the children of the given node.

Parameters:
parent - the parent node
Returns:
the children

getCushionImage

public BufferedImage getCushionImage(AbstractTreeMapNode node)
Returns the image used for painting the cushion.

Parameters:
node - the node
Returns:
the cushion image

getCushionColor

public Color getCushionColor(AbstractTreeMapNode node)
Returns the color of the cushion.

Parameters:
node - the node
Returns:
the cushion color

createRootNode

protected AbstractTreeMapNode createRootNode(TreeMapField<AbstractTreeMapNode> childrenGroupByField)

Specified by:
createRootNode in class AbstractTreeMapModel<AbstractTreeMapNode>

createLeafNode

protected AbstractTreeMapNode createLeafNode(int row)


createParentNode

protected AbstractTreeMapNode createParentNode(Object name,
                                               TreeMapField<AbstractTreeMapNode> groupByField,
                                               TreeMapField<AbstractTreeMapNode> childrenGroupByField)


getChild

protected AbstractTreeMapNode getChild(AbstractTreeMapNode parent,
                                       Object name)


addChild

protected void addChild(AbstractTreeMapNode parent,
                        AbstractTreeMapNode child)


doGroupBy

protected boolean doGroupBy(AbstractTreeMapNode parent,
                            TreeMapWorker worker)
Specified by:
doGroupBy in class AbstractTreeMapModel<AbstractTreeMapNode>

addChild

protected void addChild(AbstractTreeMapNode parent,
                        List<Object> path,
                        List<TreeMapField> groupBy,
                        List<TreeMapField> childrenGroupBy,
                        int row)
Add a child according to its path in the hierarchy.

Parameters:
parent - the parent node
path - the path
row - the row of the child

getTreeMapField

public TreeMapField getTreeMapField(int columnIndex)
Description copied from interface: TreeMapModel
Gets the field corresponding to the specified column index.

Parameters:
columnIndex - the index of the column.
Returns:
the field.

createTreeMapField

protected TreeMapField createTreeMapField(int columnIndex)

getTreeMapField

public TreeMapField getTreeMapField(String columnName)
Description copied from interface: TreeMapModel
Gets the field corresponding to the specified column name.

Parameters:
columnName - the name of the column.
Returns:
the field.

getTableModel

public TableModel getTableModel()

getColumnCount

public int getColumnCount()
Description copied from interface: TreeMapModel
Returns the number of columns in the model.

Returns:
the number of columns in the model

getColumnName

public String getColumnName(int columnIndex)
Description copied from interface: TreeMapModel
Returns the name of the column at columnIndex. Note: this name does not need to be unique; two columns in a table can have the same name.

Parameters:
columnIndex - the index of the column
Returns:
the name of the column

getColumnClass

public Class<?> getColumnClass(int columnIndex)
Description copied from interface: TreeMapModel
Returns the most specific superclass for all the cell values in the column.

Parameters:
columnIndex - the index of the column
Returns:
the common ancestor class of the object values in the model.

getValueAt

public Object getValueAt(AbstractTreeMapNode node,
                         int columnIndex)
Description copied from interface: TreeMapModel
Returns the value for the cell at columnIndex and of node.

Parameters:
node - the node whose value is to be queried
columnIndex - the column whose value is to be queried
Returns:
the value Object at the specified cell

isEveryValueUnique

public boolean isEveryValueUnique(TreeMapField<AbstractTreeMapNode> field)
Description copied from interface: TreeMapModel
Indicates whether all the values in the given field are unique.

Parameters:
field - the field whose whose values are to be queried
Returns:
true if every value is unique, false otherwise

getNumericMax

public Double getNumericMax(TreeMapField columnIndex)
Description copied from interface: TreeMapModel
Gets the maximum value contained in the specified column.

Parameters:
columnIndex - the index of the column.
Returns:
the maximum value.

getNumericMin

public Double getNumericMin(TreeMapField columnIndex)
Description copied from interface: TreeMapModel
Gets the minimum value contained in the specified column.

Parameters:
columnIndex - the index of the column.
Returns:
the minimum value.

setNumericMax

public void setNumericMax(TreeMapField columnIndex,
                          double max)
Description copied from interface: TreeMapModel
Sets the maximum value contained in the specified column.

Parameters:
columnIndex - the index of the column.
max - the maximum value.

setNumericMin

public void setNumericMin(TreeMapField columnIndex,
                          double min)
Description copied from interface: TreeMapModel
Sets the minimum value contained in the specified column.

Parameters:
columnIndex - the index of the column.
min - the minimum value.

createDefaultColorMap

public MutableColorMap createDefaultColorMap(TreeMapField field)

JIDE 3.5.15