org.jvnet.substance
Class SubstanceTreeUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by javax.swing.plaf.TreeUI
          extended by javax.swing.plaf.basic.BasicTreeUI
              extended by org.jvnet.substance.SubstanceTreeUI

public class SubstanceTreeUI
extends javax.swing.plaf.basic.BasicTreeUI

UI for lists in Substance look and feel.

Author:
Kirill Grouchnikov

Nested Class Summary
protected  class SubstanceTreeUI.MyTreeSelectionListener
          Selection listener for selection animation effects.
protected  class SubstanceTreeUI.PathRepaintCallback
          Repaints a single path during the fade animation cycle.
static class SubstanceTreeUI.TreePathId
          ID of a single tree path.
 
Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicTreeUI
javax.swing.plaf.basic.BasicTreeUI.CellEditorHandler, javax.swing.plaf.basic.BasicTreeUI.ComponentHandler, javax.swing.plaf.basic.BasicTreeUI.FocusHandler, javax.swing.plaf.basic.BasicTreeUI.KeyHandler, javax.swing.plaf.basic.BasicTreeUI.MouseHandler, javax.swing.plaf.basic.BasicTreeUI.MouseInputHandler, javax.swing.plaf.basic.BasicTreeUI.NodeDimensionsHandler, javax.swing.plaf.basic.BasicTreeUI.PropertyChangeHandler, javax.swing.plaf.basic.BasicTreeUI.SelectionModelPropertyChangeHandler, javax.swing.plaf.basic.BasicTreeUI.TreeCancelEditingAction, javax.swing.plaf.basic.BasicTreeUI.TreeExpansionHandler, javax.swing.plaf.basic.BasicTreeUI.TreeHomeAction, javax.swing.plaf.basic.BasicTreeUI.TreeIncrementAction, javax.swing.plaf.basic.BasicTreeUI.TreeModelHandler, javax.swing.plaf.basic.BasicTreeUI.TreePageAction, javax.swing.plaf.basic.BasicTreeUI.TreeSelectionHandler, javax.swing.plaf.basic.BasicTreeUI.TreeToggleAction, javax.swing.plaf.basic.BasicTreeUI.TreeTraverseAction
 
Field Summary
protected  SubstanceTreeUI.TreePathId currRolloverPathId
          Holds the currently rolled-over path or null if none such.
protected  java.util.Map<SubstanceTreeUI.TreePathId,java.lang.Object> selectedPaths
          Holds the list of currently selected paths.
protected  org.jvnet.substance.SubstanceTreeUI.RolloverFadeListener substanceFadeRolloverListener
          Listener for fade animations on tree rollovers.
protected  java.beans.PropertyChangeListener substancePropertyChangeListener
          Listener that listens to changes on tree properties.
protected  java.awt.event.MouseListener substanceRowSelectionListener
          Listener for selection of an entire row.
protected  javax.swing.event.TreeSelectionListener substanceSelectionFadeListener
          Listener for selection animations.
 
Fields inherited from class javax.swing.plaf.basic.BasicTreeUI
cellEditor, collapsedIcon, createdCellEditor, createdRenderer, currentCellRenderer, depthOffset, drawingCache, editingComponent, editingPath, editingRow, editorHasDifferentSize, expandedIcon, largeModel, lastSelectedRow, leftChildIndent, nodeDimensions, preferredMinSize, preferredSize, rendererPane, rightChildIndent, stopEditingInCompleteEditing, totalChildIndent, tree, treeModel, treeSelectionModel, treeState, validCachedPreferredSize
 
Constructor Summary
SubstanceTreeUI()
          Creates a UI delegate for tree.
 
Method Summary
protected  javax.swing.tree.TreeCellRenderer createDefaultCellRenderer()
           
static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent comp)
           
 java.awt.Insets getCellRendererInsets()
          Returns the cell renderer insets of this tree.
 SubstanceColorScheme getDefaultColorScheme()
          Returns the default color scheme of this tree.
 ComponentState getPathState(SubstanceTreeUI.TreePathId pathId)
          Returns the current state for the specified path.
 int getPivotRendererX(java.awt.Rectangle paintBounds)
          Returns the pivot X for the cells rendered in the specified area.
 ComponentState getPrevPathState(SubstanceTreeUI.TreePathId pathId)
          Returns the previous state for the specified path.
protected  void installDefaults()
           
protected  void installListeners()
           
protected  void paintExpandControl(java.awt.Graphics g, java.awt.Rectangle clipBounds, java.awt.Insets insets, java.awt.Rectangle bounds, javax.swing.tree.TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)
           
