Copyright © 2005 Scientific Applications. All Rights Reserved.

com.sciapp.component
Class CheckBoxTreeSelectionModel

java.lang.Object
  extended by javax.swing.tree.DefaultTreeSelectionModel
      extended by com.sciapp.component.CheckBoxTreeSelectionModel
All Implemented Interfaces:
Serializable, Cloneable, TreeSelectionModel

public class CheckBoxTreeSelectionModel
extends DefaultTreeSelectionModel

CheckBoxTreeSelectionModel is the default selection model for a CheckBoxTree.

See Also:
Serialized Form

Field Summary
static int PARTIALLY_SELECTED
          defines a partially selected state
protected  boolean partialSelection
          flag indicating whether partial selection is on/off
static int SELECTED
          defines a selected state
protected  TreeModel treeModel
          the assigned tree model
static int UNSELECTED
          defines an unselected state
 
Fields inherited from class javax.swing.tree.DefaultTreeSelectionModel
changeSupport, leadIndex, leadPath, leadRow, listenerList, listSelectionModel, rowMapper, selection, SELECTION_MODE_PROPERTY, selectionMode
 
Fields inherited from interface javax.swing.tree.TreeSelectionModel
CONTIGUOUS_TREE_SELECTION, DISCONTIGUOUS_TREE_SELECTION, SINGLE_TREE_SELECTION
 
Constructor Summary
CheckBoxTreeSelectionModel(TreeModel treeModel)
          Constructs a CheckBoxTreeSelectionModel.
 
Method Summary
 void addSelectionPath(TreePath path)
          Adds path to the current selection.
 TreeModel getModel()
          Retrieves the tree model.
 boolean getPartialSelection()
          Determines whether the checkbox tree will use partial selection.
 int getPathSelectionState(TreePath path)
          Returns the selection state of the specified path.
 void removeSelectionPath(TreePath path)
          Removes path from the selection.
 void setModel(TreeModel treeModel)
          Assigns the tree model.
 void setPartialSelection(boolean partialSelection)
          Turns partial selection on/off.
 
Methods inherited from class javax.swing.tree.DefaultTreeSelectionModel
addPropertyChangeListener, addSelectionPaths, addTreeSelectionListener, arePathsContiguous, canPathsBeAdded, canPathsBeRemoved, clearSelection, clone, fireValueChanged, getLeadSelectionPath, getLeadSelectionRow, getListeners, getMaxSelectionRow, getMinSelectionRow, getPropertyChangeListeners, getRowMapper, getSelectionCount, getSelectionMode, getSelectionPath, getSelectionPaths, getSelectionRows, getTreeSelectionListeners, insureRowContinuity, insureUniqueness, isPathSelected, isRowSelected, isSelectionEmpty, notifyPathChange, removePropertyChangeListener, removeSelectionPaths, removeTreeSelectionListener, resetRowSelection, setRowMapper, setSelectionMode, setSelectionPath, setSelectionPaths, toString, updateLeadIndex
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

treeModel

protected TreeModel treeModel
the assigned tree model


partialSelection

protected boolean partialSelection
flag indicating whether partial selection is on/off


SELECTED

public static final int SELECTED
defines a selected state

See Also:
Constant Field Values

UNSELECTED

public static final int UNSELECTED
defines an unselected state

See Also:
Constant Field Values

PARTIALLY_SELECTED

public static final int PARTIALLY_SELECTED
defines a partially selected state

See Also:
Constant Field Values
Constructor Detail

CheckBoxTreeSelectionModel

public CheckBoxTreeSelectionModel(TreeModel treeModel)
Constructs a CheckBoxTreeSelectionModel.

Method Detail

addSelectionPath

public void addSelectionPath(TreePath path)
Adds path to the current selection. If path is not currently in the selection the TreeSelectionListeners are notified. This has no effect if path is null.

Specified by:
addSelectionPath in interface TreeSelectionModel
Overrides:
addSelectionPath in class DefaultTreeSelectionModel
Parameters:
path - the new path to add to the current selection

getModel

public TreeModel getModel()
Retrieves the tree model.

Returns:
the tree model

getPartialSelection

public boolean getPartialSelection()
Determines whether the checkbox tree will use partial selection.

Returns:
true if partial selection is enabled, false otherwise

getPathSelectionState

public int getPathSelectionState(TreePath path)
Returns the selection state of the specified path. This can either be SELECTED, UNSELECTED or PARTIALLY_SELECTED.

Parameters:
path - the path whose selection state is returned
Returns:
the selection state

removeSelectionPath

public void removeSelectionPath(TreePath path)
Removes path from the selection. If path is in the selection The TreeSelectionListeners are notified. This has no effect if path is null.

Specified by:
removeSelectionPath in interface TreeSelectionModel
Overrides:
removeSelectionPath in class DefaultTreeSelectionModel
Parameters:
path - the path to remove from the selection

setModel

public void setModel(TreeModel treeModel)
Assigns the tree model.

Parameters:
treeModel - the model to assign

setPartialSelection

public void setPartialSelection(boolean partialSelection)
Turns partial selection on/off.

Parameters:
partialSelection - true if partial selection is enabled, false otherwise

Copyright © 2005 Scientific Applications. All Rights Reserved.