Class SelectionModel

    • Constructor Detail

      • SelectionModel

        public SelectionModel()
        Initializes the selection model.
    • 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 path
        path2 - 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 interface TreeSelectionModel
        Overrides:
        getSelectionPaths in class DefaultTreeSelectionModel
        Returns:
        the selected paths