public class DefaultReassignNodesCommand extends AbstractCommand
MutableTreeNode
and the tree
model is of type DefaultTreeModel
.Constructor and Description |
---|
DefaultReassignNodesCommand(MutableTreeNode[] nodes,
MutableTreeNode oldParent,
int[] oldChildIndices,
MutableTreeNode newParent,
int[] newChildIndices,
DefaultTreeModel model)
Constructs a new command.
|
DefaultReassignNodesCommand(String name,
MutableTreeNode[] nodes,
MutableTreeNode oldParent,
int[] oldChildIndices,
MutableTreeNode newParent,
int[] newChildIndices,
DefaultTreeModel model)
Constructs a new command.
|
Modifier and Type | Method and Description |
---|---|
void |
executeCommand(IProgressMonitor monitor)
Executes the command.
|
DefaultTreeModel |
getModel()
Returns the model on which the command gets executed.
|
int[] |
getNewChildIndices()
Returns the indices for the reassigned nodes within the list of the
children of their new parent.
|
MutableTreeNode |
getNewParent()
Returns the tree node, which will be the new parent of the reassigned
nodes.
|
MutableTreeNode[] |
getNodes()
Returns the reassigned tree nodes.
|
int[] |
getOldChildIndices()
Returns the indices for the reassigned nodes within the list of the
children of their old parent.
|
MutableTreeNode |
getOldParent()
Returns the tree node, which is the current / old parent of the
reassigned nodes.
|
void |
undoCommand(IProgressMonitor monitor)
Undos the command.
|
getName, isRedoable, isRelevant, isUndoable, redoCommand, setName
public DefaultReassignNodesCommand(String name, MutableTreeNode[] nodes, MutableTreeNode oldParent, int[] oldChildIndices, MutableTreeNode newParent, int[] newChildIndices, DefaultTreeModel model)
name
- the name for the command (reassignment can be used in many
different contexts, e.g. indentation)nodes
- the nodes, which will be removed from the current (old) parent
node and assigned to the new parent nodeoldParent
- the old parent nodeoldChildIndices
- the indices of the nodes when they still belonged to the old
parent nodenewParent
- the new parent nodenewChildIndices
- the indices of the nodes once they belong to the new parent
nodemodel
- the tree model in which the changes happenpublic DefaultReassignNodesCommand(MutableTreeNode[] nodes, MutableTreeNode oldParent, int[] oldChildIndices, MutableTreeNode newParent, int[] newChildIndices, DefaultTreeModel model)
nodes
- the nodes, which will be removed from the current (old) parent
node and assigned to the new parent nodeoldParent
- the old parent nodeoldChildIndices
- the indices of the nodes when they still belonged to the old
parent nodenewParent
- the new parent nodenewChildIndices
- the indices of the nodes once they belong to the new parent
nodemodel
- the tree model in which the changes happenpublic void executeCommand(IProgressMonitor monitor) throws CommandException
ICommand
monitor
- a progress monitorCommandException
- if anything during the execution of the command has gone
wrongpublic void undoCommand(IProgressMonitor monitor) throws CommandException
ICommand
monitor
- a progress monitorCommandException
- if anything during the execution of the command has gone
wrongpublic DefaultTreeModel getModel()
public MutableTreeNode getNewParent()
public MutableTreeNode getOldParent()
public MutableTreeNode[] getNodes()
public int[] getNewChildIndices()
public int[] getOldChildIndices()
Copyright © 2006–2020 Dirk Lemmermann Software & Consulting. All rights reserved.