Class ListToTreeSelectionModelWrapper
- java.lang.Object
-
- javax.swing.tree.DefaultTreeSelectionModel
-
- com.puppycrawl.tools.checkstyle.gui.ListToTreeSelectionModelWrapper
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,javax.swing.tree.TreeSelectionModel
class ListToTreeSelectionModelWrapper extends javax.swing.tree.DefaultTreeSelectionModel
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
Fields Modifier and Type Field Description private static longserialVersionUIDA unique serial version identifier.private TreeTabletreeTableTreeTable to perform updates on.private booleanupdatingListSelectionModelSet to true when we are updating the ListSelectionModel.
-
Constructor Summary
Constructors Constructor Description ListToTreeSelectionModelWrapper(TreeTable jTreeTable)Constructor to initialise treeTable.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected javax.swing.ListSelectionModelgetListSelectionModel()Returns the list selection model.voidresetRowSelection()This is overridden to setupdatingListSelectionModeland message super.private voidupdateSelectedPathIfRowIsSelected(int counter)If the row at given index is selected, selected paths are updated.private voidupdateSelectedPathsFromSelectedRows()IfupdatingListSelectionModelis 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 Detail
-
serialVersionUID
private static final long serialVersionUID
A unique serial version identifier.- See Also:
- Constant Field Values
-
updatingListSelectionModel
private boolean updatingListSelectionModel
Set to true when we are updating the ListSelectionModel.
-
-
Constructor Detail
-
ListToTreeSelectionModelWrapper
ListToTreeSelectionModelWrapper(TreeTable jTreeTable)
Constructor to initialise treeTable.- Parameters:
jTreeTable- TreeTable to perform updates on.
-
-
Method Detail
-
getListSelectionModel
protected final javax.swing.ListSelectionModel 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 setupdatingListSelectionModeland message super. This is the only place DefaultTreeSelectionModel alters the ListSelectionModel.- Specified by:
resetRowSelectionin interfacejavax.swing.tree.TreeSelectionModel- Overrides:
resetRowSelectionin classjavax.swing.tree.DefaultTreeSelectionModel
-
updateSelectedPathsFromSelectedRows
private void updateSelectedPathsFromSelectedRows()
IfupdatingListSelectionModelis 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.
-
-