com.dlsc.flexgantt.swing.treetable
Class TreeTable

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.dlsc.flexgantt.swing.treetable.TreeTable
All Implemented Interfaces:
ICommandStackListener, IColumnModelListener, ITreeTableModelListener, java.awt.dnd.Autoscroll, java.awt.event.FocusListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.CellEditorListener, javax.swing.event.TreeExpansionListener, javax.swing.event.TreeModelListener, javax.swing.event.TreeSelectionListener, javax.swing.event.TreeWillExpandListener, javax.swing.tree.RowMapper

public class TreeTable
extends javax.swing.JPanel
implements java.beans.PropertyChangeListener, javax.swing.event.TreeSelectionListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener, javax.swing.event.TreeWillExpandListener, javax.swing.event.TreeExpansionListener, ITreeTableModelListener, javax.swing.tree.RowMapper, ICommandStackListener, javax.swing.event.CellEditorListener, java.awt.event.KeyListener, java.awt.event.FocusListener, IColumnModelListener, java.awt.dnd.Autoscroll

The left-hand side of any Gantt chart is represented by a tree table component, which allows the user to drill down the data provided by a tree table model. A tree table supports complex user interaction such as cell editing and drag and drop operations. Pluggable editors and renderers allow for total customization of the visual appearance and editing capabilities. Several aspects of the tree table's behaviour can be customized by policies such as INodeEditPolicy and INodeDragAndDropPolicy.

Since:
1.0
Author:
Dirk Lemmermann
See Also:
ITreeTableModel, ITreeTableNode, DefaultMutableTreeTableNode, INodeEditPolicy, INodeDragAndDropPolicy, IRowPolicy, Serialized Form

Nested Class Summary
static class TreeTable.BooleanEditor
          An editor for values of type Boolean.
static class TreeTable.BooleanRenderer
          A renderer for drawing values of type Boolean.
static class TreeTable.CalendarEditor
          An editor for values of type Calendar.
static class TreeTable.CalendarRenderer
          A renderer for values of type Calendar.
static class TreeTable.ColorEditor
          An editor for values of type Color.
static class TreeTable.ColorRenderer
          A renderer for values of type Color.
static class TreeTable.DateEditor
          An editor for values of type Date.
static class TreeTable.DateRenderer
          A renderer for values of type Date.
static class TreeTable.DoubleRenderer
          A renderer for values of type Double.
static class TreeTable.EnumEditor
          An editor for enumerations.
static class TreeTable.EnumRenderer
          A renderer for values of type Enum.
static class TreeTable.IconRenderer
          A renderer for drawing icons.
static class TreeTable.NumberEditor
          An editor for numbers (double, float, ...).
static class TreeTable.NumberRenderer
          A tree table cell renderer for numbers (double, float, etc...).
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static java.lang.String PROPERTY_ALT_BACKGROUND_COLOR
          Constant used for the property change event that gets fired when the alternating background color changes.
static java.lang.String PROPERTY_ALT_FOREGROUND_COLOR
          Constant used for the property change event that gets fired when the alternating background color changes.
static java.lang.String PROPERTY_CREATION_ENABLED
          Constant used for the property change event that gets fired when the support for creating new nodes (directly inside the table) gets enabled or disabled.
static java.lang.String PROPERTY_DEFAULT_ROW_HEIGHT
          Constant used for the property change event that gets fired when the value for the default row height changes.
static java.lang.String PROPERTY_DRAGGING_ENABLED
          Constant used for the property change event that gets fired when the drag & drop support gets enabled/disabled.
static java.lang.String PROPERTY_GRID_COLOR
          Constant used for the property change event that gets fired when the grid color changes.
static java.lang.String PROPERTY_HORIZONTAL_LINES_VISIBLE
          Constant used for the property change event that gets fired when the visibility of the horizontal lines changes.
static java.lang.String PROPERTY_INDENT_ENABLED
          Constant used for the property change event that gets fired when the indentation feature gets enabled/disabled.
static java.lang.String PROPERTY_MODEL
          Constant used for the property change event that gets fired when the tree table model changes.
static java.lang.String PROPERTY_POLICY_PROVIDER
          Constant used for the property change event that gets fired when the policy provider for the tree table gets replaced.
static java.lang.String PROPERTY_RESIZING_ENABLED
          Constant used for the property change event that gets fired when the resizing support gets enabled/disabled.
static java.lang.String PROPERTY_ROOT_VISIBLE
          Constant used for the property change event that gets fired when the visibility of the root node changes.
static java.lang.String PROPERTY_ROW_NUMBERS_VISIBLE
          Constant used for the property change event that gets fired when the visibility of the row numbers changes.
static java.lang.String PROPERTY_SELECTION_BACKGROUND_COLOR
          Constant used for the property change event that gets fired when the selection background color changes.
static java.lang.String PROPERTY_SELECTION_FOREGROUND_COLOR
          Constant used for the property change event that gets fired when the selection foreground color changes.
static java.lang.String PROPERTY_SELECTION_MODEL
          Constant used for the property change event that gets fired when the selection model changes.
static java.lang.String PROPERTY_VERTICAL_LINES_VISIBLE
          Constant used for the property change event that gets fired when the visibility of the vertical lines changes.
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
TreeTable(AbstractGanttChart ganttChart, ITreeTableModel model)
          Constructs a new tree table.
 
Method Summary
 void addSelectionInterval(int start, int end)
          Adds all rows within the given interval to the current selection.
 void addSelectionPath(javax.swing.tree.TreePath path)
          Adds another path to the current selection.
 void addSelectionPaths(javax.swing.tree.TreePath[] paths)
          Adds several paths at once to the selection model.
 void addSelectionRow(int row)
          Adds a row to the current selection.
 void addSelectionRows(int[] rows)
          Adds several rows at once to the selection model.
 void addTreeExpansionListener(javax.swing.event.TreeExpansionListener l)
          Adds a tree expansion listener that will receive events after a tree node has been expanded.
 void addTreeSelectionListener(javax.swing.event.TreeSelectionListener l)
          Adds a tree selection listener to the table.
 void addTreeWillExpandListener(javax.swing.event.TreeWillExpandListener l)
          Adds a tree expansion listener that will be informed before a tree node expands.
 void animateDropPath(javax.swing.tree.TreePath path)
          Causes a fade-in effect for the given path, which gets used by the DnD manager to visualize where a node is located after a drop.
 void autoscroll(java.awt.Point cursorLocn)
           
 void clearSelection()
          Clears the current tree table selection.
 void collapseAll()
          Collapses all tree nodes by starting at the root node, recursively traversing the tree hierarchy and calling TreeTableNode.collapse() on each visited node.
 void collapsePath(javax.swing.tree.TreePath path)
          Collapses the tree node that matches the given path.
 void collapseRow(int row)
          Collapses the tree node located in the given row.
 void columnModelChanged(ColumnModelEvent evt)
          The listener's callback method that will be invoked when columns get added, removed, inserted.
 void commandStackChanged(CommandStackEvent evt)
          Gets called whenever the command stack changed.
 boolean containsPath(javax.swing.tree.TreePath path)
          Determines if the given tree path exists in the tree table.
protected  TreeTableDragAndDropManager createDragAndDropManager()
          Creates the drag and drop manager (DnD manager) that will be used to control the tree table's drag and drop operations.
 boolean editCellAt(int row, int column)
          Programmatically starts editing the cell at row and column, if those indices are in the valid range, and the cell at those indices is editable.
 boolean editCellAt(int row, int column, java.awt.event.InputEvent e)
          Programmatically starts editing the cell at row and column, if those indices are in the valid range, and the cell at those indices is editable.
 boolean editCellFocused(java.awt.event.InputEvent evt)
          Starts the editing of the currently focused table cell.
 void editingCanceled(javax.swing.event.ChangeEvent e)
           
 void editingStopped(javax.swing.event.ChangeEvent e)
           
 void expandAll()
          Expands all tree nodes by starting at the root node, recursively traversing the tree hierarchy and calling TreeTableNode.expand() on each visited node.
 void expandPath(javax.swing.tree.TreePath path)
          Expands the tree node that matches the given path.
 void expandRow(int row)
          Expands the tree node located in the given row.
protected  void fireTreeCollapsed(javax.swing.tree.TreePath path)
          Fires a tree expansion event after a node collapsed.
protected  void fireTreeExpanded(javax.swing.tree.TreePath path)
          Fires a tree expansion event after a node expanded.
protected  void fireTreeWillCollapse(javax.swing.tree.TreePath path)
          Fires a tree expansion event before a node collapses.
