Class DefaultTreeMapModel<N extends AbstractTreeMapNode<N,​Row,​Column,​Color,​Font>,​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.
    • Field Detail

      • dataFrame

        protected com.macrofocus.molap.dataframe.DataFrame<Row,​Column,​?> dataFrame
    • Constructor Detail

      • 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 Detail

      • 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 java.lang.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 java.lang.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 java.lang.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
      • getNode

        public N getNode​(Row row)
      • addChild

        protected void addChild​(N parent,
                                java.util.List<java.lang.Object> path,
                                java.util.List<TreeMapField> groupBy,
                                java.util.List<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.
      • getTreeMapFieldByName

        public TreeMapField getTreeMapFieldByName​(java.lang.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 java.lang.Iterable<Column> columns()
      • getColumnName

        public java.lang.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 java.lang.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 java.lang.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 java.lang.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 java.lang.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)