kaapo.projectmanager.command
Class AddElementEdit
java.lang.Object
javax.swing.undo.AbstractUndoableEdit
kaapo.projectmanager.command.AbstractUndoableEdit
kaapo.projectmanager.command.AddElementEdit
- All Implemented Interfaces:
- Serializable, UndoableEdit
public class AddElementEdit
- extends AbstractUndoableEdit
This UndoableEdit
adds a new Element
into a
Diagram
. This happens by adding the Element
into the Project
that contains the Diagram
and add an
<@link kaapo.project.ElementWrapper> that holds the Element
into the Diagram
.
- Author:
- hprajani
- See Also:
- Serialized Form
Constructor Summary |
AddElementEdit(Class componentType)
Constructs an edit without an user defined location for the new Element |
AddElementEdit(Class componentType,
Point2D point)
Constructs an edit with an user defined location for the new Element |
AddElementEdit
public AddElementEdit(Class componentType)
- Constructs an edit without an user defined location for the new Element
- Parameters:
componentType
- type of the new DComponent
AddElementEdit
public AddElementEdit(Class componentType,
Point2D point)
- Constructs an edit with an user defined location for the new Element
- Parameters:
componentType
- type of the new DComponent
undo
public void undo()
- Undos the Edit.
- Specified by:
undo
in interface UndoableEdit
- Overrides:
undo
in class AbstractUndoableEdit
- See Also:
UndoableEdit.undo()
redo
public void redo()
- Redos the edit.
- Specified by:
redo
in interface UndoableEdit
- Overrides:
redo
in class AbstractUndoableEdit
- See Also:
UndoableEdit.redo()
execute
public void execute(ProjectManager pm)
throws EditFailedException
- Creates a new Element and adds it to both the project and to the diagram.
- Specified by:
execute
in class AbstractUndoableEdit
- Parameters:
pm
- the enviroment where the Edit is executed in.
- Throws:
EditFailedException
- See Also:
AbstractUndoableEdit.execute(ProjectManager)
canUndo
public boolean canUndo()
- Specified by:
canUndo
in interface UndoableEdit
- Overrides:
canUndo
in class AbstractUndoableEdit
- See Also:
UndoableEdit.canUndo()
canRedo
public boolean canRedo()
- Specified by:
canRedo
in interface UndoableEdit
- Overrides:
canRedo
in class AbstractUndoableEdit
- See Also:
UndoableEdit.canRedo()