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 classAn 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.VerticalDirectionNested classes/interfaces inherited from interface com.iamsoft.util.ui.swing.RearrangeableTreeModel
RearrangeableTreeModel.IllegalNodeMoveException -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetModel()protected voidinsertNodes(TreePath pParentPath, Collection<Object> pNodes, int pIdx) Used by rearrangement methods to shuffle nodes around.static voidOpens a window with sample tree and rearrangement buttons.protected voidremoveNodes(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:
getModelin classAbstractRearrangeableTreeModel
-
insertNodes
Description copied from class:AbstractRearrangeableTreeModelUsed 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:
insertNodesin 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:AbstractRearrangeableTreeModelUsed 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:
removeNodesin 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.
-