Class AbstractTreeTableModel

java.lang.Object
org.cytoscape.util.swing.AbstractTreeTableModel
All Implemented Interfaces:
TreeModel, TreeTableModel

public abstract class AbstractTreeTableModel extends Object implements TreeTableModel
An abstract implementation of the TreeTableModel interface, handling the list of listeners.
Author:
Philip Milne

Cytoscape Backwards Compatibility (Abstract Class): This class is abstract and meant to be extended by users. This means that we may add methods for minor version updates. Methods will only be removed for major version updates.

Module: swing-util-api

To use this in your app, include the following dependency in your POM:

<dependency>
    <groupId>org.cytoscape</groupId>
    <artifactId>swing-util-api</artifactId>
</dependency>
  • Field Details

  • Constructor Details

    • AbstractTreeTableModel

      public AbstractTreeTableModel(Object root)
      Creates a new AbstractTreeTableModel object.
      Parameters:
      root - The root of this AbstractTreeTableModel.
  • Method Details

    • getRoot

      public Object getRoot()
      Returns the root of this AbstractTreeTableModel.
      Specified by:
      getRoot in interface TreeModel
      Returns:
      the root of this AbstractTreeTableModel.
    • isLeaf

      public boolean isLeaf(Object node)
      Returns true if the specified node is a leaf, false otherwise.
      Specified by:
      isLeaf in interface TreeModel
      Parameters:
      node - The node to check.
      Returns:
      True if the specified node is a leaf, false otherwise.
    • valueForPathChanged

      public void valueForPathChanged(TreePath path, Object newValue)
      Should be overridden.
      Specified by:
      valueForPathChanged in interface TreeModel
      Parameters:
      path - the TreePath.
      newValue - the new value.
    • getIndexOfChild

      public int getIndexOfChild(Object parent, Object child)
      Returns the index of a child given a parent.
      Specified by:
      getIndexOfChild in interface TreeModel
      Parameters:
      parent - The parent object.
      child - The child whose index we want.
      Returns:
      The index of the child. -1 if the child isn't found.
    • addTreeModelListener

      public void addTreeModelListener(TreeModelListener l)
      Specified by:
      addTreeModelListener in interface TreeModel
      Parameters:
      l - The TreeModelListener to add.
    • removeTreeModelListener

      public void removeTreeModelListener(TreeModelListener l)
      Specified by:
      removeTreeModelListener in interface TreeModel
      Parameters:
      l - The TreeModelListener to remove.
    • fireTreeNodesChanged

      protected void fireTreeNodesChanged(Object source, Object[] path, int[] childIndices, Object[] children)
      Notify all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method.
      See Also:
    • fireTreeNodesInserted

      protected void fireTreeNodesInserted(Object source, Object[] path, int[] childIndices, Object[] children)
      Notify all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method.
      See Also:
    • fireTreeNodesRemoved

      protected void fireTreeNodesRemoved(Object source, Object[] path, int[] childIndices, Object[] children)
      Notify all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method.
      See Also:
    • fireTreeStructureChanged

      protected void fireTreeStructureChanged(Object source, Object[] path, int[] childIndices, Object[] children)
      Notify all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method.
      See Also:
    • getColumnClass

      public Class<?> getColumnClass(int column)
      Returns the class of the column specified in the argument. Should probably be overridden since this implementation always returns Object.
      Specified by:
      getColumnClass in interface TreeTableModel
      Parameters:
      column - The index of the column.
      Returns:
      the class of the column specified in the argument.
    • isCellEditable

      public boolean isCellEditable(Object node, int column)
      By default, make the column with the Tree in it the only editable one. Making this column editable causes the JTable to forward mouse and keyboard events in the Tree column to the underlying JTree.
      Specified by:
      isCellEditable in interface TreeTableModel
      Parameters:
      node - The node to check.
      column - The column number.
      Returns:
      True if editable, false otherwise.
    • setValueAt

      public void setValueAt(Object aValue, Object node, int column)
      Should be overridden - this is a no-op.
      Specified by:
      setValueAt in interface TreeTableModel
      Parameters:
      aValue - The value.
      node - The node.
      column - The column.