Package com.treemap.treeplot

# Class DefaultTreePlotModel<N,Row,Column,Color,Font>

java.lang.Object
com.treemap.treeplot.DefaultTreePlotModel<N,Row,Column,Color,Font>

All Implemented Interfaces:
  `TreePlotModel<N,Row,Column,Color,Font>`

public class DefaultTreePlotModel<N,Row,Column,Color,Font> extends Object implements TreePlotModel<N,Row,Column,Color,Font>

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final MutableSingleSelection<TreeMapField<N,Column>>`
  `xVariable`
  `protected final MutableSingleSelection<TreeMapField<N,Column>>`
  `yVariable`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DefaultTreePlotModel(TreeMapModel<N,Row,Column,Color,Font> tmm, com.macrofocus.igraphics.CPColorFactory<Color> colorFactory, com.macrofocus.igraphics.CPFontFactory<Font> fontFactory, com.macrofocus.crossplatform.CPHelper helper)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Iterable<N>`
  `depthFirstIterator(N parent)`
  Creates and returns an iterable that traverses the subhierarchy rooted at the give node in depth-first order.
  `Object`
  `getAggregateValue(N node, TreeMapField field)`
  Returns the aggregated value of a variable for a given node.
  `com.macrofocus.geom.GeneralPath`
  `getCH(N node, TreeMapField xVariable, TreeMapField yVariable)`
  `Iterable<N>`
  `getChildren(N parent)`
  Returns an iterator of the children of the given node.
  `com.macrofocus.igraphics.CPColor<Color>`
  `getColor(N node)`
  Gets the color 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`.
  `N`
  `getCurrentRoot()`
  Gets the currently selected root node from which the treemap should be displayed.
  `MutableFilter<N>`
  `getFilter()`
  Obtains the model used for filtering nodes in the treemap.
  `Selection<N>`
  `getHighlighting()`
  Obtains the model used to highlight nodes in the treemap.
  `double`
  `getMaximumSize()`
  Corresponds to area in map.
  `double`
  `getMaximumSize(N parent)`
  Corresponds to area in map.
  `com.macrofocus.geom.Ellipse2D`
  `getMEC(N node, TreeMapField xVariable, TreeMapField yVariable)`
  `Double`
  `getNumericMax(TreeMapField<N,Column> columnIndex)`
  Gets the maximum value contained in the specified column.
  `Double`
  `getNumericMax(TreeMapField columnIndex, N parent)`
  Gets the maximum value contained in the specified column.
  `Double`
  `getNumericMin(TreeMapField<N,Column> columnIndex)`
  Gets the minimum value contained in the specified column.
  `Double`
  `getNumericMin(TreeMapField columnIndex, N parent)`
  Gets the minimum value contained in the specified column.
  `N`
  `getParent(N node)`
  Gets the parent node of the given node.
  `MutableSingleSelection<N>`
  `getProbing()`
  Obtains the model used for probing (aka mouse over).
  `N`
  `getRoot()`
  Returns the root node of the treemap.
  `MutableFilter<N>`
  `getSearch()`
  Obtains the model used to carry out search in the treemap.
  `MutableSelection<N>`
  `getSelection()`
  Obtains the model used for selecting nodes in the treemap.
  `TreePlotSettings`
  `getSettings()`
  Gets the settings currently selected.
  `double`
  `getSize(N node)`
  Corresponds to area in map.
  `String`
  `getStringValue(N node, TreeMapField field, TreeMapFieldSettings<Color,Font> settings)`
  Returns the string value for the cell at `columnIndex` and of `node`.
  `TreeMapField<N,Column>`
  `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.
  `protected Iterable<TreeMapField<N,Column>>`
  `getTreeMapFields(boolean includeNone)`
  `TreeMapModel<N,Row,Column,Color,Font>`
  `getTreeMapModel()`
  `Object`
  `getValueAt(N node, Column columnIndex)`
  Returns the value for the cell at `columnIndex` and of `node`.
  `Iterable<TreeMapField<N,Column>>`
  `getXTreeMapFields()`
  `MutableSingleSelection<TreeMapField<N,Column>>`
  `getXVariable()`
  `Iterable<TreeMapField<N,Column>>`
  `getYTreeMapFields()`
  `MutableSingleSelection<TreeMapField<N,Column>>`
  `getYVariable()`
  `boolean`
  `hasNoChildren(N node)`
  Tells whether the given node is a leaf node or not.
  `boolean`
  `isLeaf(N node)`
  `boolean`
  `isNumericType(TreeMapField<N,Column> field)`
  `boolean`
  `isRoot(N node)`
  Tells whether the given node is the root node or not.
  `boolean`
  `isTemporalType(TreeMapField<N,Column> field)`
  `boolean`
  `isVisualType(TreeMapField<N,Column> field)`
  `void`
  `setCurrentRoot(N currentRoot)`
  Sets the currently selected root node from which the treemap should be displayed.

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

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

