Class ListToTreeSelectionModelWrapper
java.lang.Object
javax.swing.tree.DefaultTreeSelectionModel
com.puppycrawl.tools.checkstyle.gui.ListToTreeSelectionModelWrapper
- All Implemented Interfaces:
Serializable
,Cloneable
,TreeSelectionModel
ListToTreeSelectionModelWrapper extends DefaultTreeSelectionModel
to listen for changes in the ListSelectionModel it maintains. Once
a change in the ListSelectionModel happens, the paths are updated
in the DefaultTreeSelectionModel.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final long
A unique serial version identifier.private final TreeTable
TreeTable to perform updates on.private boolean
Set to true when we are updating the ListSelectionModel.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
ConstructorsConstructorDescriptionListToTreeSelectionModelWrapper
(TreeTable jTreeTable) Constructor to initialise treeTable. -
Method Summary
Modifier and TypeMethodDescriptionprotected final ListSelectionModel
Returns the list selection model.void
This is overridden to setupdatingListSelectionModel
and message super.private void
updateSelectedPathIfRowIsSelected
(int counter) If the row at given index is selected, selected paths are updated.private void
IfupdatingListSelectionModel
is false, this will reset the selected paths from the selected rows in the list selection model.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, getSelectionPaths, getSelectionRows, getTreeSelectionListeners, insureRowContinuity, insureUniqueness, isPathSelected, isRowSelected, isSelectionEmpty, notifyPathChange, removePropertyChangeListener, removeSelectionPath, removeSelectionPaths, removeTreeSelectionListener, setRowMapper, setSelectionMode, setSelectionPath, setSelectionPaths, toString, updateLeadIndex
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDA unique serial version identifier.- See Also:
-
treeTable
TreeTable to perform updates on. -
updatingListSelectionModel
private boolean updatingListSelectionModelSet to true when we are updating the ListSelectionModel.
-
-
Constructor Details
-
ListToTreeSelectionModelWrapper
ListToTreeSelectionModelWrapper(TreeTable jTreeTable) Constructor to initialise treeTable.- Parameters:
jTreeTable
- TreeTable to perform updates on.
-
-
Method Details
-
getListSelectionModel
Returns the list selection model. ListToTreeSelectionModelWrapper listens for changes to this model and updates the selected paths accordingly.- Returns:
- the list selection model
-
resetRowSelection
public void resetRowSelection()This is overridden to setupdatingListSelectionModel
and message super. This is the only place DefaultTreeSelectionModel alters the ListSelectionModel.- Specified by:
resetRowSelection
in interfaceTreeSelectionModel
- Overrides:
resetRowSelection
in classDefaultTreeSelectionModel
-
updateSelectedPathsFromSelectedRows
private void updateSelectedPathsFromSelectedRows()IfupdatingListSelectionModel
is false, this will reset the selected paths from the selected rows in the list selection model. -
updateSelectedPathIfRowIsSelected
private void updateSelectedPathIfRowIsSelected(int counter) If the row at given index is selected, selected paths are updated.- Parameters:
counter
- number of row.
-