Interface TreeSelectableModel

All Known Implementing Classes:
AbstractTreeModel, DefaultTreeModel

public interface TreeSelectableModel
Indicate a tree model that supports selection. It is typically used with TreeModel and Tree.
Since:
6.0.0
Author:
jumperchen
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    addSelectionPath(int[] path)
    Adds path to the current selection.
    boolean
    addSelectionPaths(int[][] paths)
    Adds paths to the current selection.
    void
    Empties the current selection.
    int
    Returns the number of paths that are selected.
    int[]
    Returns the first path in the selection.
    int[][]
    Returns the paths in the selection.
    boolean
    Returns whether the current selection mode is multiple.
    boolean
    isPathSelected(int[] path)
    Returns true if the path, path, is in the current selection.
    boolean
    Returns true if the selection is currently empty.
    boolean
    removeSelectionPath(int[] path)
    Removes path from the selection.
    boolean
    removeSelectionPaths(int[][] paths)
    Removes paths from the selection.
    void
    setMultiple(boolean multiple)
    Sets the selection mode to be multiple.
  • Method Details

    • setMultiple

      void setMultiple(boolean multiple)
      Sets the selection mode to be multiple.
    • isMultiple

      boolean isMultiple()
      Returns whether the current selection mode is multiple.
      See Also:
    • addSelectionPath

      boolean addSelectionPath(int[] path)
      Adds path to the current selection. If path is not currently in the selection the TreeDataListeners are notified. This has no effect if path is null.
      Parameters:
      path - the new path to add to the current selection
      Returns:
      whether it is added successfully
    • addSelectionPaths

      boolean addSelectionPaths(int[][] paths)
      Adds paths to the current selection. If any of the paths in paths are not currently in the selection the TreeDataListeners are notified. This has no effect if paths is null.
      Parameters:
      paths - the new paths to add to the current selection
      Returns:
      whether it is added successfully
    • removeSelectionPath

      boolean removeSelectionPath(int[] path)
      Removes path from the selection. If path is in the selection The TreeDataListeners are notified. This has no effect if path is null.
      Parameters:
      path - the path to remove from the selection
      Returns:
      true if it was unselected successfully
    • removeSelectionPaths

      boolean removeSelectionPaths(int[][] paths)
      Removes paths from the selection. If any of the paths in paths are in the selection, the TreeDataListeners are notified. This method has no effect if paths is null.
      Parameters:
      paths - the path to remove from the selection
      Returns:
      true if one of the paths was unselected successfully
    • isPathSelected

      boolean isPathSelected(int[] path)
      Returns true if the path, path, is in the current selection.
    • isSelectionEmpty

      boolean isSelectionEmpty()
      Returns true if the selection is currently empty.
    • clearSelection

      void clearSelection()
      Empties the current selection. If this represents a change in the current selection, the selection listeners are notified.
    • getSelectionPath

      int[] getSelectionPath()
      Returns the first path in the selection. How first is defined is up to implementors.
    • getSelectionPaths

      int[][] getSelectionPaths()
      Returns the paths in the selection. This will return null (or an empty array) if nothing is currently selected.
    • getSelectionCount

      int getSelectionCount()
      Returns the number of paths that are selected.