- ## Field Details

  - ### xVariable

    protected final MutableSingleSelection<TreeMapField<N,Column>> xVariable

  - ### yVariable

    protected final MutableSingleSelection<TreeMapField<N,Column>> yVariable

- ## Constructor Details

  - ### DefaultTreePlotModel

    public DefaultTreePlotModel(TreeMapModel<N,Row,Column,Color,Font> tmm, com.macrofocus.igraphics.CPColorFactory<Color> colorFactory, com.macrofocus.igraphics.CPFontFactory<Font> fontFactory, com.macrofocus.crossplatform.CPHelper helper)

- ## Method Details

  - ### isNumericType

    public boolean isNumericType(TreeMapField<N,Column> field)
    Specified by:
      `isNumericType` in interface `TreePlotModel<N,Row,Column,Color,Font>`

  - ### isTemporalType

    public boolean isTemporalType(TreeMapField<N,Column> field)
    Specified by:
      `isTemporalType` in interface `TreePlotModel<N,Row,Column,Color,Font>`

  - ### isVisualType

    public boolean isVisualType(TreeMapField<N,Column> field)
    Specified by:
      `isVisualType` in interface `TreePlotModel<N,Row,Column,Color,Font>`

  - ### getSize

    public double getSize(N node)
    Corresponds to area in map.
    Specified by:
      `getSize` in interface `TreePlotModel<N,Row,Column,Color,Font>`
    Parameters:
      `node` - the node.
    Returns:
      the area

  - ### getMaximumSize

    public double getMaximumSize()
    Corresponds to area in map.
    Specified by:
      `getMaximumSize` in interface `TreePlotModel<N,Row,Column,Color,Font>`
    Returns:
      the maximum area

  - ### getMaximumSize

    public double getMaximumSize(N parent)
    Corresponds to area in map.
    Specified by:
      `getMaximumSize` in interface `TreePlotModel<N,Row,Column,Color,Font>`
    Returns:
      the maximum area

  - ### getTreeMapModel

    public TreeMapModel<N,Row,Column,Color,Font> getTreeMapModel()
    Specified by:
      `getTreeMapModel` in interface `TreePlotModel<N,Row,Column,Color,Font>`

  - ### getXVariable

    public MutableSingleSelection<TreeMapField<N,Column>> getXVariable()
    Specified by:
      `getXVariable` in interface `TreePlotModel<N,Row,Column,Color,Font>`

  - ### getXTreeMapFields

    public Iterable<TreeMapField<N,Column>> getXTreeMapFields()
    Specified by:
      `getXTreeMapFields` in interface `TreePlotModel<N,Row,Column,Color,Font>`

  - ### getYVariable

    public MutableSingleSelection<TreeMapField<N,Column>> getYVariable()
    Specified by:
      `getYVariable` in interface `TreePlotModel<N,Row,Column,Color,Font>`

  - ### getYTreeMapFields

    public Iterable<TreeMapField<N,Column>> getYTreeMapFields()
    Specified by:
      `getYTreeMapFields` in interface `TreePlotModel<N,Row,Column,Color,Font>`

  - ### getTreeMapFields

    protected Iterable<TreeMapField<N,Column>> getTreeMapFields(boolean includeNone)

  - ### getRoot

    public N getRoot()
    Returns the root node of the treemap.
    Specified by:
      `getRoot` in interface `TreePlotModel<N,Row,Column,Color,Font>`
    Returns:
      the root node.

  - ### getCurrentRoot

    public N getCurrentRoot()
    Gets the currently selected root node from which the treemap should be displayed.
    Specified by:
      `getCurrentRoot` in interface `TreePlotModel<N,Row,Column,Color,Font>`
    Returns:
      the currently selected root node.

  - ### setCurrentRoot

    public void setCurrentRoot(N currentRoot)
    Sets the currently selected root node from which the treemap should be displayed.
    Specified by:
      `setCurrentRoot` in interface `TreePlotModel<N,Row,Column,Color,Font>`
    Parameters:
      `currentRoot` - the root node to use for display.

  - ### getProbing

    public MutableSingleSelection<N> getProbing()
    Obtains the model used for probing (aka mouse over).
    Specified by:
      `getProbing` in interface `TreePlotModel<N,Row,Column,Color,Font>`
    Returns:
      the model used for probing.

  - ### getHighlighting

    public Selection<N> getHighlighting()
    Obtains the model used to highlight nodes in the treemap.
    Specified by:
      `getHighlighting` in interface `TreePlotModel<N,Row,Column,Color,Font>`
    Returns:
      the model used for highlighting.

  - ### getSelection

    public MutableSelection<N> getSelection()
    Obtains the model used for selecting nodes in the treemap.
    Specified by:
      `getSelection` in interface `TreePlotModel<N,Row,Column,Color,Font>`
    Returns:
      the model used for selection.

  - ### getFilter

    public MutableFilter<N> getFilter()
    Obtains the model used for filtering nodes in the treemap.
    Specified by:
      `getFilter` in interface `TreePlotModel<N,Row,Column,Color,Font>`
    Returns:
      the model used for filtering.

  - ### getSearch

    public MutableFilter<N> getSearch()
    Obtains the model used to carry out search in the treemap.
    Specified by:
      `getSearch` in interface `TreePlotModel<N,Row,Column,Color,Font>`
    Returns:
      the model used for searching.

  - ### getSettings

    public TreePlotSettings getSettings()
    Gets the settings currently selected.
    Specified by:
      `getSettings` in interface `TreePlotModel<N,Row,Column,Color,Font>`
    Returns:
      the settings.

  - ### getNumericMax

    public Double getNumericMax(TreeMapField<N,Column> columnIndex)
    Gets the maximum value contained in the specified column.
    Specified by:
      `getNumericMax` in interface `TreePlotModel<N,Row,Column,Color,Font>`
    Parameters:
      `columnIndex` - the index of the column.
    Returns:
      the maximum value.

  - ### getNumericMin

    public Double getNumericMin(TreeMapField<N,Column> columnIndex)
    Gets the minimum value contained in the specified column.
    Specified by:
      `getNumericMin` in interface `TreePlotModel<N,Row,Column,Color,Font>`
    Parameters:
      `columnIndex` - the index of the column.
    Returns:
      the minimum value.

  - ### getNumericMax

    public Double getNumericMax(TreeMapField columnIndex, N parent)
    Description copied from interface: `TreePlotModel`
    Gets the maximum value contained in the specified column.
    Specified by:
      `getNumericMax` in interface `TreePlotModel<N,Row,Column,Color,Font>`
    Parameters:
      `columnIndex` - the index of the column.
    Returns:
      the maximum value.

  - ### getNumericMin

    public Double getNumericMin(TreeMapField columnIndex, N parent)
    Description copied from interface: `TreePlotModel`
    Gets the minimum value contained in the specified column.
    Specified by:
      `getNumericMin` in interface `TreePlotModel<N,Row,Column,Color,Font>`
    Parameters:
      `columnIndex` - the index of the column.
    Returns:
      the minimum value.

  - ### depthFirstIterator

    public Iterable<N> depthFirstIterator(N parent)
    Creates and returns an iterable that traverses the subhierarchy rooted at the give node in depth-first order. The first node returned by the iterator's next() method is the leftmost leaf.
    Specified by:
      `depthFirstIterator` in interface `TreePlotModel<N,Row,Column,Color,Font>`
    Parameters:
      `parent` - the root of the hierarchy to traverse
    Returns:
      an iterable that traverses the subtree rooted at this node in depth-first order.

  - ### getTreeMapField

    public TreeMapField<N,Column> getTreeMapField(int columnIndex)
    Gets the field corresponding to the specified column index.
    Specified by:
      `getTreeMapField` in interface `TreePlotModel<N,Row,Column,Color,Font>`
    Parameters:
      `columnIndex` - the index of the column.
    Returns:
      the field.

  - ### getTreeMapField

    public TreeMapField getTreeMapField(String columnName)
    Gets the field corresponding to the specified column name.
    Specified by:
      `getTreeMapField` in interface `TreePlotModel<N,Row,Column,Color,Font>`
    Parameters:
      `columnName` - the name of the column.
    Returns:
      the field.

  - ### hasNoChildren

    public boolean hasNoChildren(N node)
    Description copied from interface: `TreePlotModel`
    Tells whether the given node is a leaf node or not.
    Specified by:
      `hasNoChildren` in interface `TreePlotModel<N,Row,Column,Color,Font>`
    Parameters:
      `node` - the node
    Returns:
      true if it is a leaf node, false otherwise.

  - ### isLeaf

    public boolean isLeaf(N node)
    Specified by:
      `isLeaf` in interface `TreePlotModel<N,Row,Column,Color,Font>`

  - ### getParent

    public N getParent(N node)
    Gets the parent node of the given node.
    Specified by:
      `getParent` in interface `TreePlotModel<N,Row,Column,Color,Font>`
    Parameters:
      `node` - the node
    Returns:
      its parent

  - ### getColumnName

    public String getColumnName(Column columnIndex)
    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.
    Specified by:
      `getColumnName` in interface `TreePlotModel<N,Row,Column,Color,Font>`
    Parameters:
      `columnIndex` - the index of the column
    Returns:
      the name of the column

  - ### getValueAt

    public Object getValueAt(N node, Column columnIndex)
    Returns the value for the cell at `columnIndex` and of `node`.
    Specified by:
      `getValueAt` in interface `TreePlotModel<N,Row,Column,Color,Font>`
    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

  - ### getAggregateValue

    public Object getAggregateValue(N node, TreeMapField field)
    Returns the aggregated value of a variable for a given node.
    Specified by:
      `getAggregateValue` in interface `TreePlotModel<N,Row,Column,Color,Font>`
    Parameters:
      `node` - the node whose value is to be queried
      `field` - the field whose value is to be queried
    Returns:
      the value Object at the specified cell

  - ### getChildren

    public Iterable<N> getChildren(N parent)
    Returns an iterator of the children of the given node.
    Specified by:
      `getChildren` in interface `TreePlotModel<N,Row,Column,Color,Font>`
    Parameters:
      `parent` - the parent node
    Returns:
      the children

  - ### getColor

    public com.macrofocus.igraphics.CPColor<Color> getColor(N node)
    Gets the color of the given node.
    Specified by:
      `getColor` in interface `TreePlotModel<N,Row,Column,Color,Font>`
    Parameters:
      `node` - the node.
    Returns:
      its color.

  - ### getStringValue

    public String getStringValue(N node, TreeMapField field, TreeMapFieldSettings<Color,Font> settings)
    Returns the string value for the cell at `columnIndex` and of `node`.
    Specified by:
      `getStringValue` in interface `TreePlotModel<N,Row,Column,Color,Font>`
    Parameters:
      `node` - the node whose value is to be queried
      `field` - the field whose value is to be queried
    Returns:
      the value Object at the specified cell

  - ### isRoot

    public boolean isRoot(N node)
    Tells whether the given node is the root node or not.
    Specified by:
      `isRoot` in interface `TreePlotModel<N,Row,Column,Color,Font>`
    Parameters:
      `node` - the node
    Returns:
      true if it is the root node, false otherwise.

  - ### getColumnCount

    public int getColumnCount()
    Returns the number of columns in the model.
    Specified by:
      `getColumnCount` in interface `TreePlotModel<N,Row,Column,Color,Font>`
    Returns:
      the number of columns in the model

  - ### getColumnClass

    public Class<?> getColumnClass(Column columnIndex)
    Returns the most specific superclass for all the cell values in the column.
    Specified by:
      `getColumnClass` in interface `TreePlotModel<N,Row,Column,Color,Font>`
    Parameters:
      `columnIndex` - the index of the column
    Returns:
      the common ancestor class of the object values in the model.

  - ### getMEC

    public com.macrofocus.geom.Ellipse2D getMEC(N node, TreeMapField xVariable, TreeMapField yVariable)
    Specified by:
      `getMEC` in interface `TreePlotModel<N,Row,Column,Color,Font>`

  - ### getCH

    public com.macrofocus.geom.GeneralPath getCH(N node, TreeMapField xVariable, TreeMapField yVariable)
    Specified by:
      `getCH` in interface `TreePlotModel<N,Row,Column,Color,Font>`