pl.edu.agh.cast.backward.command
Class ModifyAttributesCommand

java.lang.Object
  extended by org.eclipse.gef.commands.Command
      extended by pl.edu.agh.cast.backward.command.ModifyAttributesCommand

public class ModifyAttributesCommand
extends org.eclipse.gef.commands.Command

Sets new values in AttributeValueContainer. Command used in pl.edu.agh.cast.ui.backward.dialogs.AttributeEditorDialog.

Author:
AGH CAST Team

Constructor Summary
ModifyAttributesCommand(AttributeValueContainer element, Collection<AttributeValue> newAttributeValues)
          Creates new instance of attribute modification command.
 
Method Summary
 boolean canExecute()
          Command can be executed only if: attributes were added or removed attribute values were changed attribute's showAsLabel flag changed Otherwise, command cannot be executed.
 void execute()
          
protected  void fillAttributeHolder(Collection<AttributeValue> newAttributeValues)
          Changes attributes and it's values in attributesHolder to attributes attached in input newAttributesValues Collection.
 void undo()
          
 
Methods inherited from class org.eclipse.gef.commands.Command
canUndo, chain, dispose, getDebugLabel, getLabel, redo, setDebugLabel, setLabel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModifyAttributesCommand

public ModifyAttributesCommand(AttributeValueContainer element,
                               Collection<AttributeValue> newAttributeValues)
Creates new instance of attribute modification command.

Parameters:
element - element whose attributes are to be modified
newAttributeValues - collection of new AttributeValues
Method Detail

canExecute

public boolean canExecute()
Command can be executed only if: Otherwise, command cannot be executed.

Overrides:
canExecute in class org.eclipse.gef.commands.Command
See Also:
Command.canExecute()

execute

public void execute()

Overrides:
execute in class org.eclipse.gef.commands.Command
See Also:
Command.execute()

undo

public void undo()

Overrides:
undo in class org.eclipse.gef.commands.Command
See Also:
Command.undo()

fillAttributeHolder

protected void fillAttributeHolder(Collection<AttributeValue> newAttributeValues)
Changes attributes and it's values in attributesHolder to attributes attached in input newAttributesValues Collection. Also change attributes' isLabel properties.

Parameters:
newAttributeValues - New attributes collection to set in attributesHolder.


Copyright © 2007-2009 IISG AGH-UST Krakow, Poland. All Rights Reserved.