grendel.widgets
Class TreeTable

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--grendel.widgets.TreeTable

public class TreeTable
extends javax.swing.JComponent
implements javax.swing.Scrollable, DropTargetComponent

A outliner view similar to those used in previous versions of mail and news.

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
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
 
Constructor Summary
TreeTable(TreeTableDataModel aDataModel)
          Constructs a TreeTable with the given data model.
 
Method Summary
 void addColumn(Column aColumn)
          Adds a column to the tree table.
 void addColumnAt(Column aColumn, int aIndex)
          Adds a column at the given position.
 void ensureVisible(TreePath aPath)
           
 boolean getAutoscrolls()
           
 TreePath getCaret()
          Returns the last object on which the user clicked.
 ColumnHeader getColumnHeader()
          Returns the ColumnHeader widget that allows the user to view and manipulate column properties.
 ColumnModel getColumnModel()
          Retuns the column model
 int getColumnX(Column column)
           
 TreeTableDataModel getDataModel()
          Returns the current data model.
 DropTarget getGrendelDropTarget()
           
 int getIndentLevel()
          Returns the number of pixels each level of the tree is indented.
 java.awt.Dimension getMaximumSize()
           
 java.awt.Dimension getMinimumSize()
           
 int getNodeHeight(TreePath aPath)
           
 int getNodeY(TreePath aPath)
          Returns the Y location of the give node
 java.awt.Dimension getPreferredScrollableViewportSize()
           
 java.awt.Dimension getPreferredSize()
           
 int getRowHeight()
          Returns the fixed row height
 int getRowMargin()
          Does nothing, yet.
 int getScrollableBlockIncrement(java.awt.Rectangle aVisible, int aOrient, int aDirection)
           
 boolean getScrollableTracksViewportHeight()
           
 boolean getScrollableTracksViewportWidth()
           
 int getScrollableUnitIncrement(java.awt.Rectangle aVisible, int aOrient, int aDirection)
           
 SelectionManager getSelectionManager()
          Returns the interface for the tree table's selection manager
 java.awt.Point getToolTipLocation(java.awt.event.MouseEvent aEvent)
           
 java.lang.String getToolTipText(java.awt.event.MouseEvent aEvent)
           
 java.lang.Object getTreeColumn()
          Returns which column in which the tree indention and (eventually) icons appear.
 boolean isFixedHeight()
          Returns whether all rows have the same height.
 boolean isOpaque()
           
 boolean isVisible(TreePath aPath)
          Returns whether or not the give path is visible.
 void navigateDown()
          Moves the caret down one position, and selects that object.
 void navigateUp()
          Moves the caret up one position, and selects that object.
 void paintComponent(java.awt.Graphics g)
           
 void reload()
          Forces the tree to rebuild itself from scratch.
 void repaint(TreePath aPath)
           
 void repaintFrom(TreePath aPath)
           
 void select(TreePath aPath)
          Selects the given TreePath.
 void setCaret(TreePath aPath)
          Sets the last object on which the user clicked.
 void setDataModel(TreeTableDataModel aDataModel)
          Sets the current data model.
 void setDropTarget(DropTarget dt)
           
 void setFixedHeight(boolean aFixed)
          Sets whether all rows have the same height.
 void setIndentLevel(int aIndent)
          Sets the number of pixels each level of the tree is indented (16 or more is currently recommended.)
 void setRowHeight(int aHeight)
          Sets a fixed row height.
 void setRowMargin(int aMargin)
          Does nothing, yet.
 void setTreeColumn(java.lang.Object aID)
          Sets which column in which the tree indention and (eventually) icons appear.
 void updateUI()
           
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getAlignmentX, getAlignmentY, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInsets, getInsets, getLocation, getNextFocusableComponent, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipText, getTopLevelAncestor, getUIClassID, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, processComponentKeyEvent, processFocusEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hide, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TreeTable

public TreeTable(TreeTableDataModel aDataModel)
Constructs a TreeTable with the given data model.
Method Detail

setDataModel

public void setDataModel(TreeTableDataModel aDataModel)
Sets the current data model. A null value (should be) acceptable.

getDataModel

public TreeTableDataModel getDataModel()
Returns the current data model.
See Also:
TreeTableDataModel

getColumnModel

public ColumnModel getColumnModel()
Retuns the column model
See Also:
ColumnModel

addColumn

public void addColumn(Column aColumn)
Adds a column to the tree table. The column is added at the end.

addColumnAt

public void addColumnAt(Column aColumn,
                        int aIndex)
Adds a column at the given position. Existing columns may be shifted to the right.

getColumnHeader

public ColumnHeader getColumnHeader()
Returns the ColumnHeader widget that allows the user to view and manipulate column properties.

getCaret

public TreePath getCaret()
Returns the last object on which the user clicked. This object is used for keyboard navigation.

setCaret

