java.lang.Object
com.iamsoft.util.ui.swing.AbstractRearrangeableTreeModel
com.iamsoft.util.ui.swing.DefaultRearrangeableTreeModel
- All Implemented Interfaces:
RearrangeableTreeModel
,TreeModel
Assumes that all nodes are MutableTreeNodes.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
An applet that demonstrates how to use rearrangeable models.Nested classes/interfaces inherited from class com.iamsoft.util.ui.swing.AbstractRearrangeableTreeModel
AbstractRearrangeableTreeModel.HorizontalDirection, AbstractRearrangeableTreeModel.PromotionBehavior, AbstractRearrangeableTreeModel.VerticalDirection
Nested classes/interfaces inherited from interface com.iamsoft.util.ui.swing.RearrangeableTreeModel
RearrangeableTreeModel.IllegalNodeMoveException
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetModel()
protected void
insertNodes
(TreePath pParentPath, Collection<Object> pNodes, int pIdx) Used by rearrangement methods to shuffle nodes around.static void
Opens a window with sample tree and rearrangement buttons.protected void
removeNodes
(TreePath pParentPath, Map<Integer, Object> pNodes) Used by rearrangement methods to shuffle nodes around.Methods inherited from class com.iamsoft.util.ui.swing.AbstractRearrangeableTreeModel
addTreeModelListener, canDemote, canMoveDown, canMoveUp, canPromote, demote, findNewPath, getChild, getChildCount, getIndexOfChild, getOldToNewPaths, getPromotionBehavior, getRoot, isLeaf, move, move, moveDown, moveUp, promote, removeTreeModelListener, setPromotionBehavior, valueForPathChanged
-
Constructor Details
-
DefaultRearrangeableTreeModel
-
-
Method Details
-
getModel
- Overrides:
getModel
in classAbstractRearrangeableTreeModel
-
insertNodes
Description copied from class:AbstractRearrangeableTreeModel
Used by rearrangement methods to shuffle nodes around. If rearrangement methods are overridden, a blank implementation will suffice. Implementation may choose to ignore pIdx- Specified by:
insertNodes
in classAbstractRearrangeableTreeModel
- Parameters:
pParentPath
- Path to parent of nodes to be inserted.pNodes
- Nodes to be appended (in order).pIdx
- Index of insertion. May be ignored if model wishes to impose its own node ordering strategy.- See Also:
-
removeNodes
Description copied from class:AbstractRearrangeableTreeModel
Used by rearrangement methods to shuffle nodes around. If rearrangement methods are overridden, a blank implementation will suffice. pNodes is guaranteed to be sorted in such a way that ordered removal should succeed. That is, indices are in descending order.- Specified by:
removeNodes
in classAbstractRearrangeableTreeModel
- Parameters:
pParentPath
- Path to parent of nodes to be inserted.pNodes
- Map from desired insertion index to node object.- See Also:
-
main
Opens a window with sample tree and rearrangement buttons.
-