Package adams.gui.flow.tree
Class SelectionModel
- java.lang.Object
-
- javax.swing.tree.DefaultTreeSelectionModel
-
- adams.gui.flow.tree.SelectionModel
-
- All Implemented Interfaces:
Serializable
,Cloneable
,TreeSelectionModel
public class SelectionModel extends DefaultTreeSelectionModel
The selection model for the flow editor tree.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
-
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
Constructors Constructor Description SelectionModel()
Initializes the selection model.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TreePath[]
getSelectionPaths()
Returns the paths in the selection.protected boolean
isSameParent(TreePath path1, TreePath path2)
Checks whether two paths have the (immediate) parent.-
Methods inherited from class javax.swing.tree.DefaultTreeSelectionModel
addPropertyChangeListener, addSelectionPath, addSelectionPaths, addTreeSelectionListener, arePathsContiguous, canPathsBeAdded, canPathsBeRemoved, clearSelection, clone, fireValueChanged, getLeadSelectionPath, getLeadSelectionRow, getListeners, getMaxSelectionRow, getMinSelectionRow, getPropertyChangeListeners, getRowMapper, getSelectionCount, getSelectionMode, getSelectionPath, getSelectionRows, getTreeSelectionListeners, insureRowContinuity, insureUniqueness, isPathSelected, isRowSelected, isSelectionEmpty, notifyPathChange, removePropertyChangeListener, removeSelectionPath, removeSelectionPaths, removeTreeSelectionListener, resetRowSelection, setRowMapper, setSelectionMode, setSelectionPath, setSelectionPaths, toString, updateLeadIndex
-
-
-
-
Method Detail
-
isSameParent
protected boolean isSameParent(TreePath path1, TreePath path2)
Checks whether two paths have the (immediate) parent. E.g., a.b.c.1 and a.b.c.2 have a.b.c as immediate parent (= true). But a.b.c.1 and a.b.d.2 have only a.b. as parent (= false).- Parameters:
path1
- the first pathpath2
- the second path- Returns:
- true if paths have the same immediate parent
-
getSelectionPaths
public TreePath[] getSelectionPaths()
Returns the paths in the selection. This will return null (or an empty array) if nothing is currently selected.
This implemention removes all selection paths that are not on the same level as the first one.- Specified by:
getSelectionPaths
in interfaceTreeSelectionModel
- Overrides:
getSelectionPaths
in classDefaultTreeSelectionModel
- Returns:
- the selected paths
-
-