protected  void fireTreeWillExpand(javax.swing.tree.TreePath path)
          Fires a tree expansion event before a node expands.
 void focusGained(java.awt.event.FocusEvent e)
           
 void focusLost(java.awt.event.FocusEvent e)
           
 float getAlpha()
          Returns the alpha channel value (default is 1).
 java.awt.Color getAlternatingBackground()
          Returns the alternating background color.
 java.awt.Color getAlternatingForeground()
          Returns the alternating foreground color.
 java.awt.Insets getAutoscrollInsets()
           
 java.awt.Color getBackground(int row)
          Returns the background color for the given row.
 java.awt.Color getBackground(int row, boolean includeSelection)
          Returns the background color for the given row.
 ITreeTableCellEditor getCellEditor()
          Returns the currently used cell editor.
 ITreeTableCellEditor getCellEditor(java.lang.Class cl)
          Returns a cell editor for the given object type.
 ITreeTableCellEditor getCellEditor(int row, int column)
          Returns a cell editor for the given row and column.
 CellFocusManager getCellFocusManager()
          Returns the cell focus manager, a specialized class that only deals with managing the table's focus.
 java.awt.Rectangle getCellRect(int row, int column)
          Returns the cell rectangle for the cell at the given row and column.
 ITreeTableCellRenderer getCellRenderer(java.lang.Class cl)
          Returns a cell renderer for the given object type.
 TreeTableColumn getColumn(int index)
          Returns the column for the given index.
 java.lang.Class getColumnClass(int columnIndex)
          Returns the object type of the values shown in the column at the given index.
 int getColumnCount()
          Returns the number of columns in the column model.
 int getColumnIndex(TreeTableColumn col)
          Returns the index of the given column.
 int getColumnIndexAt(int x)
          Returns the column at the given x-coordinate.
 IColumnModel getColumnModel()
          Returns the tree table's column model.
 int getDefaultRowHeight()
          Returns the default row height that will be applied for such rows where the IRowPolicy is not used to determine the height.
 TreeTableDragAndDropManager getDragAndDropManager()
          Returns the drag and drop manager used by the tree table to control its drag and drop capabilities.
 java.awt.Color getDropColorInvalid()
          Returns the color that will be used to show where an invalid drop can occure.
 java.awt.Color getDropColorValid()
          Returns the color that will be used to show where a valid drop can occure.
 int getEditingColumn()
          Returns the column in which editing currently takes place.
 int getEditingRow()
          Returns the row in which editing currently takes place.
 java.awt.Component getEditorComponent()
          Returns the user interface component that is currently being used to edit a cell value.
 int getFirstVisibleRow()
          Returns the index of the first visible row based on the internal tree table node array used to store the state of the tree table.
 java.awt.Color getFocusColor()
          Returns the color used for drawing the focus rectangle.
 int getFocusedColumn()
          Returns the column of the focused cell.
 int getFocusedRow()
          Returns the row of the focused cell.
 java.awt.Color getForeground(int row)
          Returns the foreground color for the given row.
 java.awt.Color getForeground(int row, boolean includeSelection)
          Returns the foreground color for the given row.
 AbstractGanttChart getGanttChart()
          Returns the parent Gantt chart of the table.
 java.awt.Color getGridColor()
          Returns the color used for drawing the vertical and horizontal lines of the grid.
 int getInset()
          Returns the number of pixels used to inset sub-nodes.
 KeyColumn getKeyColumn()
          Returns the column model's key column.
 int getKeyColumnPosition()
          Returns the position of the key column in the table.
 int getLastVisibleRow()
          Returns the index of the last visible row based on the internal tree table node array used to store the state of the tree table.
 LayerContainer getLayerContainer()
          Returns the layer container mapped to this table.
 ITreeTableMenuProvider getMenuProvider()
          Returns the menu provider used by the tree table to lookup a popup menu based on the location and context of the popup trigger event.
 ITreeTableModel getModel()
          Returns the model that is being used as a data source for the tree table.
 javax.swing.tree.TreePath[] getPathsBetweenRows(int start, int end)
          Returns an array of tree paths that matches rows within the given interval.
 IPolicyProvider getPolicyProvider()
          Returns the policy provider used by the table to lookup policy implementations.
 java.awt.Dimension getPreferredSize()
          Returns the preferred size.
 java.util.Map<java.lang.Class,ITreeTableCellRenderer> getRendererMap()
          Returns the map, which is storing the mappings between cell value types and tree table cell renderers.
 javax.swing.CellRendererPane getRendererPane()
          Returns the renderer pane used by the tree table to render the tree table cell renderers.
 TreeTableNode getRootNode()
          The root node.
 int getRowAt(int y)
          Returns the row for the given y-coordinate.
 int getRowCount()
          Returns the total number of rows, which is equal to the length of the tree table nodes array.
 int getRowForPath(javax.swing.tree.TreePath path)
          Returns the row for the given path.
 TreeTableRowHeader getRowHeader()
          Returns the row header that was created by the component factory and that will be used to control the tree table (expanding / collapsing nodes, row height, selection, ...).
 int getRowHeight(int row)
          Returns the height of the given row.
 int[] getRowsForPaths(javax.swing.tree.TreePath[] paths)
           
 java.awt.Color getSelectionBackground()
          Returns the color used for filling the background of currently selected rows.
 int getSelectionCount()
          Returns the number of currently selected rows / tree nodes.
 java.awt.Color getSelectionForegroundColor()
          Returns the color used for drawing the foreground (text) of currently selected rows.
 int getSelectionMode()
          Returns the current selection mode (SINGLE_TREE_SELECTION, CONTIGUOUS_TREE_SELECTION, DISCONTIGUOUS_TREE_SELECTION).
 ITreeTableSelectionModel getSelectionModel()
          Returns the table's selection model.
 javax.swing.tree.TreePath getSelectionPath()
          Returns the current selection path.
 javax.swing.tree.TreePath[] getSelectionPaths()
          Returns the current selection paths.
 java.awt.Image getTexture()
          Returns the image that is being used to fill the background of the table with a texture.
 java.lang.String getToolTipText(java.awt.event.MouseEvent evt)
          Returns the text for a tooltip that is appropriate for the given mouse event and its location.
 javax.swing.tree.TreePath getTreePath(int row)
          Returns a tree path object for the given row.
 javax.swing.tree.TreePath[] getTreePaths(int[] rows)
          Returns an array of tree path objects for the given array of rows.
 TreeTableHeader getTreeTableHeader()
          Returns the Gantt chart's tree table header.
 TreeTableNode getTreeTableNodeAt(int y)
          Returns the tree table node for the given y-coordinate.
 TreeTableNode[] getTreeTableNodes()
          Returns the array that is storing the tree table nodes.
 TreeTableNode[] getTreeTableNodesBetween(int y1, int y2)
          Returns all nodes located on or between the two given y-coordinates.
 int getVisibleRowCount()
          Returns the number of rows currently shown in the visible part of the tree table.
 boolean isCellEditable(int row, int column)
          Returns TRUE if the cell at the given row and column is editable.
 boolean isCreationEnabled()
          Returns TRUE if the table allows the user to add new nodes to the tree table's data model.
 boolean isDraggingEnabled()
          Returns TRUE if the table supports drag & drop.
 boolean isEditing()
          Returns TRUE if a cell is currently being edited.
 boolean isHorizontalLinesVisible()
          Returns TRUE if the horizontal grid lines are currently visible.
 boolean isIndentEnabled()
          Returns TRUE if the user is allowed to manually change the indentation of tree nodes.
 boolean isPathSelected(javax.swing.tree.TreePath path)
          Returns TRUE if the given path is contained within the currently active selection.
 boolean isResizingEnabled()
          Returns TRUE if the table generally supports row resizing.
 boolean isRootVisible()
          Returns TRUE if the root object returned by the tree table model will be shown by the tree table.
 boolean isRowNumbersVisible()
          Returns TRUE if the row numbers are visible.
 boolean isRowSelected(int row)
          Returns TRUE if the given row is currently selected.
 boolean isTreeNodeExpanded(javax.swing.tree.TreePath path)
          Determines whether the tree node specified by the given tree path is exapanded (its children are visible).
 boolean isTreePathExpanded(javax.swing.tree.TreePath path)
          Determines whether the given tree path leads to an object where each of its parent objects is currently expanded (open node) in the tree table.
 boolean isVerticalLinesVisible()
          Returns TRUE if the vertical lines of the table's grid will be shown.
 void keyPressed(java.awt.event.KeyEvent e)
           
 void keyReleased(java.awt.event.KeyEvent e)
           
 void keyTyped(java.awt.event.KeyEvent e)
           
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseDragged(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
           
 void optimizeColumnWidth()
          Optimizes the column width of all columns without taking the cell editors into account.
 void optimizeColumnWidth(boolean includeEditors)
          Optimizes the column width of all columns with or without taking the cell editors into account.
 void optimizeColumnWidth(boolean includeEditors, int index)
          Optimizes the column width of all columns with or without taking the cell editors into account.
 void optimizeColumnWidth(boolean includeEditors, TreeTableColumn column, boolean keyColumn)
          Internal method that does the actual column width optimization.
 void optimizeColumnWidth(int index)
          Optimizes the column width of all columns without taking the cell editors into account.
protected  void paintBackground(java.awt.Graphics g)
          Paints the table's background.
protected  void paintCell(java.awt.Graphics g, TreeTableNode node, int x, int y, int width, int height, int row, int column, int modelIndex, java.lang.Class columnClass, boolean fillerColumn)
          Paints a single cell into the given graphics context for the given node and the given column.
protected  void paintColumn(java.awt.Graphics g, TreeTableColumn column, int row, int x, java.awt.Rectangle clip, boolean dragged, boolean filler)
          Draws a column into the given graphics context.
protected  void paintColumns(java.awt.Graphics g)
          Renders the columns.
protected  void paintComponent(java.awt.Graphics g)
          Renders the tree table user interface.
protected  void paintDragAndDrop(java.awt.Graphics g)
          Visualizes the drag and drop user operation.
 java.awt.Component prepareEditor(ITreeTableCellEditor editor, int row, int column, java.awt.event.InputEvent evt)
          Pepares the given tree table cell editor for editing the cell at the location row and column.
 void propertyChange(java.beans.PropertyChangeEvent evt)
           
 void removeEditor()
          Discards the editor object and frees the real estate it used for cell rendering.
 void removeSelectionInterval(int start, int end)
          Removes all rows within the given interval from the current selection.
 void removeSelectionPath(javax.swing.tree.TreePath path)
          Removes a path from the current selection.
 void removeSelectionPaths(javax.swing.tree.TreePath[] paths)
          Removes the given paths from the current selection.
 void removeTreeExpansionListener(javax.swing.event.TreeExpansionListener l)
          Removes a tree expansion listener.
 void removeTreeSelectionListener(javax.swing.event.TreeSelectionListener l)
          Removes a tree selection from the table.
 void removeTreeWillExpandListener(javax.swing.event.TreeWillExpandListener l)
          Removes a tree expansion listener.
 void scrollFocusToVisible()
          Scrolls the currently focused cell into the visible rectangle of the table's viewport.
 void scrollTo(int row)
          Scrolls the table inside its viewport so that the given row becomes visible.
 void scrollTo(javax.swing.tree.TreePath path)
          Scrolls the table inside its viewport so that the last path component becomes visible.
 void selectAll()
          Selects all tree paths of the currently visible nodes.
 void setAlpha(float alpha)
          Sets the alpha channel value (default is 1).
 void setAlternatingBackground(java.awt.Color color)
          Sets the alternating background color.
 void setAlternatingForeground(java.awt.Color color)
          Sets the alternating foreground color.
 void setCellEditor(java.lang.Class cl, ITreeTableCellEditor editor)
          Specifies a cell editor for the given object type.
 void setCellRenderer(java.lang.Class cl, ITreeTableCellRenderer renderer)
          Specifies a cell renderer for the given object type.
 void setColumnModel(IColumnModel model)
          Sets a new column model for the tree table.
 void setCreationEnabled(boolean enabled)
          Enables/disables the creation of nodes.
 void setDefaultRowHeight(int height)
          Sets a new default row height.
 void setDraggingEnabled(boolean enabled)
          Specifies whether or not the table supports drag & drop (DND).
 void setDropColorInvalid(java.awt.Color color)
          Sets the color that will be used to show where an invalid drop can occure.
 void setDropColorValid(java.awt.Color color)
          Sets the color that will be used to show where a valid drop can occure.
 void setEditingColumn(int col)
          Sets the column in which editing currently takes place.
 void setEditingRow(int row)
          Sets the row in which editing currently takes place.
 void setFocusColor(java.awt.Color color)
          Sets the color used for drawing the focus rectangle.
 void setGridColor(java.awt.Color color)
          Sets a new color used for drawing the vertical and horizontal lines of the table's grid.
 void setHorizontalLinesVisible(boolean visible)
          Specifies whether or not the horizontal grid lines are visible.
 void setIndentEnabled(boolean enabled)
          Enables/disables the user indentation feature.
 void setInset(int inset)
          Sets the number of pixels used to inset sub-nodes.
 void setLayerContainer(LayerContainer lc)
          Attaches a layer container to this table, which attaches itself as a mouse wheel listener to the layer container.
 void setMenuProvider(ITreeTableMenuProvider provider)
          Sets the menu provider used by the tree table to lookup a popup menu based on the location and context of the popup trigger event.
 void setModel(ITreeTableModel model)
          Sets a new tree table model.
 void setPolicyProvider(IPolicyProvider provider)
          Specifies a new policy provider to be used by the table to lookup policy implementations.
 void setRendererMap(java.util.Map<java.lang.Class,ITreeTableCellRenderer> map)
          Sets the map, which is storing the mappings between cell value types and tree table cell renderers.
 void setResizingEnabled(boolean enabled)
          Enables/disables row resizing.
 void setRootVisible(boolean visible)
          Specifies whether or not the root will be shown by the table.
 void setRowHeader(TreeTableRowHeader header)
          Sets the row header that was created by the component factory and that will be used to control the tree table (expanding / collapsing nodes, row height, selection, ...).
 void setRowNumbersVisible(boolean visible)
          Specifies whether or not the row numbers are visible.
 void setSelectionBackground(java.awt.Color color)
          Sets the color used for the background of currently selected rows.
 void setSelectionForegroundColor(java.awt.Color color)
          Sets the color used for the foreground of currently selected rows.
 void setSelectionInterval(int start, int end)
          Selects all rows within the given interval.
 void setSelectionMode(int mode)
          Sets the selection mode, which must be one of SINGLE_TREE_SELECTION, CONTIGUOUS_TREE_SELECTION or DISCONTIGUOUS_TREE_SELECTION.
 void setSelectionModel(ITreeTableSelectionModel model)
          Assigns a new selection model to the table.
 void setSelectionPath(javax.swing.tree.TreePath path)
          Sets the current selection to the given path.
 void setSelectionPaths(javax.swing.tree.TreePath[] paths)
          Sets the current selection to the given paths.
 void setSelectionRow(int row)
          Sets a new selection where the only row selected is the given one.
 void setSelectionRows(int[] rows)
          Sets a new selection with the given rows.
 void setTexture(java.awt.Image texture)
          Sets the image that is being used to fill the background of the table with a texture.
 void setVerticalLinesVisible(boolean visible)
          Determines whether the grid's vertical lines will be shown or not.
 void treeCollapsed(javax.swing.event.TreeExpansionEvent event)
           
 void treeExpanded(javax.swing.event.TreeExpansionEvent event)
           
 void treeNodeKeyChanged(TreeTableModelEvent e)
          Callback method that gets invoked if the user edited the key value of a tree table node.
 void treeNodesChanged(javax.swing.event.TreeModelEvent e)
           
 void treeNodesInserted(javax.swing.event.TreeModelEvent e)
           
 void treeNodesRemoved(javax.swing.event.TreeModelEvent e)
           
 void treeNodeValueChanged(TreeTableModelEvent e)
          Callback method that gets invoked if the user edited a column value of a tree table node.
 void treeStructureChanged(javax.swing.event.TreeModelEvent e)
           
 void treeWillCollapse(javax.swing.event.TreeExpansionEvent event)
           
 void treeWillExpand(javax.swing.event.TreeExpansionEvent event)
           
 void updateNodes()
          Updates the array of tree table nodes used by the table to store its current state.
 void updateUI()
          Overrides JComponent.updateUI() in order to initialize colors used for the background, foreground, and the selection of cells.
 void valueChanged(javax.swing.event.TreeSelectionEvent e)
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROPERTY_MODEL

public static final java.lang.String PROPERTY_MODEL
Constant used for the property change event that gets fired when the tree table model changes.

Since:
1.0
See Also:
setModel(ITreeTableModel), Constant Field Values

PROPERTY_SELECTION_MODEL

public static final java.lang.String PROPERTY_SELECTION_MODEL
Constant used for the property change event that gets fired when the selection model changes.

Since:
1.0
See Also:
setSelectionModel(ITreeTableSelectionModel), Constant Field Values

PROPERTY_ROOT_VISIBLE

public static final java.lang.String PROPERTY_ROOT_VISIBLE
Constant used for the property change event that gets fired when the visibility of the root node changes.

Since:
1.0
See Also:
setRootVisible(boolean), Constant Field Values

PROPERTY_HORIZONTAL_LINES_VISIBLE

public static final java.lang.String PROPERTY_HORIZONTAL_LINES_VISIBLE
Constant used for the property change event that gets fired when the visibility of the horizontal lines changes.

Since:
1.0
See Also:
setHorizontalLinesVisible(boolean), Constant Field Values

PROPERTY_VERTICAL_LINES_VISIBLE

public static final java.lang.String PROPERTY_VERTICAL_LINES_VISIBLE
Constant used for the property change event that gets fired when the visibility of the vertical lines changes.

Since:
1.0
See Also:
setVerticalLinesVisible(boolean), Constant Field Values

PROPERTY_ALT_FOREGROUND_COLOR

public static final java.lang.String PROPERTY_ALT_FOREGROUND_COLOR
Constant used for the property change event that gets fired when the alternating background color changes.

Since:
1.0
See Also:
setAlternatingForeground(Color), Constant Field Values

PROPERTY_ALT_BACKGROUND_COLOR

public static final java.lang.String PROPERTY_ALT_BACKGROUND_COLOR
Constant used for the property change event that gets fired when the alternating background color changes.

Since:
1.0
See Also:
setAlternatingBackground(Color), Constant Field Values

PROPERTY_ROW_NUMBERS_VISIBLE

public static final java.lang.String PROPERTY_ROW_NUMBERS_VISIBLE
Constant used for the property change event that gets fired when the visibility of the row numbers changes.

Since:
1.0
See Also:
setRowNumbersVisible(boolean), Constant Field Values

PROPERTY_SELECTION_BACKGROUND_COLOR

public static final java.lang.String PROPERTY_SELECTION_BACKGROUND_COLOR
Constant used for the property change event that gets fired when the selection background color changes.

Since:
1.0
See Also:
setSelectionBackground(Color), Constant Field Values

PROPERTY_SELECTION_FOREGROUND_COLOR

public static final java.lang.String PROPERTY_SELECTION_FOREGROUND_COLOR
Constant used for the property change event that gets fired when the selection foreground color changes.

Since:
1.0
See Also:
setSelectionForegroundColor(Color), Constant Field Values

PROPERTY_GRID_COLOR

public static final java.lang.String PROPERTY_GRID_COLOR
Constant used for the property change event that gets fired when the grid color changes.

Since:
1.0
See Also:
setGridColor(Color), Constant Field Values

PROPERTY_INDENT_ENABLED

public static final java.lang.String PROPERTY_INDENT_ENABLED
Constant used for the property change event that gets fired when the indentation feature gets enabled/disabled.

Since:
1.0
See Also:
setIndentEnabled(boolean), Constant Field Values

PROPERTY_DRAGGING_ENABLED

public static final java.lang.String PROPERTY_DRAGGING_ENABLED
Constant used for the property change event that gets fired when the drag & drop support gets enabled/disabled.

Since:
1.0
See Also:
setDraggingEnabled(boolean), Constant Field Values

PROPERTY_RESIZING_ENABLED

public static final java.lang.String PROPERTY_RESIZING_ENABLED
Constant used for the property change event that gets fired when the resizing support gets enabled/disabled.

Since:
1.0
See Also:
setResizingEnabled(boolean), Constant Field Values

PROPERTY_CREATION_ENABLED

public static final java.lang.String PROPERTY_CREATION_ENABLED
Constant used for the property change event that gets fired when the support for creating new nodes (directly inside the table) gets enabled or disabled.

Since:
1.0
See Also:
setCreationEnabled(boolean), Constant Field Values

PROPERTY_POLICY_PROVIDER

public static final java.lang.String PROPERTY_POLICY_PROVIDER
Constant used for the property change event that gets fired when the policy provider for the tree table gets replaced.

Since:
1.0
See Also:
setPolicyProvider(IPolicyProvider), Constant Field Values

PROPERTY_DEFAULT_ROW_HEIGHT

public static final java.lang.String PROPERTY_DEFAULT_ROW_HEIGHT
Constant used for the property change event that gets fired when the value for the default row height changes.

Since:
1.0
See Also:
setDefaultRowHeight(int), Constant Field Values
Constructor Detail

TreeTable

public TreeTable(AbstractGanttChart ganttChart,
                 ITreeTableModel model)
Constructs a new tree table. The table's policy provider gets initialized with the folling policies: DefaultNodeDragAndDropPolicy for drag and drop operations. DefaultNodeEditPolicy for creating, deleting and modifying tree nodes. DefaultRowPolicy for determining minimum and maximum row heights and for determining and editing actual row heights.

Parameters:
ganttChart - the Gantt chart that will contain the tree table as a child component
model - the tree table model that serves as a data source for the tree table
Since:
1.0
See Also:
IComponentFactory.createTreeTable(AbstractGanttChart, ITreeTableModel)
Method Detail

updateUI

public void updateUI()
Overrides JComponent.updateUI() in order to initialize colors used for the background, foreground, and the selection of cells.

Overrides:
updateUI in class javax.swing.JPanel
Since:
1.0
See Also:
JComponent.updateUI()

getGanttChart

public AbstractGanttChart getGanttChart()
Returns the parent Gantt chart of the table.

Returns:
the Gantt chart container for this table
Since:
1.0
See Also:
TreeTable(AbstractGanttChart, ITreeTableModel)

getModel

public ITreeTableModel getModel()
Returns the model that is being used as a data source for the tree table.

Returns:
the tree table's model
Since:
1.0
See Also:
setModel(ITreeTableModel)

getSelectionModel

public ITreeTableSelectionModel getSelectionModel()
Returns the table's selection model.

Returns:
the selection model
Since:
1.0
See Also:
setSelectionModel(ITreeTableSelectionModel)

setSelectionModel

public void setSelectionModel(ITreeTableSelectionModel model)
Assigns a new selection model to the table. When invoked this method will trigger a property change event where the property name will be equal to PROPERTY_SELECTION_MODEL.

Parameters:
model - the new selection model
Since:
1.0
See Also:
getSelectionModel()

setModel

public void setModel(ITreeTableModel model)
Sets a new tree table model. Invoking this method will trigger a property change event to be fired where the property name is equal to the constant PROPERTY_MODEL.

Parameters:
model - the new tree table model
Since:
1.0
See Also:
getModel()

setColumnModel

public void setColumnModel(IColumnModel model)
Sets a new column model for the tree table. The table will attach property change listeners to the table columns and a column model listener to the column model itself.

Parameters:
model - the new column model to use
Since:
1.0

getColumnModel

public IColumnModel getColumnModel()
Returns the tree table's column model.

Returns:
the table's / Gantt chart's column model
Since:
1.0

getKeyColumn

public KeyColumn getKeyColumn()
Returns the column model's key column. This is a convenience method delegating its call to AbstractGanttChart.getKeyColumn().

Returns:
the column model's key column
Since:
1.0

getColumn

public TreeTableColumn getColumn(int index)
Returns the column for the given index. This is a convenience method calling TreeTableHeader.getColumn(int).

Parameters:
index - the index of the column to return
Returns:
the column at the given index
Since:
1.0
See Also:
getKeyColumn(), getColumnIndex(TreeTableColumn)

getColumnIndex

public int getColumnIndex(TreeTableColumn col)
Returns the index of the given column. Note: this is not the column's model index. This method is a convenience method delegating its call to IColumnModel.getColumnIndex(TreeTableColumn).

Parameters:
col - the column for which to return the index
Returns:
the column's index
Since:
1.0

getColumnCount

public int getColumnCount()
Returns the number of columns in the column model. This method delegates to AbstractGanttChart.getColumnCount().

Returns:
the column count
Since:
1.0

getKeyColumnPosition

public int getKeyColumnPosition()
Returns the position of the key column in the table. This method delegates to AbstractGanttChart.getKeyColumnPosition().

Returns:
the position of the key column
Since:
1.0

setLayerContainer

public void setLayerContainer(LayerContainer lc)
Attaches a layer container to this table, which attaches itself as a mouse wheel listener to the layer container.

Parameters:
lc - the layer container to attach
Since:
1.0
See Also:
getLayerContainer()

getLayerContainer

public LayerContainer getLayerContainer()
Returns the layer container mapped to this table.

Returns:
the attached layer container
Since:
1.0
See Also:
getLayerContainer()

getCellEditor

public ITreeTableCellEditor getCellEditor(int row,
                                          int column)
Returns a cell editor for the given row and column. This method will call getCellEditor(Class) after it has determined the object type either based on an already existing cell value or by using the column class definied in TreeTableColumn.

Parameters:
row - the table row
column - the table column
Returns:
a cell edtior implementation for the given row and column
Since:
1.0
See Also:
DefaultTreeTableCellEditor, setCellEditor(Class, ITreeTableCellEditor)

setCreationEnabled

public void setCreationEnabled(boolean enabled)
Enables/disables the creation of nodes. If enabled the table will allow the user to use the row below the last tree node to add new nodes to the table's data model. This method will fire a property change event where the property name is equal to PROPERTY_CREATION_ENABLED.

Parameters:
enabled - if TRUE the table will allow the user to add new nodes
Since:
1.0
See Also:
isCreationEnabled()

isCreationEnabled

public boolean isCreationEnabled()
Returns TRUE if the table allows the user to add new nodes to the tree table's data model. Whether the table does allow the creation depends on the table's permission and the INodeEditPolicy.

Returns:
TRUE if the table supports the creation of new nodes
Since:
1.0
See Also:
setCreationEnabled(boolean), INodeEditPolicy.isCreateEnabled(ITreeTableModel)

isCellEditable

public boolean isCellEditable(int row,
                              int column)
Returns TRUE if the cell at the given row and column is editable. This method is a convenience method and eventually calls the policy method INodeEditPolicy.isValueEditable(Object, ITreeTableModel, int).

Parameters:
row - the table row
column - the table column
Returns:
TRUE if the cell at the given location (row, column) is editable
Since:
1.0

getEditingColumn

public int getEditingColumn()
Returns the column in which editing currently takes place.

Returns:
the column in which editing occures
Since:
1.0
See Also:
getEditingRow(), getEditorComponent()

setEditingColumn

public void setEditingColumn(int col)
Sets the column in which editing currently takes place.

Parameters:
col - the editing column
Since:
1.0
See Also:
getEditingColumn(), setEditingRow(int)

getEditingRow

public int getEditingRow()
Returns the row in which editing currently takes place.

Returns:
the editing row
Since:
1.0
See Also:
getEditingColumn(), getEditorComponent(), setEditingRow(int)

setEditingRow

public void setEditingRow(int row)
Sets the row in which editing currently takes place.

Parameters:
row - the editing row
Since:
1.0
See Also:
setEditingColumn(int), getEditingRow()

getCellRect

public java.awt.Rectangle getCellRect(int row,
                                      int column)
Returns the cell rectangle for the cell at the given row and column.

Parameters:
row - the row of the cell
column - the column of the cell
Returns:
the bounding box of the cell
Since:
1.0

editCellAt

public boolean editCellAt(int row,
                          int column)
Programmatically starts editing the cell at row and column, if those indices are in the valid range, and the cell at those indices is editable. Note that this is a convenience method for editCellAt(int, int, null).

Parameters:
row - the cell's row
column - the cell's column
Returns:
FALSE if for any reason the cell cannot be edited, or if the indices are invalid
Since:
1.0

getFocusedRow

public int getFocusedRow()
Returns the row of the focused cell. This method delegates its invokation to CellFocusManager.getFocusedRow().

Returns:
the focused row
Since:
1.0
See Also:
getFocusedColumn()

getFocusedColumn

public int getFocusedColumn()
Returns the column of the focused cell. This method delegates its invokation to CellFocusManager.getFocusedColumn().

Returns:
the focused column
Since:
1.0
See Also:
getFocusedRow()

editCellFocused

public boolean editCellFocused(java.awt.event.InputEvent evt)
Starts the editing of the currently focused table cell.

Parameters:
evt - the input event that triggered the editing
Returns:
TRUE if the cell can be edited
Since:
1.0
See Also:
editCellAt(int, int), editCellAt(int, int, InputEvent)

editCellAt

public boolean editCellAt(int row,
                          int column,
                          java.awt.event.InputEvent e)
Programmatically starts editing the cell at row and column, if those indices are in the valid range, and the cell at those indices is editable. To prevent the JTable from editing a particular table, column or cell value, return false from the isCellEditable method in the TableModel interface.

Parameters:
row - the row to be edited
column - the column to be edited
e - event to pass into shouldSelectCell; note that as of Java 2 platform v1.2, the call to shouldSelectCell is no longer made
Returns:
FALSE if for any reason the cell cannot be edited, or if the indices are invalid
Since:
1.0

removeEditor

public void removeEditor()
Discards the editor object and frees the real estate it used for cell rendering.

Since:
1.0
See Also:
getCellEditor()

getEditorComponent

public java.awt.Component getEditorComponent()
Returns the user interface component that is currently being used to edit a cell value.

Returns:
the user interface component
Since:
1.0

isEditing

public boolean isEditing()
Returns TRUE if a cell is currently being edited.

Returns:
TRUE if the user is currently editing a cell
Since:
1.0

getCellEditor

public ITreeTableCellEditor getCellEditor()
Returns the currently used cell editor. This is the editor that the table seemed most appropriate to use for editing the user selected table cell. The editor was chosen based on the object type of the current cell value or the class returned by TreeTableColumn.getColumnClass().

Returns:
the cell editor that is currently being used
Since:
1.0
See Also:
setCellEditor(Class, ITreeTableCellEditor), getCellEditor(Class)

prepareEditor

public java.awt.Component prepareEditor(ITreeTableCellEditor editor,
                                        int row,
                                        int column,
                                        java.awt.event.InputEvent evt)
Pepares the given tree table cell editor for editing the cell at the location row and column. The edit sequence was triggered by the given input event. The user interface component used for editing will be initialized with the cell's value.

Parameters:
editor - the editor to prepare for the next editing sequence
row - the cell's row
column - the cell's column
evt - the input event
Returns:
the user interface component to use for editing the cell
Since:
1.0

getTreeTableHeader

public TreeTableHeader getTreeTableHeader()
Returns the Gantt chart's tree table header.

Returns:
the column header
Since:
1.0

updateNodes

public void updateNodes()
Updates the array of tree table nodes used by the table to store its current state.

Since:
1.0

setInset

public void setInset(int inset)
Sets the number of pixels used to inset sub-nodes. Insetting nodes creates the visual impression of hierarchy. The inset has to be a positive number.

Parameters:
inset - the number of pixels used to inset nodes
Since:
1.0
See Also:
getInset()

getInset

public int getInset()
Returns the number of pixels used to inset sub-nodes.

Returns:
the number of pixels used to inset sub-nodes
Since:
1.0

addTreeExpansionListener

public void addTreeExpansionListener(javax.swing.event.TreeExpansionListener l)
Adds a tree expansion listener that will receive events after a tree node has been expanded.

Parameters:
l - the tree expansion listener
Since:
1.0
See Also:
addTreeWillExpandListener(TreeWillExpandListener)

removeTreeExpansionListener

public void removeTreeExpansionListener(javax.swing.event.TreeExpansionListener l)
Removes a tree expansion listener.

Parameters:
l - the listener to remove
Since:
1.0
See Also:
removeTreeWillExpandListener(TreeWillExpandListener)

addTreeWillExpandListener

public void addTreeWillExpandListener(javax.swing.event.TreeWillExpandListener l)
Adds a tree expansion listener that will be informed before a tree node expands.

Parameters:
l - the tree expansion listener
Since:
1.0
See Also:
removeTreeWillExpandListener(TreeWillExpandListener), addTreeExpansionListener(TreeExpansionListener)

removeTreeWillExpandListener

public void removeTreeWillExpandListener(javax.swing.event.TreeWillExpandListener l)
Removes a tree expansion listener.

Parameters:
l - the tree expansion listener
Since:
1.0
See Also:
addTreeWillExpandListener(TreeWillExpandListener)

addTreeSelectionListener

public void addTreeSelectionListener(javax.swing.event.TreeSelectionListener l)
Adds a tree selection listener to the table. This is a convenience method calling TreeSelectionModel.addTreeSelectionListener(javax.swing.event.TreeSelectionListener).

Parameters:
l - the tree selection listener
Since:
1.0
See Also:
removeTreeSelectionListener(TreeSelectionListener)

removeTreeSelectionListener

public void removeTreeSelectionListener(javax.swing.event.TreeSelectionListener l)
Removes a tree selection from the table.

Parameters:
l - the listener to remove
Since:
1.0
See Also:
addTreeSelectionListener(TreeSelectionListener)

fireTreeWillExpand

protected void fireTreeWillExpand(javax.swing.tree.TreePath path)
                           throws javax.swing.tree.ExpandVetoException
Fires a tree expansion event before a node expands. This allows listeners to throw an ExpandVetoException, thus terminating the node expansion.

Parameters:
path - the tree path that will get expanded
Throws:
javax.swing.tree.ExpandVetoException - if one of the tree expansion listeners threw an exception like this
Since:
1.0
See Also:
TreeExpansionEvent

fireTreeWillCollapse

protected void fireTreeWillCollapse(javax.swing.tree.TreePath path)
                             throws javax.swing.tree.ExpandVetoException
Fires a tree expansion event before a node collapses. This allows listeners to throw an ExpandVetoException, thus terminating the node collapse.

Parameters:
path - the tree path that will get collapsed
Throws:
javax.swing.tree.ExpandVetoException - if one of the tree expansion listeners threw an exception like this
Since:
1.0
See Also:
TreeExpansionEvent

fireTreeExpanded

protected void fireTreeExpanded(javax.swing.tree.TreePath path)
Fires a tree expansion event after a node expanded.

Parameters:
path - the tree path location of the node that got expanded
Since:
1.0
See Also:
TreeExpansionEvent

fireTreeCollapsed

protected void fireTreeCollapsed(javax.swing.tree.TreePath path)
Fires a tree expansion event after a node collapsed.

Parameters:
path - the tree path location of the node that got collapsed
Since:
1.0
See Also:
TreeExpansionEvent

setResizingEnabled

public void setResizingEnabled(boolean enabled)
Enables/disables row resizing. When enabled the user is allowed to resize rows individually or all at once (by holding down SHIFT). In addition to this flag the table also utilizes the IRowPolicy to determine whether or not a table row can indeed be resized and if so within which bounds (minimum, maximum height).

Parameters:
enabled - if TRUE the table generally supports row resizing
Since:
1.0

isResizingEnabled

public boolean isResizingEnabled()
Returns TRUE if the table generally supports row resizing. Whether or not a row can actually be resized depends on this method and the installed row policy (IRowPolicy), which returns minimum and maximum heights for each row.

Returns:
TRUE if the table supports row resizing
Since:
1.0
See Also:
setResizingEnabled(boolean), IRowPolicy.isRowResizable(Object, ITreeTableModel)

setDraggingEnabled

public void setDraggingEnabled(boolean enabled)
Specifies whether or not the table supports drag & drop (DND). If the table does support DND it will utilize the INodeDragAndDropPolicy to determine whether or not an individual tree node can be dragged and where it can be dropped. The method will trigger a property change event where the property name will be PROPERTY_DRAGGING_ENABLED.

Parameters:
enabled -
Since:
1.0
See Also:
isDraggingEnabled(), INodeDragAndDropPolicy.getDragActions(Object, ITreeTableModel), Object, ITreeTableModel, int), INodeDragAndDropPolicy.getDragAndDropCommand(Object, Object, ITreeTableModel, int, Object, ITreeTableModel, int, int)

