com.tensegrity.skeleton.swt.commands
Class SwtCloseCommand

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.SwtCloseCommand
All Implemented Interfaces:
Command

public class SwtCloseCommand
extends SwtDocumentCommand

This command, to be used within applications in a SWT context, closes the currently active Document. If this document is modified users may save it before it gets closed.

While by default the perform method closes the active Document (See SwtDocumentCommand.getDocument()), one can use the closeDocument(Document) method in order to close a specific Document.

Version:
$Id: SwtCloseCommand.java,v 1.7 2005/08/01 09:41:04 SebastienGuyon Exp $
Author:
MichaelKegel, Gilles Iachelini, Stepan RUtz, S�bastien Guyon

Constructor Summary
SwtCloseCommand(ApplicationFrame applicationFrame, java.lang.String command)
          Creates the command used to close the currently active Document.
 
Method Summary
 int closeDocument(Document document)
          Closes the given document.
 boolean isEnabled()
          Returns false if SwtDocumentCommand.getDocument() returns null, true otherwise.
 void perform(java.lang.Object args)
          Updates the StatusBar with this commands title string.
 
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
 
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

SwtCloseCommand

public SwtCloseCommand(ApplicationFrame applicationFrame,
                       java.lang.String command)
Creates the command used to close the currently active Document.

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

perform

public void perform(java.lang.Object args)
Description copied from class: CommonBaseCommand
Updates the StatusBar with this commands title string. (non-Javadoc)

Specified by:
perform in interface Command
Overrides:
perform in class CommonBaseCommand
See Also:
Command.perform(java.lang.Object)

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

closeDocument

public int closeDocument(Document document)
Closes the given document. This method only applies to instances of GraphDocument. If the document is modified users may save it before activating the close.

Parameters:
document - the document instance to close.
Returns:
users selected option.


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