com.tensegrity.skeleton.commands
Class AbstractAlignCommand

java.lang.Object
  extended bycom.tensegrity.generic.command.BaseCommand
      extended bycom.tensegrity.skeleton.commands.CommonBaseCommand
          extended bycom.tensegrity.skeleton.commands.DocumentCommand
              extended bycom.tensegrity.skeleton.commands.GraphDocumentCommand
                  extended bycom.tensegrity.skeleton.commands.EditGraphDocumentCommand
                      extended bycom.tensegrity.skeleton.commands.GraphDocumentSelectionCommand
                          extended bycom.tensegrity.skeleton.commands.AbstractAlignCommand
All Implemented Interfaces:
Command
Direct Known Subclasses:
AbstractAlignHorizontalCommand, AbstractAlignVerticalCommand

public abstract class AbstractAlignCommand
extends GraphDocumentSelectionCommand

Abstract base class for align commands which provides the basic functionality for gathering the selected elements and revalidating the graph afterwards.


Constructor Summary
AbstractAlignCommand(ApplicationFrame applicationFrame, java.lang.String command)
          Constructor
 
Method Summary
abstract  void alignElements(VisualGraphObject refElement, java.util.List elements)
          Aligns the given elements according to the specific command implementation
 int getMinimumNodeDistance()
          Returns the minimum node distance which can used to move overlapping nodes apart.
protected  java.util.List getSelection()
          Gathers the selected nodes and returns them as a list.
 boolean isEnabled()
          Checks if there is something selected in the current document.
 void perform(java.lang.Object args)
          Gathers selected elements from graph and performs the align action.
 void setMinimumNodeDistance(int minimumNodeDistance)
          Sets the minimum node distance which can used to move overlapping nodes apart.
 
Methods inherited from class com.tensegrity.skeleton.commands.GraphDocumentSelectionCommand
hasSelection
 
Methods inherited from class com.tensegrity.skeleton.commands.GraphDocumentCommand
getGraphDocument, getVisualGraphView
 
Methods inherited from class com.tensegrity.skeleton.commands.DocumentCommand
getDocument, getGraphApplication, newGraphDocumentFromFactory
 
Methods inherited from class com.tensegrity.skeleton.commands.CommonBaseCommand
getApplicationFrame, getTitle
 
Methods inherited from class com.tensegrity.generic.command.BaseCommand
getDescription, getId, getPerformDescription, setEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractAlignCommand

public AbstractAlignCommand(ApplicationFrame applicationFrame,
                            java.lang.String command)
Constructor

Parameters:
applicationFrame - The application frame
command - The id of this command, will be used to register in the commandregistry
Method Detail

alignElements

public abstract void alignElements(VisualGraphObject refElement,
                                   java.util.List elements)
Aligns the given elements according to the specific command implementation

Parameters:
refElement - The reference element
elements - All elements to be aligned (usually includes the reference element)

perform

public void perform(java.lang.Object args)
Gathers selected elements from graph and performs the align action.

Specified by:
perform in interface Command
Overrides:
perform in class CommonBaseCommand
Parameters:
args - Is ignored
See Also:
Command.perform(java.lang.Object)

getMinimumNodeDistance

public int getMinimumNodeDistance()
Returns the minimum node distance which can used to move overlapping nodes apart.

Returns:
Returns the minimumNodeDistance.

setMinimumNodeDistance

public void setMinimumNodeDistance(int minimumNodeDistance)
Sets the minimum node distance which can used to move overlapping nodes apart.

Parameters:
minimumNodeDistance - The minimumNodeDistance to set.

getSelection

protected java.util.List getSelection()
Gathers the selected nodes and returns them as a list.

Overrides:
getSelection in class GraphDocumentSelectionCommand
Returns:
The selected elements as list.

isEnabled

public boolean isEnabled()
Description copied from class: GraphDocumentSelectionCommand
Checks if there is something selected in the current document.

Specified by:
isEnabled in interface Command
Overrides:
isEnabled in class GraphDocumentSelectionCommand
See Also:
EditGraphDocumentCommand.isEnabled()


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.