isDraggingEnabled

public boolean isDraggingEnabled()
Returns TRUE if the table supports drag & drop.

Returns:
TRUE if drag & drop is supported
Since:
1.0
See Also:
setDraggingEnabled(boolean)

setIndentEnabled

public void setIndentEnabled(boolean enabled)
Enables/disables the user indentation feature. If enabled the user will be able to assign a node to a new parent node via mouse interaction. The method will trigger a property change event where the property name will be equal to PROPERTY_INDENT_ENABLED. Indentation is basically the same as a drag and drop operation where a tree node X gets dropped on the next node Y above itself where Y.getDepth() equals X.getDepth().

Parameters:
enabled -
Since:
1.0
See Also:
isIndentEnabled()

isIndentEnabled

public boolean isIndentEnabled()
Returns TRUE if the user is allowed to manually change the indentation of tree nodes.

Returns:
TRUE if user indentation is permitted
Since:
1.0
See Also:
setIndentEnabled(boolean)

getFirstVisibleRow

public int getFirstVisibleRow()
Returns the index of the first visible row based on the internal tree table node array used to store the state of the tree table. The method will determine the visible rectangle first and will then look up the row located at the rectangle's Y coordinate.

Returns:
the array index of the first visible row
Since:
1.0

getLastVisibleRow

