Class ListToTreeSelectionModelWrapper

java.lang.Object
javax.swing.tree.DefaultTreeSelectionModel
com.puppycrawl.tools.checkstyle.gui.ListToTreeSelectionModelWrapper
All Implemented Interfaces:
Serializable, Cloneable, TreeSelectionModel

class ListToTreeSelectionModelWrapper extends 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 Details

    • serialVersionUID

      private static final long serialVersionUID
      A unique serial version identifier.
      See Also:
    • treeTable

      private final TreeTable treeTable
      TreeTable to perform updates on.
    • updatingListSelectionModel

      private boolean updatingListSelectionModel
      Set 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

      protected final 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 set updatingListSelectionModel and message super. This is the only place DefaultTreeSelectionModel alters the ListSelectionModel.
      Specified by:
      resetRowSelection in interface TreeSelectionModel
      Overrides:
      resetRowSelection in class DefaultTreeSelectionModel
    • updateSelectedPathsFromSelectedRows

      private void updateSelectedPathsFromSelectedRows()
      If updatingListSelectionModel 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.