kaapo.projectmanager.command
Class ModifyDComponentAttributeEdit

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

public class ModifyDComponentAttributeEdit
extends AbstractUndoableEdit

Changes the value of the specified attribute in the (first) selected diagram component when executed.

Author:
hprajani, iheikkin, paltamaa
See Also:
Serialized Form

Field Summary
 
Fields inherited from class kaapo.projectmanager.command.AbstractUndoableEdit
pm, visibleDiagram
 
Fields inherited from class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName
 
Constructor Summary
ModifyDComponentAttributeEdit(DiagramComponent dc, String attributeName, Object newValue)
          Constructs a new ModifyDComponentAttributeEdit based on given DiagramComponent, attribute-object, and attribute-key.
ModifyDComponentAttributeEdit(String attributeName, Object newValue)
          Constructs a new ModifyDComponentAttributeEdit based on given attribute-object and attribute-key String.
 
Method Summary
 boolean canRedo()
           
 boolean canUndo()
           
 void execute(ProjectManager pm)
          Stores the original attribute and sets the new one.
 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

ModifyDComponentAttributeEdit

public ModifyDComponentAttributeEdit(String attributeName,
                                     Object newValue)
Constructs a new ModifyDComponentAttributeEdit based on given attribute-object and attribute-key String.

Parameters:
attributeName - The name of the attribute
newValue - The new value for the attribute

ModifyDComponentAttributeEdit

public ModifyDComponentAttributeEdit(DiagramComponent dc,
                                     String attributeName,
                                     Object newValue)
Constructs a new ModifyDComponentAttributeEdit based on given DiagramComponent, attribute-object, and attribute-key.

Parameters:
dc - The DiagramComponent to edit
attributeName - The name of the attribute
newValue - The new value for the attribute
Method Detail

execute

public void execute(ProjectManager pm)
             throws EditFailedException
Stores the original attribute and sets the new one.

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

redo

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

undo

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

canRedo

public boolean canRedo()
Specified by:
canRedo in interface UndoableEdit
Overrides:
canRedo in class AbstractUndoableEdit
See Also:
AbstractUndoableEdit.canRedo()

canUndo

public boolean canUndo()
Specified by:
canUndo in interface UndoableEdit
Overrides:
canUndo in class AbstractUndoableEdit
See Also:
AbstractUndoableEdit.canUndo()