public int getLastVisibleRow()
Returns the index of the last visible row based on the internal tree table node array used to store the state of the tree table. The method will determine the visible rectangle first and will then look up the row located at the rectangle's Y + HEIGHT coordinate.

Returns:
the array index of the last visible row
Since:
1.0

getRowCount

public int getRowCount()
Returns the total number of rows, which is equal to the length of the tree table nodes array.

Returns:
the total number of rows currently visible
Since:
1.0

selectAll

public void selectAll()
Selects all tree paths of the currently visible nodes.

Since:
1.0
See Also:
clearSelection(), addSelectionPath(TreePath), addSelectionRow(int)

clearSelection

public void clearSelection()
Clears the current tree table selection. This is a convenience method delegating its call to the selection model.

Since:
1.0
See Also:
selectAll(), addSelectionPath(TreePath), addSelectionRow(int)

setSelectionPath

public void setSelectionPath(javax.swing.tree.TreePath path)
Sets the current selection to the given path.

Parameters:
path - the new selection
Since:
1.0
See Also:
setSelectionRow(int), setSelectionPaths(TreePath[]), selectAll()

setSelectionPaths

public void setSelectionPaths(javax.swing.tree.TreePath[] paths)
Sets the current selection to the given paths.

Parameters:
paths - the new selection
Since:
1.0
See Also:
setSelectionPath(TreePath), setSelectionRows(int[]), selectAll()

