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>`

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

  Fields
  Modifier and Type
  Field
  Description
  `protected com.macrofocus.molap.dataframe.DataFrame<Row,Column,?>`
  `dataFrame`

  ### Fields inherited from class com.treemap.AbstractTreeMapModel

  `_settings, colorFactory, colorMapFactory, cpHelper, fontFactory, formatFactory, imageFactory, rootNodes, rowNode`

  ### Fields inherited from interface com.treemap.TreeMapModel

  `PROPERTY_CURRENT_ROOT, PROPERTY_PROGRESS`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DefaultTreeMapModel(com.macrofocus.molap.dataframe.DataFrame<Row,Column,?> dataFrame, com.macrofocus.crossplatform.CPFactory<?,Font,?,Color> cpFactory, com.macrofocus.colormap.ColorMapFactory<Color> colorMapFactory, com.macrofocus.igraphics.CPImageFactory imageFactory)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `addChild(N parent, AbstractTreeMapNode child)`
  `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.
  `Iterable<Column>`
  `columns()`
  `protected com.macrofocus.colormap.MutableColorMap<Color>`
  `createCategoricalColorMap(TreeMapField<N,Column> field)`
  `com.macrofocus.colormap.MutableColorMap`
  `createDefaultColorMap(TreeMapField<N,Column> field)`
  `protected AbstractTreeMapNode`
  `createLeafNode(Row row)`
  `protected AbstractTreeMapNode`
  `createParentNode(Object name, TreeMapField<N,Column> groupByField, TreeMapField<N,Column> childrenGroupByField)`
  `protected AbstractTreeMapNode`
  `createRootNode(TreeMapField<N,Column> childrenGroupByField)`
  `protected TreeMapField`
  `createTreeMapField(Column columnIndex)`
  `protected boolean`
  `doGroupBy(N parent, TreeMapWorker worker)`
  `protected AbstractTreeMapNode`
  `findChild(AbstractTreeMapNode parent, Object name)`
  `int`
  `getChildCount(AbstractTreeMapNode node)`
  Returns the number of children of a given node.
  `Iterable<N>`
  `getChildren(N parent)`
  Returns an iterator of the children of the given node.
  `Iterable<N>`
  `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.
  `int`
  `getColumnCount()`
  Returns the number of columns in the model.
  `String`
  `getColumnName(Column columnIndex)`
  Returns the name of the column at `columnIndex`.
  `com.macrofocus.igraphics.CPColor<Color>`
  `getCushionColor(AbstractTreeMapNode node)`
  Returns the color of the cushion.
  `com.macrofocus.igraphics.CPImage`
  `getCushionImage(AbstractTreeMapNode node)`
  Returns the image used for painting the cushion.
  `com.macrofocus.molap.dataframe.DataFrame<Row,Column,?>`
  `getDataFrame()`
  `String`
  `getLabelName(AbstractTreeMapNode node)`
  Gets the label of the given node.
  `N`
  `getNode(Row row)`
  `Double`
  `getNumericMax(TreeMapField<N,Column> columnIndex)`
  Gets the maximum value contained in the specified column.
  `Double`
  `getNumericMin(TreeMapField<N,Column> columnIndex)`
  Gets the minimum value contained in the specified column.
  `N`
  `getParent(N node)`
  Gets the parent node of the given node.
  `int`
  `getRowCount()`
  Returns the number of columns in the model.
  `TreeMapField`
  `getTreeMapField(int columnIndex)`
  Gets the field corresponding to the specified column index.
  `TreeMapField`
  `getTreeMapField(Column columnIndex)`
  Gets the field corresponding to the specified column index.
  `TreeMapField`
  `getTreeMapFieldByName(String columnName)`
  Gets the field corresponding to the specified column name.
  `Object`
  `getValueAt(N node, Column columnIndex)`
  Returns the value for the cell at `columnIndex` and of `node`.
  `boolean`
  `isEveryValueUnique(TreeMapField<N,Column> 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`
  `setDataFrame(com.macrofocus.molap.dataframe.DataFrame<Row,Column,?> dataFrame)`
  Change the underlying DataFrame.
  `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.

  ### 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`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### dataFrame

    protected com.macrofocus.molap.dataframe.DataFrame<Row,Column,?> dataFrame

- ## Constructor Details

  - ### DefaultTreeMapModel

    public DefaultTreeMapModel(com.macrofocus.molap.dataframe.DataFrame<Row,Column,?> dataFrame, com.macrofocus.crossplatform.CPFactory<?,Font,?,Color> cpFactory, com.macrofocus.colormap.ColorMapFactory<Color> colorMapFactory, com.macrofocus.igraphics.CPImageFactory imageFactory)

- ## Method Details

  - ### setDataFrame

    public void setDataFrame(com.macrofocus.molap.dataframe.DataFrame<Row,Column,?> dataFrame)
    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

    public String getLabelName(AbstractTreeMapNode node)
    Gets the label of the given node.
    Parameters:
      `node` - the node.
    Returns:
      its label.

  - ### getParent

    public N getParent(N 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<N> getChildren(N parent)
    Returns an iterator of the children of the given node.
    Parameters:
      `parent` - the parent node
    Returns:
      the children

  - ### getChildrenOfTypeParent

    public Iterable<N> getChildrenOfTypeParent(N parent)
    Returns an iterator of the children of the given node.
    Parameters:
      `parent` - the parent node
    Returns:
      the children

  - ### getCushionImage

    public com.macrofocus.igraphics.CPImage getCushionImage(AbstractTreeMapNode node)
    Returns the image used for painting the cushion.
    Parameters:
      `node` - the node
    Returns:
      the cushion image

  - ### getCushionColor

    public com.macrofocus.igraphics.CPColor<Color> getCushionColor(AbstractTreeMapNode node)
    Returns the color of the cushion.
    Parameters:
      `node` - the node
    Returns:
      the cushion color

  - ### createRootNode

    protected AbstractTreeMapNode createRootNode(TreeMapField<N,Column> childrenGroupByField)
    Specified by:
      `createRootNode` in class `AbstractTreeMapModel<N extends AbstractTreeMapNode<N,Row,Column,Color,Font>,Row,Column,Color,Font>`

  - ### createLeafNode

    protected AbstractTreeMapNode createLeafNode(Row row)

  - ### getNode

    public N getNode(Row row)

  - ### createParentNode

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

  - ### findChild

    protected AbstractTreeMapNode findChild(AbstractTreeMapNode parent, Object name)

  - ### addChild

    protected void addChild(N parent, AbstractTreeMapNode child)

  - ### doGroupBy

    protected boolean doGroupBy(N parent, TreeMapWorker worker)
    Specified by:
      `doGroupBy` in class `AbstractTreeMapModel<N extends AbstractTreeMapNode<N,Row,Column,Color,Font>,Row,Column,Color,Font>`

  - ### 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 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.

  - ### getTreeMapField

    public TreeMapField getTreeMapField(Column 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(Column columnIndex)

  - ### getTreeMapFieldByName

    public TreeMapField getTreeMapFieldByName(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.

  - ### getDataFrame

    public com.macrofocus.molap.dataframe.DataFrame<Row,Column,?> getDataFrame()

  - ### getRowCount

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

  - ### 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

  - ### columns

    public Iterable<Column> columns()

  - ### getColumnName

    public String getColumnName(Column 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(Column 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(N node, Column 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<N,Column> 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<N,Column> 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<N,Column> 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 com.macrofocus.colormap.MutableColorMap createDefaultColorMap(TreeMapField<N,Column> field)

  - ### createCategoricalColorMap

    protected com.macrofocus.colormap.MutableColorMap<Color> createCategoricalColorMap(TreeMapField<N,Column> field)
    Specified by:
      `createCategoricalColorMap` in class `AbstractTreeMapModel<N extends AbstractTreeMapNode<N,Row,Column,Color,Font>,Row,Column,Color,Font>`