com.tensegrity.skeleton.swt.commands
Class SwtGraphDocumentCommand

java.lang.Object
  extended bycom.tensegrity.generic.command.BaseCommand
      extended bycom.tensegrity.skeleton.commands.CommonBaseCommand
          extended bycom.tensegrity.skeleton.swt.commands.SwtCommonBaseCommand
              extended bycom.tensegrity.skeleton.swt.commands.SwtDocumentCommand
                  extended bycom.tensegrity.skeleton.swt.commands.SwtGraphDocumentCommand
All Implemented Interfaces:
Command
Direct Known Subclasses:
SwtCloneDocumentCommand, SwtEditGraphDocumentCommand, SwtPageSetupCommand, SwtPrintCommand, SwtPrintPreviewCommand, SwtRuleEditorCommand

public abstract class SwtGraphDocumentCommand
extends SwtDocumentCommand

This command, to be used within applications in a SWT context, extends the SwtDocumentCommand in the way that it is only valid if the active Document is a instance of GraphDocument.

Note that instances of SwtGraphDocumentCommand are disabled when no GraphDocument is selected.

The getGraphDocument() method is provided in order to retrieve the currently selected GraphDocument.

Version:
$Id: SwtGraphDocumentCommand.java,v 1.3 2005/08/02 08:12:04 SebastienGuyon Exp $
Author:
S�bastien Guyon

Constructor Summary
SwtGraphDocumentCommand(ApplicationFrame applicationFrame, java.lang.String command)
          Creates the SwtGraphDocumentCommand.
 
Method Summary
protected  GraphDocument getGraphDocument()
          Returns the current document as GraphDocument, if it is one, otherwise null.
 VisualGraphView getVisualGraphView()
          Returns the VisualGraphView of the currently active graph document.
 boolean isEnabled()
          Returns false if SwtDocumentCommand.getDocument() returns null, true otherwise.
 
Methods inherited from class com.tensegrity.skeleton.swt.commands.SwtDocumentCommand
getDocument
 
Methods inherited from class com.tensegrity.skeleton.swt.commands.SwtCommonBaseCommand
getGraphApplication, newGraphDocumentFromFactory
 
Methods inherited from class com.tensegrity.skeleton.commands.CommonBaseCommand
getApplicationFrame, getTitle, perform
 
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

SwtGraphDocumentCommand

public SwtGraphDocumentCommand(ApplicationFrame applicationFrame,
                               java.lang.String command)
Creates the SwtGraphDocumentCommand.

Parameters:
applicationFrame - Application context of this command.
command - the ID of this command.
Method Detail

isEnabled

public boolean isEnabled()
Description copied from class: SwtDocumentCommand
Returns false if SwtDocumentCommand.getDocument() returns null, true otherwise.

Specified by:
isEnabled in interface Command
Overrides:
isEnabled in class SwtDocumentCommand
Returns:
false if SwtDocumentCommand.getDocument() returns null, true otherwise.
See Also:
Command.isEnabled()

getVisualGraphView

public VisualGraphView getVisualGraphView()
Returns the VisualGraphView of the currently active graph document. This method returns null either when DocumentCommand.getDocument() method returns null, or when the current document is not of type GraphDocument.

Returns:
the VisualGraphView of the current GraphDocument.

getGraphDocument

protected GraphDocument getGraphDocument()
Returns the current document as GraphDocument, if it is one, otherwise null.

Returns:
the GraphDocument or null.


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