addSelectionPath

public void addSelectionPath(javax.swing.tree.TreePath path)
Adds another path to the current selection. This is a convenience method delegating its call to the selection model.

Parameters:
path - another selected path
Since:
1.0
See Also:
setSelectionPath(TreePath), addSelectionPath(TreePath), clearSelection()

removeSelectionPath

public void removeSelectionPath(javax.swing.tree.TreePath path)
Removes a path from the current selection. This is a convenience method delegating its call to the selection model.

Parameters:
path - the path to remove
Since:
1.0
See Also:
removeSelectionInterval(int, int), clearSelection()

addSelectionPaths

public void addSelectionPaths(javax.swing.tree.TreePath[] paths)
Adds several paths at once to the selection model. This is a convenience method delegating its call to the selection model.

Parameters:
paths - the paths to add to the selection
Since:
1.0
See Also:
setSelectionPaths(TreePath[]), addSelectionInterval(int, int), addSelectionRows(int[]), selectAll()

removeSelectionPaths

public void removeSelectionPaths(javax.swing.tree.TreePath[] paths)
Removes the given paths from the current selection. This is a convenience method delegating its call to the selection model.

Parameters:
paths - the paths to remove
Since:
1.0
See Also:
removeSelectionInterval(int, int), clearSelection()

addSelectionRow

public void addSelectionRow(int row)
Adds a row to the current selection. This is a convenience method delegating its call to the selection model.

Parameters:
row - the row to add
Since:
1.0
See Also:
addSelectionInterval(int, int), addSelectionPath(TreePath), selectAll()

addSelectionRows

public void addSelectionRows(int[] rows)
Adds several rows at once to the selection model. This is a convenience method delegating its call to the selection model.

Parameters:
rows - the rows to add to the selection
Since:
1.0
See Also:
addSelectionPaths(TreePath[]), addSelectionInterval(int, int), selectAll()

setSelectionRow

public void setSelectionRow(int row)
Sets a new selection where the only row selected is the given one.

Parameters:
row - the new selection
Since:
1.0
See Also:
setSelectionRows(int[]), setSelectionPath(TreePath)

setSelectionRows

public void setSelectionRows(int[] rows)
Sets a new selection with the given rows.

Parameters:
rows - the new selection
Since:
1.0
See Also:
setSelectionRow(int), setSelectionPath(TreePath)

getSelectionPath

public javax.swing.tree.TreePath getSelectionPath()
Returns the current selection path. This is a convenience method delegating its call to the selection model.

Returns:
the currently selected path
Since:
1.0
See Also:
getSelectionPaths()

getSelectionPaths

public javax.swing.tree.TreePath[] getSelectionPaths()
Returns the current selection paths. This is a convenience method delegating its call to the selection model.

Returns:
the currently selected tree paths
Since:
1.0
See Also:
getSelectionPath()

setSelectionInterval

public void setSelectionInterval(int start,
                                 int end)
Selects all rows within the given interval. This method will internally convert the rows to tree paths and then call the selection model to set the paths as the new selection.

Parameters:
start - the start row to include in the selection
end - the end row to include in the selection
Since:
1.0
See Also:
setSelectionPaths(TreePath[]), setSelectionRows(int[])

addSelectionInterval

public void addSelectionInterval(int start,
                                 int end)
Adds all rows within the given interval to the current selection. This method will internally convert the rows to tree paths and then call the selection model to add the paths to the selection.

Parameters:
start - the start row to include in the selection
end - the end row to include in the selection
Since:
1.0
See Also:
addSelectionPaths(TreePath[]), addSelectionRows(int[])

removeSelectionInterval

public void removeSelectionInterval(int start,
                                    int end)
Removes all rows within the given interval from the current selection. This method will internally convert the rows to tree paths and then call the selection model to remove the paths from the selection.

Parameters:
start - the first row to remove from the current selection
end - the last row to remove from the current selection
Since:
1.0
See Also:
removeSelectionPaths(TreePath[])

isPathSelected

public boolean isPathSelected(javax.swing.tree.TreePath path)
Returns TRUE if the given path is contained within the currently active selection. This is a convenience method delegating its call to the selection model.

Parameters:
path - the tree path to check for selection
Returns:
TRUE if the given path is currently selected
Since:
1.0
See Also:
isRowSelected(int)

isRowSelected

public boolean isRowSelected(int row)
Returns TRUE if the given row is currently selected. This is a convenience method delegating its call to the selection model.

Parameters:
row - the row to check
Returns:
TRUE if the row is selected
Since:
1.0
See Also:
isPathSelected(TreePath)

setSelectionMode

public void setSelectionMode(int mode)
Sets the selection mode, which must be one of SINGLE_TREE_SELECTION, CONTIGUOUS_TREE_SELECTION or DISCONTIGUOUS_TREE_SELECTION. If mode is not one of the defined value, DISCONTIGUOUS_TREE_SELECTION is assumed. This may change the selection if the current selection is not valid for the new mode. For example, if three TreePaths are selected when the mode is changed to SINGLE_TREE_SELECTION, only one TreePath will remain selected. It is up to the particular implementation to decide what TreePath remains selected.

