Package com.treemap
Class DefaultTreeMapModel<N extends AbstractTreeMapNode<N,Row,Column,Color,Font>,Row,Column,Color,Font>
java.lang.Object
com.treemap.AbstractTreeMapModel<N,Row,Column,Color,Font>
com.treemap.DefaultTreeMapModel<N,Row,Column,Color,Font>
- Type Parameters:
N- the type of nodes
- All Implemented Interfaces:
TreeMapModel<N,Row, Column, Color, Font>
- Direct Known Subclasses:
SwingTreeMapModel
public class DefaultTreeMapModel<N extends AbstractTreeMapNode<N,Row,Column,Color,Font>,Row,Column,Color,Font>
extends AbstractTreeMapModel<N,Row,Column,Color,Font>
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.treemap.AbstractTreeMapModel
AbstractTreeMapModel.Worker -
Field Summary
FieldsModifier and TypeFieldDescriptionFields inherited from class com.treemap.AbstractTreeMapModel
_settings, colorFactory, colorMapFactory, cpHelper, fontFactory, formatFactory, imageFactory, rootNodes, rowNodeFields inherited from interface com.treemap.TreeMapModel
PROPERTY_CURRENT_ROOT, PROPERTY_PROGRESS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddChild(N parent, AbstractTreeMapNode child) protected voidaddChild(N parent, Iterable<Object> path, Iterable<TreeMapField> groupBy, Iterable<TreeMapField> childrenGroupBy, Row row) Add a child according to its path in the hierarchy.columns()protected com.macrofocus.colormap.MutableColorMap<Color> createCategoricalColorMap(TreeMapField<N, Column> field) com.macrofocus.colormap.MutableColorMapcreateDefaultColorMap(TreeMapField<N, Column> field) protected AbstractTreeMapNodecreateLeafNode(Row row) protected AbstractTreeMapNodecreateParentNode(Object name, TreeMapField<N, Column> groupByField, TreeMapField<N, Column> childrenGroupByField) protected AbstractTreeMapNodecreateRootNode(TreeMapField<N, Column> childrenGroupByField) protected TreeMapFieldcreateTreeMapField(Column columnIndex) protected booleandoGroupBy(N parent, TreeMapWorker worker) protected AbstractTreeMapNodefindChild(AbstractTreeMapNode parent, Object name) intReturns the number of children of a given node.getChildren(N parent) Returns an iterator of the children of the given node.getChildrenOfTypeParent(N parent) Returns an iterator of the children of the given node.Class<?> getColumnClass(Column columnIndex) Returns the most specific superclass for all the cell values in the column.intReturns the number of columns in the model.getColumnName(Column columnIndex) Returns the name of the column atcolumnIndex.com.macrofocus.igraphics.CPColor<Color> Returns the color of the cushion.com.macrofocus.igraphics.CPImageReturns the image used for painting the cushion.Gets the label of the given node.getNumericMax(TreeMapField<N, Column> columnIndex) Gets the maximum value contained in the specified column.getNumericMin(TreeMapField<N, Column> columnIndex) Gets the minimum value contained in the specified column.Gets the parent node of the given node.intReturns the number of columns in the model.getTreeMapField(int columnIndex) Gets the field corresponding to the specified column index.getTreeMapField(Column columnIndex) Gets the field corresponding to the specified column index.getTreeMapFieldByName(String columnName) Gets the field corresponding to the specified column name.getValueAt(N node, Column columnIndex) Returns the value for the cell atcolumnIndexand ofnode.booleanisEveryValueUnique(TreeMapField<N, Column> field) Indicates whether all the values in the given field are unique.booleanisRoot(AbstractTreeMapNode node) Tells whether the given node is the root node or not.voidsetDataFrame(com.macrofocus.molap.dataframe.DataFrame<Row, Column, ?> dataFrame) Change the underlying DataFrame.voidsetNumericMax(TreeMapField columnIndex, double max) Sets the maximum value contained in the specified column.voidsetNumericMin(TreeMapField columnIndex, double min) Sets the minimum value contained in the specified column.Methods inherited from class com.treemap.AbstractTreeMapModel
addListener, breadthFirstIterator, clearAggregationCache, computeSize, computeSizeLeafs, computeSizeParents, computeSumSize, createSettings, depthFirstIterator, doColors, doLayout, doLayoutChildren, fireTableModelChanged, getAggregateValue, getBounds, getCategoricalColorMap, getChildrenGroupByField, getColor, getColorFactory, getColorMap, getColorMap, getColorProvider, getColorTreeMapFields, getCurrentRoot, getCustomColorMap, getFilter, getFormatPattern, getGroupByField, getGroupByTreeMapFields, getHeightTreeMapFields, getHighlighting, getImageFactory, getLabelsTreeMapFields, getLevel, getMaximumSize, getNestedShape, getNode, getNormalizedLightSourceX, getNormalizedLightSourceY, getNormalizedLightSourceZ, getPredefinedColorMap, getProbing, getProperties, getRoot, getSearch, getSelection, getSettings, getShape, getSize, getSizeTreeMapFields, getStringValue, getSumSize, getTooltipTreeMapFields, getTreeMapFields, getTreeMapFields, getTreeMapFields, getTreeMapFields, getViewport, getWorker, getWorkerFuture, hasNoChildren, initDefaults, isDirty, isLeaf, isNumericType, isTemporalType, isVisualType, parentPreorderEnumeration, preorderEnumeration, progressProperty, removeListener, scheduleUpdateColors, scheduleUpdateGroupBy, scheduleUpdateLayout, setColor, setColorProvider, setCurrentRoot, setFormatPattern, setNestedShape, setProgress, setShape, waitUntilReady
-
Field Details
-
dataFrame
-
-
Constructor Details
-
DefaultTreeMapModel
-
-
Method Details
-
setDataFrame
Change the underlying DataFrame. It is currently assumed that the structure of the DataFrame doesn't change, i.e. that the number, name, and type of columns stay the same.- Parameters:
dataFrame- the new DataFrame
-
getLabelName
Gets the label of the given node.- Parameters:
node- the node.- Returns:
- its label.
-
getParent
Gets the parent node of the given node.- Parameters:
node- the node- Returns:
- its parent
-
isRoot
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
Returns the number of children of a given node.- Parameters:
node- the parent node.- Returns:
- the number of children
-
getChildren
Returns an iterator of the children of the given node.- Parameters:
parent- the parent node- Returns:
- the children
-
getChildrenOfTypeParent
Returns an iterator of the children of the given node.- Parameters:
parent- the parent node- Returns:
- the children
-
getCushionImage
Returns the image used for painting the cushion.- Parameters:
node- the node- Returns:
- the cushion image
-
getCushionColor
Returns the color of the cushion.- Parameters:
node- the node- Returns:
- the cushion color
-
createRootNode
- Specified by:
createRootNodein classAbstractTreeMapModel<N extends AbstractTreeMapNode<N,Row, Column, Color, Font>, Row, Column, Color, Font>
-
createLeafNode
-
getNode
-
createParentNode
protected AbstractTreeMapNode createParentNode(Object name, TreeMapField<N, Column> groupByField, TreeMapField<N, Column> childrenGroupByField) -
findChild
-
addChild
-
doGroupBy
-
addChild
protected void addChild(N parent, Iterable<Object> path, Iterable<TreeMapField> groupBy, Iterable<TreeMapField> childrenGroupBy, Row row) Add a child according to its path in the hierarchy.- Parameters:
parent- the parent nodepath- the pathrow- the row of the child
-
getTreeMapField
Description copied from interface:TreeMapModelGets the field corresponding to the specified column index.- Parameters:
columnIndex- the index of the column.- Returns:
- the field.
-
getTreeMapField
Description copied from interface:TreeMapModelGets the field corresponding to the specified column index.- Parameters:
columnIndex- the index of the column.- Returns:
- the field.
-
createTreeMapField
-
getTreeMapFieldByName
Description copied from interface:TreeMapModelGets the field corresponding to the specified column name.- Parameters:
columnName- the name of the column.- Returns:
- the field.
-
getDataFrame
-
getRowCount
public int getRowCount()Description copied from interface:TreeMapModelReturns the number of columns in the model.- Returns:
- the number of columns in the model
-
getColumnCount
public int getColumnCount()Description copied from interface:TreeMapModelReturns the number of columns in the model.- Returns:
- the number of columns in the model
-
columns
-
getColumnName
Description copied from interface:TreeMapModelReturns the name of the column atcolumnIndex. 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
Description copied from interface:TreeMapModelReturns 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
Description copied from interface:TreeMapModelReturns the value for the cell atcolumnIndexand ofnode.- Parameters:
node- the node whose value is to be queriedcolumnIndex- the column whose value is to be queried- Returns:
- the value Object at the specified cell
-
isEveryValueUnique
Description copied from interface:TreeMapModelIndicates 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
Description copied from interface:TreeMapModelGets the maximum value contained in the specified column.- Parameters:
columnIndex- the index of the column.- Returns:
- the maximum value.
-
getNumericMin
Description copied from interface:TreeMapModelGets the minimum value contained in the specified column.- Parameters:
columnIndex- the index of the column.- Returns:
- the minimum value.
-
setNumericMax
Description copied from interface:TreeMapModelSets the maximum value contained in the specified column.- Parameters:
columnIndex- the index of the column.max- the maximum value.
-
setNumericMin
Description copied from interface:TreeMapModelSets the minimum value contained in the specified column.- Parameters:
columnIndex- the index of the column.min- the minimum value.
-
createDefaultColorMap
-
createCategoricalColorMap
protected com.macrofocus.colormap.MutableColorMap<Color> createCategoricalColorMap(TreeMapField<N, Column> field) - Specified by:
createCategoricalColorMapin classAbstractTreeMapModel<N extends AbstractTreeMapNode<N,Row, Column, Color, Font>, Row, Column, Color, Font>
-