kaapo.projectmanager.command
Class NewDiagramEdit

java.lang.Object
  extended by javax.swing.undo.AbstractUndoableEdit
      extended by kaapo.projectmanager.command.AbstractUndoableEdit
          extended by kaapo.projectmanager.command.NewDiagramEdit
All Implemented Interfaces:
Serializable, UndoableEdit

public class NewDiagramEdit
extends AbstractUndoableEdit

This Edit adds a new Diagram to a Project.

Author:
hprajani, paltamaa
See Also:
Serialized Form

Field Summary
 
Fields inherited from class kaapo.projectmanager.command.AbstractUndoableEdit
visibleDiagram
 
Fields inherited from class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName
 
Constructor Summary
NewDiagramEdit(Class diagram, String name)
          When executed, adds a new diagram after the visible diagram.
NewDiagramEdit(Class diagram, String name, DiagramWrapper parent, DiagramWrapper prevSibling)
          constrcuts the edit with knowledge in the Project's Diagram hierarchy.
 
Method Summary
 boolean canRedo()
           
 boolean canUndo()
           
 void execute(ProjectManager pm)
          Adds the new Diagram to the Project.
 void redo()
           
 void undo()
           
 
Methods inherited from class kaapo.projectmanager.command.AbstractUndoableEdit
changeCorrectVisibleDiagram
 
Methods inherited from class javax.swing.undo.AbstractUndoableEdit
addEdit, die, getPresentationName, getRedoPresentationName, getUndoPresentationName, isSignificant, replaceEdit, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NewDiagramEdit

public NewDiagramEdit(Class diagram,
                      String name)
When executed, adds a new diagram after the visible diagram. If no diagram is selected, new diagram is added to after last diagram in current project.

Parameters:
diagram - the class of the new diagram
name - the name of the new diagram

NewDiagramEdit

public NewDiagramEdit(Class diagram,
                      String name,
                      DiagramWrapper parent,
                      DiagramWrapper prevSibling)
constrcuts the edit with knowledge in the Project's Diagram hierarchy.

Parameters:
diagram - the class of the new diagram
name - the name of the new diagram
parent - the parent diagram in the project diagram hieararchy
prevSibling - the previous sibling in project diagram hierarchy
Method Detail

execute

public void execute(ProjectManager pm)
Adds the new Diagram to the Project.

Specified by:
execute in class AbstractUndoableEdit
Parameters:
pm - the enviroment where the Edit is executed in.
See Also:
Edit.execute(ProjectManager)

undo

public void undo()
Specified by:
undo in interface UndoableEdit
Overrides:
undo in class AbstractUndoableEdit
See Also:
UndoableEdit.undo()

redo

public void redo()
Specified by:
redo in interface UndoableEdit
Overrides:
redo in class AbstractUndoableEdit
See Also:
UndoableEdit.redo()

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()