Setting the mode to something other than the defined types will result in the mode becoming DISCONTIGUOUS_TREE_SELECTION.

This is a convenience method delegating its call to the selection model.

Parameters:
mode - the selection model
Since:
1.0
See Also:
getSelectionMode()

getSelectionMode

public int getSelectionMode()
Returns the current selection mode (SINGLE_TREE_SELECTION, CONTIGUOUS_TREE_SELECTION, DISCONTIGUOUS_TREE_SELECTION).

Returns:
the current selection mode
Since:
1.0
See Also:
setSelectionMode(int)

getSelectionCount

public int getSelectionCount()
Returns the number of currently selected rows / tree nodes. This is a convenience method that is delegating its call to the selection model.

Returns:
the number of selected rows / tree nodes
Since:
1.0

getPathsBetweenRows

public javax.swing.tree.TreePath[] getPathsBetweenRows(int start,
                                                       int end)
Returns an array of tree paths that matches rows within the given interval. The start index doesn't have to be smaller or equal to the end index. The method will automatically choose the upper and the lower bounds of the interval.

Parameters:
start - the start row index
end - the end row index
Returns:
an array of tree paths (one path for each row)
Since:
1.0

isTreePathExpanded

public boolean isTreePathExpanded(javax.swing.tree.TreePath path)
Determines whether the given tree path leads to an object where each of its parent objects is currently expanded (open node) in the tree table.

Parameters:
path - the path to check
Returns:
TRUE if the path is currently fully expanded
Since:
1.0

isTreeNodeExpanded

public boolean isTreeNodeExpanded(javax.swing.tree.TreePath path)
Determines whether the tree node specified by the given tree path is exapanded (its children are visible).

Parameters:
path - the tree path leading to the node to check for its expansion state
Returns:
TRUE if the tree node specified by the given path is open (its children are visible)
Since:
1.0

getTreePath

public javax.swing.tree.TreePath getTreePath(int row)
Returns a tree path object for the given row.

Parameters:
row - the row for which to return a path
Returns:
a tree path for the given row
Since:
1.0
See Also:
getTreePaths(int[])

getTreePaths

public javax.swing.tree.TreePath[] getTreePaths(int[] rows)
Returns an array of tree path objects for the given array of rows.

Parameters:
rows - the row for which to return paths
Returns:
an array of tree paths for the given rows
Since:
1.0
See Also:
getTreePath(int)

containsPath

public boolean containsPath(javax.swing.tree.TreePath path)
Determines if the given tree path exists in the tree table.

Parameters:
path - the path to check
Returns:
TRUE if the given path is a valid path within the tree table
Since:
1.0

expandAll

public void expandAll()
Expands all tree nodes by starting at the root node, recursively traversing the tree hierarchy and calling TreeTableNode.expand() on each visited node.

Since:
1.0
See Also:
expandPath(TreePath), expandRow(int)

expandPath

public void expandPath(javax.swing.tree.TreePath path)
Expands the tree node that matches the given path.

Parameters:
path - the path of the tree node to expand
Since:
1.0
See Also:
expandAll(), expandRow(int)

expandRow

public void expandRow(int row)
Expands the tree node located in the given row.

Parameters:
row - the row to expand
Since:
1.0
See Also:
expandAll(), expandPath(TreePath)

collapseAll

public void collapseAll()
Collapses all tree nodes by starting at the root node, recursively traversing the tree hierarchy and calling TreeTableNode.collapse() on each visited node.

Since:
1.0
See Also:
collapsePath(TreePath), collapseRow(int)

collapsePath

public void collapsePath(javax.swing.tree.TreePath path)
Collapses the tree node that matches the given path.

Parameters:
path - the path of the tree node to collapse
Since:
1.0
See Also:
collapseAll(), collapseRow(int)

collapseRow

public void collapseRow(int row)
Collapses the tree node located in the given row.

Parameters:
row - the row to collapse
Since:
1.0
See Also:
collapseAll(), collapseRow(int)

getTreeTableNodes

public TreeTableNode[] getTreeTableNodes()
Returns the array that is storing the tree table nodes. These nodes are used to store the internal state of the tree table. It is a tree node that carries the information whether a node is currently open or not.

Returns:
the tree table node array used for storing the tree table's state
Since:
1.0

setGridColor

public void setGridColor(java.awt.Color color)
Sets a new color used for drawing the vertical and horizontal lines of the table's grid. This event will trigger a property change event where the event name is equal to PROPERTY_GRID_COLOR.

Parameters:
color - the color used for drawing the vertical and horizontal grid lines
Since:
1.0
See Also:
getGridColor()

getGridColor

public java.awt.Color getGridColor()
Returns the color used for drawing the vertical and horizontal lines of the grid.

Returns:
Color the grid color
Since:
1.0
See Also:
setGridColor(Color)

isHorizontalLinesVisible

public boolean isHorizontalLinesVisible()
Returns TRUE if the horizontal grid lines are currently visible.

Returns:
TRUE if the horizontal lines are visible
Since:
1.0
See Also:
setHorizontalLinesVisible(boolean)

setHorizontalLinesVisible

public void setHorizontalLinesVisible(boolean visible)
Specifies whether or not the horizontal grid lines are visible. This method will trigger a property change event where the event name is equal to PROPERTY_HORIZONTAL_LINES_VISIBLE.

Parameters:
visible - show/hide horizontal grid lines
Since:
1.0
See Also:
isHorizontalLinesVisible()

isRowNumbersVisible

public boolean isRowNumbersVisible()
Returns TRUE if the row numbers are visible.

Returns:
TRUE if the row numbers are visible
Since:
1.0
See Also:
setRowNumbersVisible(boolean)

setRowNumbersVisible

public void setRowNumbersVisible(boolean visible)
Specifies whether or not the row numbers are visible. This method will trigger a property change event where the property name will be equal to PROPERTY_ROW_NUMBERS_VISIBLE.

Parameters:
visible - show/hide row numbers
Since:
1.0
See Also:
isRowNumbersVisible()

isRootVisible

public boolean isRootVisible()
Returns TRUE if the root object returned by the tree table model will be shown by the tree table.

Returns:
TRUE if the root will be shown in the UI
Since:
1.0
See Also:
setRootVisible(boolean)

setRootVisible

public void setRootVisible(boolean visible)
Specifies whether or not the root will be shown by the table. This method will trigger a property change event where the property name is equal to PROPERTY_ROOT_VISIBLE.

Parameters:
visible -
Since:
1.0
See Also:
isRootVisible()

isVerticalLinesVisible

public boolean isVerticalLinesVisible()
Returns TRUE if the vertical lines of the table's grid will be shown.

Returns:
TRUE if the vertical lines will be shown
Since:
1.0
See Also:
setVerticalLinesVisible(boolean)

setVerticalLinesVisible

public void setVerticalLinesVisible(boolean visible)
Determines whether the grid's vertical lines will be shown or not. This method will trigger a property change event where the property name is equal to PROPERTY_VERTICAL_LINES_VISIBLE.

Parameters:
visible -
Since:
1.0
See Also:
isVerticalLinesVisible()

getAlternatingForeground

public java.awt.Color getAlternatingForeground()
Returns the alternating foreground color. Using an alternating color will make the table use two different foreground colors for odd and even rows. This greatly enhances the table's readability.

Returns:
the alternating row foreground color
Since:
1.0
See Also:
setAlternatingForeground(Color)

setAlternatingForeground

public void setAlternatingForeground(java.awt.Color color)
Sets the alternating foreground color. Using an alternating color will make the table use two different foreground colors for odd and even rows. This greatly enhances the table's readability. Calling this method will trigger a property change event where the property name is equal to PROPERTY_ALT_FOREGROUND_COLOR.

Parameters:
color - the alternating foreground color (second foreground color)
Since:
1.0
See Also:
getAlternatingForeground()

getAlternatingBackground

public java.awt.Color getAlternatingBackground()
Returns the alternating background color. Using an alternating color will make the table use two different background colors for odd and even rows. This greatly enhances the table's readability.

Returns:
the alternating row background color
Since:
1.0
See Also:
setAlternatingBackground(Color)

setAlternatingBackground

public void setAlternatingBackground(java.awt.Color color)
Sets the alternating background color. Using an alternating color will make the table use two different background colors for odd and even rows. This greatly enhances the table's readability. Calling this method will trigger a property change event where the property name is equal to PROPERTY_ALT_BACKGROUND_COLOR.

Parameters:
color - the alternating background color (second background color)
Since:
1.0
See Also:
getAlternatingBackground()

setSelectionBackground

public void setSelectionBackground(java.awt.Color color)
Sets the color used for the background of currently selected rows. Calling this method will trigger a property change event where the property name is equal to PROPERTY_SELECTION_BACKGROUND_COLOR.

Parameters:
color - the selection background color
Since:
1.0
See Also:
getSelectionBackground(), setSelectionForegroundColor(Color)

getSelectionBackground

public java.awt.Color getSelectionBackground()
Returns the color used for filling the background of currently selected rows.

Returns:
the selection background color
Since:
1.0
See Also:
setSelectionBackground(Color), getSelectionForegroundColor()

getSelectionForegroundColor

public java.awt.Color getSelectionForegroundColor()
Returns the color used for drawing the foreground (text) of currently selected rows.

Returns:
the selection background color
Since:
1.0
See Also:
setSelectionForegroundColor(Color), getSelectionBackground()

setSelectionForegroundColor

public void setSelectionForegroundColor(java.awt.Color color)
Sets the color used for the foreground of currently selected rows. Calling this method will trigger a property change event where the property name is equal to PROPERTY_SELECTION_FOREGROUND_COLOR.

Parameters:
color - the selection foreground color
Since:
1.0
See Also:
getSelectionForegroundColor(), setSelectionBackground(Color)

paintComponent

protected void paintComponent(java.awt.Graphics g)
Renders the tree table user interface. The method will call various other paint methods to draw the columns, the drag and drop operation, debug information. It will also resize the currently used editor component if needed.

Overrides:
paintComponent in class javax.swing.JComponent
Parameters:
g - the graphics context used for drawing
Since:
1.0
See Also:
paintColumns(Graphics), paintDragAndDrop(Graphics)

paintBackground

protected void paintBackground(java.awt.Graphics g)
Paints the table's background. This method is responsible for filling the background with either the background color or an optional texture. The method needs to take the alternating background color into account and the current selection state of a row. Vertical and horizontal lines are also drawn by this method.

