Class AbstractJPPFTreeTableModel

java.lang.Object
org.jppf.ui.treetable.AbstractTreeTableModel
org.jppf.ui.treetable.AbstractJPPFTreeTableModel
All Implemented Interfaces:
Serializable, TreeModel, TreeTableModel
Direct Known Subclasses:
JobTreeTableModel, JVMHealthTreeTableModel, NodeTreeTableModel

public abstract class AbstractJPPFTreeTableModel extends AbstractTreeTableModel
Abstract tree table model implementation for tree table-based options.
Author:
Laurent Cohen
See Also:
  • Field Details

    • i18nBase

      protected String i18nBase
      Base name for localization bundle lookups.
    • locale

      protected transient Locale locale
      The locale used to translate coumn headers and cell values.
    • nfInt

      protected final NumberFormat nfInt
      Formatter for cells that contain integer numbers.
    • nfDec

      protected final NumberFormat nfDec
      Formatter for cells that contain decimal numbers.
    • nfMB

      protected final NumberFormat nfMB
      Formatter for cells that contain decimal numbers.
  • Constructor Details

    • AbstractJPPFTreeTableModel

      public AbstractJPPFTreeTableModel(TreeNode root)
      Initialize this model with the specified tree root.
      Parameters:
      root - the root of the tree.
    • AbstractJPPFTreeTableModel

      public AbstractJPPFTreeTableModel(TreeNode root, Locale locale)
      Initialize this model with the specified tree root.
      Parameters:
      root - the root of the tree.
      locale - the locale used to translate coumn headers and cell values.
  • Method Details

    • isCellEditable

      public boolean isCellEditable(Object node, int column)
      Tells if a cell can be edited.
      Specified by:
      isCellEditable in interface TreeTableModel
      Overrides:
      isCellEditable in class AbstractTreeTableModel
      Parameters:
      node - not used.
      column - not used.
      Returns:
      true if the cell can be edited, false otherwise.
    • setValueAt

      public void setValueAt(Object value, Object node, int column)
      Called when done editing a cell. This method has an empty implementation and does nothing.
      Specified by:
      setValueAt in interface TreeTableModel
      Overrides:
      setValueAt in class AbstractTreeTableModel
      Parameters:
      value - not used.
      node - not used.
      column - not used.
    • getChild

      public Object getChild(Object parent, int index)
      Return the child at the specified index from the specified parent node.
      Parameters:
      parent - the parent to get the child from.
      index - the index at which to get the child
      Returns:
      the child node, or null if the index is not valid.
    • getChildCount

      public int getChildCount(Object parent)
      Get the number of children for the specified node.
      Parameters:
      parent - the node for which to get the number of children.
      Returns:
      the number of children as an int.
    • insertNodeInto

      public void insertNodeInto(DefaultMutableTreeNode child, DefaultMutableTreeNode parent, int pos)
      Insert the specified child into the specified parent's list of children at the specified position.
      Parameters:
      child - the node to insert into the parent.
      parent - the node into which to insert the child.
      pos - the position at which to insert the node.
    • removeNodeFromParent

      public void removeNodeFromParent(DefaultMutableTreeNode node)
      Remove a node from the tree.
      Parameters:
      node - the node to remove from the parent.
    • changeNode

      public void changeNode(DefaultMutableTreeNode node)
      Handle a node update.
      Parameters:
      node - the node to update.
    • getColumnClass

      public Class<?> getColumnClass(int column)
      Determine the class of th specified column.
      Specified by:
      getColumnClass in interface TreeTableModel
      Overrides:
      getColumnClass in class AbstractTreeTableModel
      Parameters:
      column - - the column index.
      Returns:
      a Class instance.
    • localize

      protected String localize(String message)
      Get a localized message given its unique name and the current locale.
      Parameters:
      message - the unique name of the localized message.
      Returns:
      a message in the current locale, or the default locale if the localization for the current locale is not found.
    • getColumnName

      public String getColumnName(int column)
      Description copied from interface: TreeTableModel
      Returns the name for column number column.
      Parameters:
      column - the column number.
      Returns:
      the name of the column as a string.
    • getColumnTooltip

      public String getColumnTooltip(int column)
      Description copied from interface: TreeTableModel
      Returns the tooltip for column number column.
      Specified by:
      getColumnTooltip in interface TreeTableModel
      Overrides:
      getColumnTooltip in class AbstractTreeTableModel
      Parameters:
      column - the column number.
      Returns:
      the name of the column as a string.
    • getBaseColumnName

      public abstract String getBaseColumnName(int column)
      Get the non-localized name of the specified column.
      Parameters:
      column - the index of the column for which to get a name.
      Returns:
      the column name as a string.
    • createNumberFormat

      protected NumberFormat createNumberFormat()
      Get a number formatter for the number of tasks for each node.
      Returns:
      a NumberFormat instance.
    • createDecimalNumberFormat

      protected NumberFormat createDecimalNumberFormat()
      Get a number formatter for the number of tasks for each node.
      Returns:
      a NumberFormat instance.
    • createMBFormat

      protected NumberFormat createMBFormat()
      Get a number formatter for values expressed in MB.
      Returns:
      a NumberFormat instance.
    • getI18nBase

      public String getI18nBase()
      Returns:
      the base name for localization bundle lookups.