public void setCaret(TreePath aPath)
Sets the last object on which the user clicked. This object is used for keyboard navigation.

getSelectionManager

public SelectionManager getSelectionManager()
Returns the interface for the tree table's selection manager

setTreeColumn

public void setTreeColumn(java.lang.Object aID)
Sets which column in which the tree indention and (eventually) icons appear.

getTreeColumn

public java.lang.Object getTreeColumn()
Returns which column in which the tree indention and (eventually) icons appear.

setIndentLevel

public void setIndentLevel(int aIndent)
Sets the number of pixels each level of the tree is indented (16 or more is currently recommended.)

getIndentLevel

public int getIndentLevel()
Returns the number of pixels each level of the tree is indented.

setRowHeight

public void setRowHeight(int aHeight)
Sets a fixed row height. Overrides the per-row sizing feature. A height of 0 enables the per-row sizing feature.

getRowHeight

public int getRowHeight()
Returns the fixed row height
See Also:
setRowHeight()

setFixedHeight

public void setFixedHeight(boolean aFixed)
Sets whether all rows have the same height. Saves a tremendous amount of time if true. Defaults to true.
See Also:
isFixedHeight()

isFixedHeight

public boolean isFixedHeight()
Returns whether all rows have the same height. Saves a tremendous amount of time if true.
See Also:
setFixedHeight()

setRowMargin

public void setRowMargin(int aMargin)
Does nothing, yet.

getRowMargin

public int getRowMargin()
Does nothing, yet.

select

public void select(TreePath aPath)
Selects the given TreePath.

navigateUp

public void navigateUp()
Moves the caret up one position, and selects that object. (currently doesn't support scrolling)

navigateDown

public void navigateDown()
Moves the caret down one position, and selects that object. (currently doesn't support scrolling)

isVisible

public boolean isVisible(TreePath aPath)
Returns whether or not the give path is visible. If the path points to the root, and the root is not shown, the method still returns true.

ensureVisible

public void ensureVisible(TreePath aPath)

getNodeY

public int getNodeY(TreePath aPath)
Returns the Y location of the give node

getNodeHeight

public int getNodeHeight(TreePath aPath)

getColumnX

public int getColumnX(Column column)

reload

public void reload()
Forces the tree to rebuild itself from scratch. Doesn't repaint.

paintComponent

public void paintComponent(java.awt.Graphics g)
Overrides:
paintComponent in class javax.swing.JComponent

repaint

public void repaint(TreePath aPath)

repaintFrom

public void repaintFrom(TreePath aPath)

getPreferredSize

public java.awt.Dimension getPreferredSize()
Overrides:
getPreferredSize in class javax.swing.JComponent

getMaximumSize

public java.awt.Dimension getMaximumSize()
Overrides:
getMaximumSize in class javax.swing.JComponent

getMinimumSize

public java.awt.Dimension getMinimumSize()
Overrides:
getMinimumSize in class javax.swing.JComponent

updateUI

public void updateUI()
Overrides:
updateUI in class javax.swing.JComponent

isOpaque

public boolean isOpaque()
Overrides:
isOpaque in class javax.swing.JComponent

getAutoscrolls

public boolean getAutoscrolls()
Overrides:
getAutoscrolls in class javax.swing.JComponent

getToolTipLocation

public java.awt.Point getToolTipLocation(java.awt.event.MouseEvent aEvent)
Overrides:
getToolTipLocation in class javax.swing.JComponent

getToolTipText

public java.lang.String getToolTipText(java.awt.event.MouseEvent aEvent)
Overrides:
getToolTipText in class javax.swing.JComponent

getPreferredScrollableViewportSize

public java.awt.Dimension getPreferredScrollableViewportSize()
Specified by:
getPreferredScrollableViewportSize in interface javax.swing.Scrollable

getScrollableBlockIncrement

public int getScrollableBlockIncrement(java.awt.Rectangle aVisible,
                                       int aOrient,
                                       int aDirection)
Specified by:
getScrollableBlockIncrement in interface javax.swing.Scrollable

getScrollableUnitIncrement

public int getScrollableUnitIncrement(java.awt.Rectangle aVisible,
                                      int aOrient,
                                      int aDirection)
Specified by:
getScrollableUnitIncrement in interface javax.swing.Scrollable

getScrollableTracksViewportHeight

public boolean getScrollableTracksViewportHeight()
Specified by:
getScrollableTracksViewportHeight in interface javax.swing.Scrollable

getScrollableTracksViewportWidth

public boolean getScrollableTracksViewportWidth()
Specified by:
getScrollableTracksViewportWidth in interface javax.swing.Scrollable

setDropTarget

public void setDropTarget(DropTarget dt)
                   throws java.lang.IllegalArgumentException
Specified by:
setDropTarget in interface DropTargetComponent

getGrendelDropTarget

public DropTarget getGrendelDropTarget()
Specified by:
getGrendelDropTarget in interface DropTargetComponent