Parameters:
g - the graphics context into which to draw
Since:
1.0
See Also:
getAlternatingBackground(), getBackground(int, boolean)

paintColumns

protected void paintColumns(java.awt.Graphics g)
Renders the columns. The table uses a left-to-right approach using an instance of ColumnModelIterator to iterate over the columns.

Parameters:
g - the graphics context used for drawing

paintColumn

protected void paintColumn(java.awt.Graphics g,
                           TreeTableColumn column,
                           int row,
                           int x,
                           java.awt.Rectangle clip,
                           boolean dragged,
                           boolean filler)
Draws a column into the given graphics context. The rendering will start with the given row and will stop once the bottom edge of the given clipping rectangle has been reached.

Parameters:
g - the graphics context used for drawing
column - the column to draw
row - the row where to start rendering
x - the column x-coordinate
clip - the clipping rectangle
dragged - TRUE if the column is the currently dragged column
filler - TRUE if the column is the filler column that always shows up on the very right side of the table
Since:
1.0

paintDragAndDrop

protected void paintDragAndDrop(java.awt.Graphics g)
Visualizes the drag and drop user operation. The method will ensure that the user interface communicates if the drop happens as an insert between two children of the same parent node or as an addition to the list of children of a new parent node. The method will also render the dragged node itself. This is done by rendering the key value at the current mouse location.

Parameters:
g - the graphics context used for drawing
Since:
1.0

paintCell

protected void paintCell(java.awt.Graphics g,
                         TreeTableNode node,
                         int x,
                         int y,
                         int width,
                         int height,
                         int row,
                         int column,
                         int modelIndex,
                         java.lang.Class columnClass,
                         boolean fillerColumn)
Paints a single cell into the given graphics context for the given node and the given column. The bounds of the cell are also being passed to the method.

Parameters:
g - the graphics context used for drawing
node - the node located in the cell's row
x - the x-coordinate of the cell bounds
y - the y-coordinate of the cell bounds
width - the width of the cell bounds
height - the height of the cell bounds
row - the row in which the cell is located
column - the column in which the cell is located
modelIndex - the model index used to lookup the column values
columnClass - the type of the objects shown in the given column
fillerColumn - TRUE if the column is the filler column that always shows up on the very right side of the table
Since:
1.0
See Also:
ITreeTableCellRenderer

getRowHeight

public int getRowHeight(int row)
Returns the height of the given row.

Parameters:
row - the row
Returns:
the height of the given row
Since:
1.0

getForeground

public java.awt.Color getForeground(int row,
                                    boolean includeSelection)
Returns the foreground color for the given row. If an alternating foreground color has been specified then this method will return it for any odd row number.

Parameters:
row - the row for which to determine the foreground color
includeSelection - if TRUE then the selection foreground color will be returned if the row is currently selected
Returns:
the foreground color to use for the give row
Since:
1.0

getForeground

public java.awt.Color getForeground(int row)
Returns the foreground color for the given row. If an alternating foreground color has been specified then this method will return it for any odd row number.

Parameters:
row - the row for which to determine the foreground color
Returns:
the foreground color to use for the give row
Since:
1.0
See Also:
getForeground(int, boolean)

getBackground

public java.awt.Color getBackground(int row,
                                    boolean includeSelection)
Returns the background color for the given row. If an alternating background color has been specified then this method will return it for any odd row number.

Parameters:
row - the row for which to determine the background color
includeSelection - if TRUE then the selection background color will be returned if the row is currently selected
Returns:
the background color to use for the give row
Since:
1.0

getBackground

public java.awt.Color getBackground(int row)
Returns the background color for the given row. If an alternating background color has been specified then this method will return it for any odd row number.

Parameters:
row - the row for which to determine the background color
Returns:
the background color to use for the give row
Since:
1.0
See Also:
getBackground(int, boolean)

getPreferredSize

public java.awt.Dimension getPreferredSize()
Returns the preferred size. The width is based on the preferred width of the column header and the height is based on the total height of all rows, which itself is based on the currently installed row policy.

Overrides:
getPreferredSize in class javax.swing.JComponent
Returns:
the preferred size of the table
Since:
1.0

scrollTo

public void scrollTo(int row)
Scrolls the table inside its viewport so that the given row becomes visible.

Parameters:
row - the row to make visible
Since:
1.0
See Also:
scrollFocusToVisible(), JComponent.scrollRectToVisible(Rectangle)

scrollTo

public void scrollTo(javax.swing.tree.TreePath path)
Scrolls the table inside its viewport so that the last path component becomes visible.

Parameters:
path - the path for which to show the last component
Since:
1.0
See Also:
scrollFocusToVisible(), JComponent.scrollRectToVisible(Rectangle), scrollTo(int)

scrollFocusToVisible

public void scrollFocusToVisible()
Scrolls the currently focused cell into the visible rectangle of the table's viewport. This method comes in handy when the user moves the focus onto a cell that is currently not visible.

Since:
1.0
See Also:
scrollTo(int), JComponent.scrollRectToVisible(Rectangle)

getColumnIndexAt

public int getColumnIndexAt(int x)
Returns the column at the given x-coordinate. This is a convenience method delegating its call to the column header.

Parameters:
x - the x-coordinate to check
Returns:
the column at the given x-coordinate
Since:
1.0
See Also:
TreeTableHeader.getColumn(int)

getRowAt

public int getRowAt(int y)
Returns the row for the given y-coordinate.

Parameters:
y - the y-coordinate of the row to return
Returns:
the row at the given location
Since:
1.0

getVisibleRowCount

public int getVisibleRowCount()
Returns the number of rows currently shown in the visible part of the tree table.

Returns:
the visible row count
Since:
1.0

getTreeTableNodeAt

public TreeTableNode getTreeTableNodeAt(int y)
Returns the tree table node for the given y-coordinate.

Parameters:
y - the y-coordinate
Returns:
the node at the given y-coordinate
Since:
1.0

getTreeTableNodesBetween

public TreeTableNode[] getTreeTableNodesBetween(int y1,
                                                int y2)
Returns all nodes located on or between the two given y-coordinates.

Parameters:
y1 - the start y-coordinate
y2 - the end y-coordinate
Returns:
all nodes between y1 and y2
Since:
1.0

treeNodeKeyChanged

public void treeNodeKeyChanged(TreeTableModelEvent e)
Description copied from interface: ITreeTableModelListener
Callback method that gets invoked if the user edited the key value of a tree table node.

Specified by:
treeNodeKeyChanged in interface ITreeTableModelListener
Parameters:
e - the event fired by the tree table model
See Also:
ITreeTableModelListener.treeNodeValueChanged(TreeTableModelEvent)

treeNodeValueChanged

public void treeNodeValueChanged(TreeTableModelEvent e)
Description copied from interface: ITreeTableModelListener
Callback method that gets invoked if the user edited a column value of a tree table node.

Specified by:
treeNodeValueChanged in interface ITreeTableModelListener
Parameters:
e - the event fired by the tree table model
See Also:
ITreeTableModelListener.treeNodeKeyChanged(TreeTableModelEvent)

treeNodesChanged

public void treeNodesChanged(javax.swing.event.TreeModelEvent e)
Specified by:
treeNodesChanged in interface javax.swing.event.TreeModelListener

treeNodesInserted

public void treeNodesInserted(javax.swing.event.TreeModelEvent e)
Specified by:
treeNodesInserted in interface javax.swing.event.TreeModelListener

treeNodesRemoved

public void treeNodesRemoved(javax.swing.event.TreeModelEvent e)
Specified by:
treeNodesRemoved in interface javax.swing.event.TreeModelListener

treeStructureChanged

public void treeStructureChanged(javax.swing.event.TreeModelEvent e)
Specified by:
treeStructureChanged in interface javax.swing.event.TreeModelListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

mouseWheelMoved

public void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
Specified by:
mouseWheelMoved in interface java.awt.event.MouseWheelListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

getToolTipText

public java.lang.String getToolTipText(java.awt.event.MouseEvent evt)
Returns the text for a tooltip that is appropriate for the given mouse event and its location. The method will first compute the node object and table column at the event location before querying the IRowPolicy for the actual text to display.

Overrides:
getToolTipText in class javax.swing.JComponent
Parameters:
evt - the mouse event
Returns:
the tooltip text for the given mouse location
Since:
1.0
See Also:
IRowPolicy.getRowToolTip(Object, ITreeTableModel, TreeTableColumn)

optimizeColumnWidth

public void optimizeColumnWidth()
Optimizes the column width of all columns without taking the cell editors into account. The width of the column will be the maximum width of the preferred widths of all cells in each column.

Since:
1.0
See Also:
optimizeColumnWidth(boolean, int)

optimizeColumnWidth

public void optimizeColumnWidth(boolean includeEditors)
Optimizes the column width of all columns with or without taking the cell editors into account. The width of the column will be the maximum width of the preferred widths of all cells in each column.

Parameters:
includeEditors - if TRUE the algorithm will take the preferred width of the cell editor for each cell into account
Since:
1.0
See Also:
optimizeColumnWidth(boolean, int)

optimizeColumnWidth

public void optimizeColumnWidth(int index)
Optimizes the column width of all columns without taking the cell editors into account. The width of the column will be the maximum width of the preferred widths of all cells in each column.

Parameters:
index - the width of the column with the given index will be optimized
Since:
1.0
See Also:
optimizeColumnWidth(boolean, int)

optimizeColumnWidth

public void optimizeColumnWidth(boolean includeEditors,
                                int index)
Optimizes the column width of all columns with or without taking the cell editors into account. The width of the column will be the maximum width of the preferred widths of all cells in each column.

Parameters:
includeEditors - if TRUE the algorithm will take the preferred width of the cell editor for each cell into account
index - the width of the column with the given index will be optimized
Since:
1.0
See Also:
optimizeColumnWidth(boolean, int)

optimizeColumnWidth

public void optimizeColumnWidth(boolean includeEditors,
                                TreeTableColumn column,
                                boolean keyColumn)
Internal method that does the actual column width optimization.

Parameters:
includeEditors - if TRUE the algorithm will take the preferred width of the cell editor for each cell into account
column - the column to optimize
keyColumn - if TRUE the given column is the key column

valueChanged

public void valueChanged(javax.swing.event.TreeSelectionEvent e)
Specified by:
valueChanged in interface javax.swing.event.TreeSelectionListener

getRowsForPaths

public int[] getRowsForPaths(javax.swing.tree.TreePath[] paths)
Specified by:
getRowsForPaths in interface javax.swing.tree.RowMapper

getRowForPath