protected  void paintExpandControlEnforce(java.awt.Graphics g, java.awt.Rectangle clipBounds, java.awt.Insets insets, java.awt.Rectangle bounds, javax.swing.tree.TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)
          Paints the expand control of the specified row.
protected  void paintHorizontalPartOfLeg(java.awt.Graphics g, java.awt.Rectangle clipBounds, java.awt.Insets insets, java.awt.Rectangle bounds, javax.swing.tree.TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)
           
protected  void paintRow(java.awt.Graphics g, java.awt.Rectangle clipBounds, java.awt.Insets insets, java.awt.Rectangle bounds, javax.swing.tree.TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)
           
protected  void paintVerticalPartOfLeg(java.awt.Graphics g, java.awt.Rectangle clipBounds, java.awt.Insets insets, javax.swing.tree.TreePath path)
           
protected  void uninstallDefaults()
           
protected  void uninstallListeners()
           
 void update(java.awt.Graphics g, javax.swing.JComponent c)
           
 
Methods inherited from class javax.swing.plaf.basic.BasicTreeUI
cancelEditing, checkForClickInExpandControl, completeEditing, completeEditing, completeUIInstall, completeUIUninstall, configureLayoutCache, createCellEditorListener, createCellRendererPane, createComponentListener, createDefaultCellEditor, createFocusListener, createKeyListener, createLayoutCache, createMouseListener, createNodeDimensions, createPropertyChangeListener, createSelectionModelPropertyChangeListener, createTreeExpansionListener, createTreeModelListener, createTreeSelectionListener, drawCentered, drawDashedHorizontalLine, drawDashedVerticalLine, ensureRowsAreVisible, getBaseline, getBaselineResizeBehavior, getCellEditor, getCellRenderer, getClosestPathForLocation, getCollapsedIcon, getEditingPath, getExpandedIcon, getHashColor, getHorizontalLegBuffer, getLastChildPath, getLeftChildIndent, getMaximumSize, getMinimumSize, getModel, getPathBounds, getPathForRow, getPreferredMinSize, getPreferredSize, getPreferredSize, getRightChildIndent, getRowCount, getRowForPath, getRowHeight, getRowX, getSelectionModel, getShowsRootHandles, getVerticalLegBuffer, handleExpandControlClick, installComponents, installKeyboardActions, installUI, isEditable, isEditing, isLargeModel, isLeaf, isLocationInExpandControl, isMultiSelectEvent, isRootVisible, isToggleEvent, isToggleSelectionEvent, paint, paintHorizontalLine, paintVerticalLine, pathWasCollapsed, pathWasExpanded, prepareForUIInstall, prepareForUIUninstall, selectPathForEvent, setCellEditor, setCellRenderer, setCollapsedIcon, setEditable, setExpandedIcon, setHashColor, setLargeModel, setLeftChildIndent, setModel, setPreferredMinSize, setRightChildIndent, setRootVisible, setRowHeight, setSelectionModel, setShowsRootHandles, shouldPaintExpandControl, startEditing, startEditingAtPath, stopEditing, toggleExpandState, uninstallComponents, uninstallKeyboardActions, uninstallUI, updateCachedPreferredSize, updateCellEditor, updateDepthOffset, updateExpandedDescendants, updateLayoutCacheExpandedNodes, updateRenderer, updateSize
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

selectedPaths

protected java.util.Map<SubstanceTreeUI.TreePathId,java.lang.Object> selectedPaths
Holds the list of currently selected paths.


currRolloverPathId

protected SubstanceTreeUI.TreePathId currRolloverPathId
Holds the currently rolled-over path or null if none such.


substancePropertyChangeListener

protected java.beans.PropertyChangeListener substancePropertyChangeListener
Listener that listens to changes on tree properties.


substanceSelectionFadeListener

protected javax.swing.event.TreeSelectionListener substanceSelectionFadeListener
Listener for selection animations.


substanceFadeRolloverListener

protected org.jvnet.substance.SubstanceTreeUI.RolloverFadeListener substanceFadeRolloverListener
Listener for fade animations on tree rollovers.


substanceRowSelectionListener

protected java.awt.event.MouseListener substanceRowSelectionListener
Listener for selection of an entire row.

Constructor Detail

SubstanceTreeUI

public SubstanceTreeUI()
Creates a UI delegate for tree.

Method Detail

createUI

public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent comp)

installDefaults

protected void installDefaults()
Overrides:
installDefaults in class javax.swing.plaf.basic.BasicTreeUI

