Class ClusteredCommand
java.lang.Object
org.eclipse.nebula.widgets.ganttchart.undoredo.commands.AbstractUndoRedoCommand
org.eclipse.nebula.widgets.ganttchart.undoredo.commands.ClusteredCommand
- All Implemented Interfaces:
IUndoRedoCommand
public class ClusteredCommand extends AbstractUndoRedoCommand
One command to handle many sub-commands, such as a multi-drag/drop etc. All commands inside a clustered command will be Undone/Redone at the same time.
-
Constructor Summary
Constructors Constructor Description ClusteredCommand()Creates a new Clustered Command.ClusteredCommand(java.util.List commands)Creates a new Clustered Command witha list of pre-set commands. -
Method Summary
Modifier and Type Method Description voidaddCommand(IUndoRedoCommand command)Adds a new command to the cluster.voiddispose()Called when the event is about to be destroyed.java.util.ListgetCommandList()Simple getter for the list of commands that are transported by this ClusteredCommand.java.util.ListgetCommands()Deprecated.Because the name of this method is not unique and might me interpreted wrong.java.util.ListgetEvents()Return the individual events that are clustered in this command.java.util.ListgetFlattenedCommands()Return the individual commands that are clustered in this command.voidredo()Redoes an event in the chart.voidremoveCommand(IUndoRedoCommand command)Removes a command from the cluster.intsize()Returns the number of commands that are inside the cluster.voidundo()Undoes an event in the chart.
-
Constructor Details
-
ClusteredCommand
public ClusteredCommand()Creates a new Clustered Command. -
ClusteredCommand
public ClusteredCommand(java.util.List commands)Creates a new Clustered Command witha list of pre-set commands.
-
-
Method Details
-
addCommand
Adds a new command to the cluster.- Parameters:
command- Command to add
-
removeCommand
Removes a command from the cluster.- Parameters:
command- Command to remove
-
size
public int size()Returns the number of commands that are inside the cluster.- Returns:
- Number of commands
-
getCommandList
public java.util.List getCommandList()Simple getter for the list of commands that are transported by this ClusteredCommand.Note that this will only return the list of commands as is. There is no transformation made to the list.
- Returns:
- The list of commands that are transported by this ClusteredCommand.
- See Also:
getFlattenedCommands()
-
dispose
public void dispose()Description copied from interface:IUndoRedoCommandCalled when the event is about to be destroyed. If any resources need to be cleaned up you should do so here. -
redo
public void redo()Description copied from interface:IUndoRedoCommandRedoes an event in the chart. This should put the event back to the state it was after the event took place. -
undo
public void undo()Description copied from interface:IUndoRedoCommandUndoes an event in the chart. This should put the event back to the state it was prior to the event taking place. -
getCommands
public java.util.List getCommands()Deprecated.Because the name of this method is not unique and might me interpreted wrong.Return the individual commands that are clustered in this command. If this ClusteredCommand also contains other ClusteredCommands, they will get unpacked so there will be one flat list of IUndoRedoCommands.- Returns:
- A unmodifiable list of participating
EventMoveCommands. - See Also:
getCommandList(),getFlattenedCommands()
-
getFlattenedCommands
public java.util.List getFlattenedCommands()Return the individual commands that are clustered in this command. If this ClusteredCommand also contains other ClusteredCommands, they will get unpacked so there will be one flat list of IUndoRedoCommands.- Returns:
- A unmodifiable list of participating
EventMoveCommands. - See Also:
getCommandList()
-
getEvents
public java.util.List getEvents()Return the individual events that are clustered in this command.- Returns:
- An unmodifiable list of participating
GanttEvents.
-