-
- All Superinterfaces:
TreeModel
- All Known Implementing Classes:
AbstractRearrangeableTreeModel,DefaultRearrangeableTreeModel
public interface RearrangeableTreeModel extends TreeModel
Tree model in which nodes can be moved left, right, up and/or down.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classRearrangeableTreeModel.IllegalNodeMoveExceptionThrown when an invalid move is attempted.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancanDemote(Collection<TreePath> pPaths)booleancanMoveDown(Collection<TreePath> pPaths)booleancanMoveUp(Collection<TreePath> pPaths)booleancanPromote(Collection<TreePath> pPaths)voiddemote(Collection<TreePath> pPaths)Move nodes one level further from the root.voidmoveDown(Collection<TreePath> pPaths)Move nodes one space lower (swap with successors).voidmoveUp(Collection<TreePath> pPaths)Move nodes one space higher (swap with predecessors).voidpromote(Collection<TreePath> pPaths)Move nodes one level closer to the root.-
Methods inherited from interface javax.swing.tree.TreeModel
addTreeModelListener, getChild, getChildCount, getIndexOfChild, getRoot, isLeaf, removeTreeModelListener, valueForPathChanged
-
-
-
-
Method Detail
-
canPromote
boolean canPromote(Collection<TreePath> pPaths)
-
canDemote
boolean canDemote(Collection<TreePath> pPaths)
-
canMoveUp
boolean canMoveUp(Collection<TreePath> pPaths)
-
canMoveDown
boolean canMoveDown(Collection<TreePath> pPaths)
-
promote
void promote(Collection<TreePath> pPaths) throws RearrangeableTreeModel.IllegalNodeMoveException
Move nodes one level closer to the root. All children should be promoted along with the parent. If pPaths includes both a path and a sub-path, the former promotion occurs first.- A
- B
- C
- D
- E
- F
- G
Promote[AD] Promote [AD, ADF] - A
- B
- C
- D
- E
- F
- G
- A
- B
- C
- D
- E
- G
- F
- Parameters:
pPaths- Paths to be moved.- Throws:
UnsupportedOperationException- If implementor does not allow promotions.RearrangeableTreeModel.IllegalNodeMoveException
-
demote
void demote(Collection<TreePath> pPaths) throws RearrangeableTreeModel.IllegalNodeMoveException
Move nodes one level further from the root. If pPaths includes both a path and a sub-path, the former promotion occurs first.- Parameters:
pPaths- Paths to be moved.- Throws:
UnsupportedOperationException- If implementor does not allow promotions.RearrangeableTreeModel.IllegalNodeMoveException
-
moveUp
void moveUp(Collection<TreePath> pPaths) throws RearrangeableTreeModel.IllegalNodeMoveException
Move nodes one space higher (swap with predecessors).- Parameters:
pPaths- Paths to be moved.- Throws:
UnsupportedOperationException- If implementor does not allow promotions.RearrangeableTreeModel.IllegalNodeMoveException
-
moveDown
void moveDown(Collection<TreePath> pPaths) throws RearrangeableTreeModel.IllegalNodeMoveException
Move nodes one space lower (swap with successors).- Parameters:
pPaths- Paths to be moved.- Throws:
UnsupportedOperationException- If implementor does not allow promotions.RearrangeableTreeModel.IllegalNodeMoveException
-
-