public int getRowForPath(javax.swing.tree.TreePath path)
Returns the row for the given path.

Parameters:
path - the tree path for which to return the row
Returns:
the table row
Since:
1.0

commandStackChanged

public void commandStackChanged(CommandStackEvent evt)
Description copied from interface: ICommandStackListener
Gets called whenever the command stack changed. The event object that is passed to this method contains information about the type of event and a reference to the command that caused the event.

Specified by:
commandStackChanged in interface ICommandStackListener
Parameters:
evt - the event issued by the command stack

getColumnClass

public java.lang.Class getColumnClass(int columnIndex)
Returns the object type of the values shown in the column at the given index.

Parameters:
columnIndex - the column index
Returns:
the column's object type
Since:
1.0

editingStopped

public void editingStopped(javax.swing.event.ChangeEvent e)
Specified by:
editingStopped in interface javax.swing.event.CellEditorListener

editingCanceled

public void editingCanceled(javax.swing.event.ChangeEvent e)
Specified by:
editingCanceled in interface javax.swing.event.CellEditorListener

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener

treeExpanded

public void treeExpanded(javax.swing.event.TreeExpansionEvent event)
Specified by:
treeExpanded in interface javax.swing.event.TreeExpansionListener

treeCollapsed

public void treeCollapsed(javax.swing.event.TreeExpansionEvent event)
Specified by:
treeCollapsed in interface javax.swing.event.TreeExpansionListener

treeWillCollapse

public void treeWillCollapse(javax.swing.event.TreeExpansionEvent event)
Specified by:
treeWillCollapse in interface javax.swing.event.TreeWillExpandListener

treeWillExpand

public void treeWillExpand(javax.swing.event.TreeExpansionEvent event)
Specified by:
treeWillExpand in interface javax.swing.event.TreeWillExpandListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
Specified by:
keyTyped in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
Specified by:
keyReleased in interface java.awt.event.KeyListener

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
Specified by:
keyPressed in interface java.awt.event.KeyListener

getCellFocusManager

public CellFocusManager getCellFocusManager()
Returns the cell focus manager, a specialized class that only deals with managing the table's focus.

Returns:
the cell focus manager
Since:
1.0

focusGained

public void focusGained(java.awt.event.FocusEvent e)
Specified by:
focusGained in interface java.awt.event.FocusListener

focusLost

public void focusLost(java.awt.event.FocusEvent e)
Specified by:
focusLost in interface java.awt.event.FocusListener

getPolicyProvider

public IPolicyProvider getPolicyProvider()
Returns the policy provider used by the table to lookup policy implementations.

Returns:
the table's policy provider
Since:
1.0

setPolicyProvider

public void setPolicyProvider(IPolicyProvider provider)
Specifies a new policy provider to be used by the table to lookup policy implementations.

Parameters:
provider - the policy provider to be used by the table to lookup policy implementations
Since:
1.0

setDefaultRowHeight

public void setDefaultRowHeight(int height)
Sets a new default row height.

Parameters:
height - the default height used for rows
Since:
1.0
See Also:
getDefaultRowHeight()

getDefaultRowHeight

public int getDefaultRowHeight()
Returns the default row height that will be applied for such rows where the IRowPolicy is not used to determine the height.

Returns:
the default row height
Since:
1.0
See Also:
IRowPolicy.getRowHeight(Object, ITreeTableModel)

getRootNode

public TreeTableNode getRootNode()
The root node. To retrieve the actual data model root object call TreeTableNode.getModelNode() on the node.

Returns:
the root tree table node
Since:
1.0

getTexture

public java.awt.Image getTexture()
Returns the image that is being used to fill the background of the table with a texture. If no texture is specified the table will fill itself with the background color and (if specified) with the alternating background color.

Returns:
the background texture image
Since:
1.0
See Also:
setTexture(Image)

setTexture

public void setTexture(java.awt.Image texture)
Sets the image that is being used to fill the background of the table with a texture. If no texture is specified the table will fill itself with the background color and (if specified) with the alternating background color.

Parameters:
texture - the background texture image
Since:
1.0

getAlpha

public float getAlpha()
Returns the alpha channel value (default is 1). This value gets used for rows that are filled with the alternating background color and for the vertical and horizontal grid lines.

Returns:
the alpha channel value
Since:
1.0

setAlpha

public void setAlpha(float alpha)
Sets the alpha channel value (default is 1). This value gets used for rows that are filled with the alternating background color and for the vertical and horizontal grid lines.

Parameters:
alpha - the alpha channel value
Since:
1.0

columnModelChanged

public void columnModelChanged(ColumnModelEvent evt)
Description copied from interface: IColumnModelListener
The listener's callback method that will be invoked when columns get added, removed, inserted.

Specified by:
columnModelChanged in interface IColumnModelListener
Parameters:
evt - the event description

getFocusColor

public java.awt.Color getFocusColor()
Returns the color used for drawing the focus rectangle.

Returns:
the color for the focus rectangle
Since:
1.0

setFocusColor

public void setFocusColor(java.awt.Color color)
Sets the color used for drawing the focus rectangle.

Parameters:
color - the color used for the focus rectangle
Since:
1.0

getMenuProvider

public ITreeTableMenuProvider getMenuProvider()
Returns the menu provider used by the tree table to lookup a popup menu based on the location and context of the popup trigger event.

Returns:
the table's menu provider
Since:
1.0

setMenuProvider

public void setMenuProvider(ITreeTableMenuProvider provider)
Sets the menu provider used by the tree table to lookup a popup menu based on the location and context of the popup trigger event.

Parameters:
provider - the table's menu provider
Since:
1.0

setCellRenderer

public void setCellRenderer(java.lang.Class cl,
                            ITreeTableCellRenderer renderer)
Specifies a cell renderer for the given object type. Cell renderers are used during the rendering of the tree table component. Different cell renderers can be used for different table cells, depending on the type of object shown in that cell. If no object is shown (NULL value) the column class as defined by TreeTableColumn.getColumnClass() will be used to look up a renderer.

Parameters:
cl - the object type
renderer - the renderer used to visualize objects of the given type
Since:
1.0
See Also:
getCellRenderer(Class)

setCellEditor

public void setCellEditor(java.lang.Class cl,
                          ITreeTableCellEditor editor)
Specifies a cell editor for the given object type. Cell editors are used for editing the values of table cells. Different cell editors can be used for different table cells, depending on the type of object shown in that cell. If no object is shown (NULL value) the column class as defined by TreeTableColumn.getColumnClass() will be used to look up an editor.

Parameters:
cl - the object type
editor - the editor used to edit objects of the given type
Since:
1.0
See Also:
getCellEditor(Class)

getCellRenderer

public ITreeTableCellRenderer getCellRenderer(java.lang.Class cl)
Returns a cell renderer for the given object type. Cell renderers are used during the rendering of the tree table component. Different cell renderers can be used for different table cells, depending on the type of object shown in that cell. If no object is shown (NULL value) the column class as defined by TreeTableColumn.getColumnClass() will be used to look up a renderer.

Parameters:
cl - the object type for which to return a matching cell renderer
Returns:
a cell renderer for the given object type
Since:
1.0
See Also:
setCellRenderer(Class, ITreeTableCellRenderer)

getCellEditor

public ITreeTableCellEditor getCellEditor(java.lang.Class cl)
Returns a cell editor for the given object type. Cell editors are used for editing the values in table cells. Different cell editors can be used for different table cells, depending on the type of object shown in that cell. If no object is shown (NULL value) the column class as defined by TreeTableColumn.getColumnClass() will be used to look up an edtior.

Parameters:
cl - the object type for which to return a matching cell editor
Returns:
a cell editor for the given object type
Since:
1.0
See Also:
setCellEditor(Class, ITreeTableCellEditor)

getRendererMap

public java.util.Map<java.lang.Class,ITreeTableCellRenderer> getRendererMap()
Returns the map, which is storing the mappings between cell value types and tree table cell renderers.

Returns:
the renderer map
Since:
1.0

setRendererMap

public void setRendererMap(java.util.Map<java.lang.Class,ITreeTableCellRenderer> map)
Sets the map, which is storing the mappings between cell value types and tree table cell renderers.

Parameters:
map - the renderer map
Since:
1.0

getRowHeader

public TreeTableRowHeader getRowHeader()
Returns the row header that was created by the component factory and that will be used to control the tree table (expanding / collapsing nodes, row height, selection, ...).

Returns:
the row header used for the tree table
Since:
1.0

setRowHeader

public void setRowHeader(TreeTableRowHeader header)
Sets the row header that was created by the component factory and that will be used to control the tree table (expanding / collapsing nodes, row height, selection, ...).

Parameters:
header - the row header used for the tree table
Since:
1.0

autoscroll

public void autoscroll(java.awt.Point cursorLocn)
Specified by:
autoscroll in interface java.awt.dnd.Autoscroll

getAutoscrollInsets

public java.awt.Insets getAutoscrollInsets()
Specified by:
getAutoscrollInsets in interface java.awt.dnd.Autoscroll

getRendererPane

public javax.swing.CellRendererPane getRendererPane()
Returns the renderer pane used by the tree table to render the tree table cell renderers.

Returns:
the renderer pane of the tree table
Since:
1.0

getDragAndDropManager

public TreeTableDragAndDropManager getDragAndDropManager()
Returns the drag and drop manager used by the tree table to control its drag and drop capabilities.

Returns:
the DnD manager of the tree table
Since:
1.0

createDragAndDropManager

protected TreeTableDragAndDropManager createDragAndDropManager()
Creates the drag and drop manager (DnD manager) that will be used to control the tree table's drag and drop operations.

Returns:
the DnD manager of the tree table
Since:
1.0

animateDropPath

public void animateDropPath(javax.swing.tree.TreePath path)
Causes a fade-in effect for the given path, which gets used by the DnD manager to visualize where a node is located after a drop.

Parameters:
path - the path to animate
Since:
1.0

getDropColorValid

public java.awt.Color getDropColorValid()
Returns the color that will be used to show where a valid drop can occure.

Returns:
the 'valid drop' color
Since:
1.0

setDropColorValid

public void setDropColorValid(java.awt.Color color)
Sets the color that will be used to show where a valid drop can occure.

Parameters:
color - the 'valid drop' color
Since:
1.0

getDropColorInvalid

public java.awt.Color getDropColorInvalid()
Returns the color that will be used to show where an invalid drop can occure.

Returns:
the 'invalid drop' color
Since:
1.0

setDropColorInvalid

public void setDropColorInvalid(java.awt.Color color)
Sets the color that will be used to show where an invalid drop can occure.

Parameters:
color - the 'invalid drop' color
Since:
1.0