uninstallDefaults

protected void uninstallDefaults()
Overrides:
uninstallDefaults in class javax.swing.plaf.basic.BasicTreeUI

paintRow

protected void paintRow(java.awt.Graphics g,
                        java.awt.Rectangle clipBounds,
                        java.awt.Insets insets,
                        java.awt.Rectangle bounds,
                        javax.swing.tree.TreePath path,
                        int row,
                        boolean isExpanded,
                        boolean hasBeenExpanded,
                        boolean isLeaf)
Overrides:
paintRow in class javax.swing.plaf.basic.BasicTreeUI

paintExpandControl

protected void paintExpandControl(java.awt.Graphics g,
                                  java.awt.Rectangle clipBounds,
                                  java.awt.Insets insets,
                                  java.awt.Rectangle bounds,
                                  javax.swing.tree.TreePath path,
                                  int row,
                                  boolean isExpanded,
                                  boolean hasBeenExpanded,
                                  boolean isLeaf)
Overrides:
paintExpandControl in class javax.swing.plaf.basic.BasicTreeUI

paintExpandControlEnforce

protected void paintExpandControlEnforce(java.awt.Graphics g,
                                         java.awt.Rectangle clipBounds,
                                         java.awt.Insets insets,
                                         java.awt.Rectangle bounds,
                                         javax.swing.tree.TreePath path,
                                         int row,
                                         boolean isExpanded,
                                         boolean hasBeenExpanded,
                                         boolean isLeaf)
Paints the expand control of the specified row.

Parameters:
g - Graphics context.
clipBounds - Clip bounds.
insets - Insets.
bounds - Row bounds.
path - Tree path.
row - Tree row.
isExpanded - Expand indication.
hasBeenExpanded - Indication whether this row has ever been expanded.
isLeaf - Indication whether this row is a leaf.

paintHorizontalPartOfLeg

protected void paintHorizontalPartOfLeg(java.awt.Graphics g,
                                        java.awt.Rectangle clipBounds,
                                        java.awt.Insets insets,
                                        java.awt.Rectangle bounds,
                                        javax.swing.tree.TreePath path,
                                        int row,
                                        boolean isExpanded,
                                        boolean hasBeenExpanded,
                                        boolean isLeaf)
Overrides:
paintHorizontalPartOfLeg in class javax.swing.plaf.basic.BasicTreeUI

paintVerticalPartOfLeg

protected void paintVerticalPartOfLeg(java.awt.Graphics g,
                                      java.awt.Rectangle clipBounds,
                                      java.awt.Insets insets,
                                      javax.swing.tree.TreePath path)
Overrides:
paintVerticalPartOfLeg in class javax.swing.plaf.basic.BasicTreeUI

createDefaultCellRenderer

protected javax.swing.tree.TreeCellRenderer createDefaultCellRenderer()
Overrides:
createDefaultCellRenderer in class javax.swing.plaf.basic.BasicTreeUI

installListeners

protected void installListeners()
Overrides:
installListeners in class javax.swing.plaf.basic.BasicTreeUI

uninstallListeners

protected void uninstallListeners()
Overrides:
uninstallListeners in class javax.swing.plaf.basic.BasicTreeUI

getPivotRendererX

public int getPivotRendererX(java.awt.Rectangle paintBounds)
Returns the pivot X for the cells rendered in the specified area. Used for the smart tree scroll ( SubstanceLookAndFeel.TREE_SMART_SCROLL_ANIMATION_KIND).

Parameters:
paintBounds - Area bounds.
Returns:
Pivot X for the cells rendered in the specified area

getPrevPathState

public ComponentState getPrevPathState(SubstanceTreeUI.TreePathId pathId)
Returns the previous state for the specified path.

Parameters:
pathId - Path index.
Returns:
The previous state for the specified path.

getPathState

public ComponentState getPathState(SubstanceTreeUI.TreePathId pathId)
Returns the current state for the specified path.

Parameters:
pathId - Path index.
Returns:
The current state for the specified path.

update

public void update(java.awt.Graphics g,
                   javax.swing.JComponent c)
Overrides:
update in class javax.swing.plaf.ComponentUI

getDefaultColorScheme

public SubstanceColorScheme getDefaultColorScheme()
Returns the default color scheme of this tree. Is for internal use only.

Returns:
The default color scheme of this tree.

getCellRendererInsets

public java.awt.Insets getCellRendererInsets()
Returns the cell renderer insets of this tree. Is for internal use only.

Returns:
The cell renderer insets of this tree.