ui.panel.options
Class CheckBoxTreeCellRenderer

java.lang.Object
  extended by ui.panel.options.CheckBoxTreeCellRenderer
All Implemented Interfaces:
javax.swing.tree.TreeCellRenderer

public class CheckBoxTreeCellRenderer
extends java.lang.Object
implements javax.swing.tree.TreeCellRenderer

Provides checkbox-based selection of tree nodes. Override the protected methods to adapt this renderer's behavior to your local tree table flavor. No change listener notifications are provided.


Nested Class Summary
protected  class CheckBoxTreeCellRenderer.MouseHandler
           
 
Field Summary
static int FULLSELECTED
           
static int NOTSELECTED
           
static int PARTIALSELECTED
           
static int UNSELECTABLE
           
 
Constructor Summary
CheckBoxTreeCellRenderer(javax.swing.JTree tree, javax.swing.tree.TreeCellRenderer original)
          Create a per-tree instance of the checkbox renderer.
 
Method Summary
protected  void addMouseHandler(CheckBoxTreeCellRenderer.MouseHandler handler)
           
 javax.swing.tree.TreePath[] getCheckedPaths()
          Returns all checked paths.
 int[] getCheckedRows()
          Returns all checked rows.
protected  javax.swing.tree.TreePath getPathForRow(int row)
           
protected  int getRow(java.awt.Point p)
           
protected  java.awt.Rectangle getRowBounds(int row)
           
protected  int getRowForPath(javax.swing.tree.TreePath path)
           
 java.awt.Component getTreeCellRendererComponent(javax.swing.JTree tree, java.lang.Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus)
           
protected  void installMouseHandler()
           
 boolean isChecked(javax.swing.tree.TreePath path)
          Returns whether the given path is currently checked.
 boolean isExplicitlyChecked(javax.swing.tree.TreePath path)
           
 boolean isPartiallyChecked(javax.swing.tree.TreePath path)
           
 boolean isSelectable(javax.swing.tree.TreePath path)
          Returns whether selecting the given path is allowed.
static void main(java.lang.String[] args)
           
 void repaint()
           
 void repaint(java.awt.Rectangle r)
           
 void toggleChecked(int row)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNSELECTABLE

public static final int UNSELECTABLE
See Also:
Constant Field Values

FULLSELECTED

public static final int FULLSELECTED
See Also:
Constant Field Values

NOTSELECTED

public static final int NOTSELECTED
See Also:
Constant Field Values

PARTIALSELECTED

public static final int PARTIALSELECTED
See Also:
Constant Field Values
Constructor Detail

CheckBoxTreeCellRenderer

public CheckBoxTreeCellRenderer(javax.swing.JTree tree,
                                javax.swing.tree.TreeCellRenderer original)
Create a per-tree instance of the checkbox renderer.

Method Detail

installMouseHandler

protected void installMouseHandler()

addMouseHandler

protected void addMouseHandler(CheckBoxTreeCellRenderer.MouseHandler handler)

getRow

protected int getRow(java.awt.Point p)

getRowBounds

protected java.awt.Rectangle getRowBounds(int row)

getPathForRow

protected javax.swing.tree.TreePath getPathForRow(int row)

getRowForPath

protected int getRowForPath(javax.swing.tree.TreePath path)

repaint

public void repaint(java.awt.Rectangle r)

repaint

public void repaint()

getTreeCellRendererComponent

public java.awt.Component getTreeCellRendererComponent(javax.swing.JTree tree,
                                                       java.lang.Object value,
                                                       boolean selected,
                                                       boolean expanded,
                                                       boolean leaf,
                                                       int row,
                                                       boolean hasFocus)
Specified by:
getTreeCellRendererComponent in interface javax.swing.tree.TreeCellRenderer

isExplicitlyChecked

public boolean isExplicitlyChecked(javax.swing.tree.TreePath path)

isSelectable

public boolean isSelectable(javax.swing.tree.TreePath path)
Returns whether selecting the given path is allowed. The default returns true. You should return false if the given path represents a placeholder for a node that has not yet loaded, or anything else that doesn't represent a normal, operable object in the tree.


isChecked

public boolean isChecked(javax.swing.tree.TreePath path)
Returns whether the given path is currently checked.


isPartiallyChecked

public boolean isPartiallyChecked(javax.swing.tree.TreePath path)

toggleChecked

public void toggleChecked(int row)

getCheckedRows

public int[] getCheckedRows()
Returns all checked rows.


getCheckedPaths

public javax.swing.tree.TreePath[] getCheckedPaths()
Returns all checked paths.


main

public static void main(java.lang.String[] args)