com.tensegrity.skeleton.swt.commands
Class SwtSaveAsCommand

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.SaveVisualGraphCommand
                      extended bycom.tensegrity.skeleton.swt.commands.SwtSaveAsCommand
All Implemented Interfaces:
Command

public class SwtSaveAsCommand
extends SaveVisualGraphCommand

This command, to be used within applications in a SWT context, brings up a SwtGraphFileChooserDialog asking the user where he wants to save a copy of the currently active GraphDocument.

Version:
$Id: SwtSaveAsCommand.java,v 1.22 2005/12/08 16:32:44 ArndHouben Exp $
Author:
Sebastien Guyon

Constructor Summary
SwtSaveAsCommand(ApplicationFrame applicationFrame, java.lang.String command)
          Creates a new SwtSaveAsCommand.
 
Method Summary
protected  void doSave(ExportSettings expSettings, int type, org.eclipse.swt.graphics.Image image, SwtGraphPanel sgp, GraphDocument gDoc, java.io.File file)
           This routines performs the saving of the passed document or image depending on type.
 GraphDocument getDocumentToSaveAs()
           Returns the GraphDocument which has to be saved as ...
protected  GraphFileChooser getFileChooser(org.eclipse.swt.widgets.Shell parent)
          Returns the file chooser which should be used for the save as dialog.
 java.lang.String getNewName()
           Return the new name for the copy
 void perform(java.lang.Object args)
          Will show a dialog to set the destination and the format to save the graph to.
protected  void postPerform(int type, GraphDocument docToSaveAs, GraphDocument copy)
           This method gives a chance to subclasses to perform extra actions once the command is performed
 void setNewName(java.lang.String newName)
           Stores the new name for the copy
 
Methods inherited from class com.tensegrity.skeleton.commands.SaveVisualGraphCommand
isEnabled
 
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

SwtSaveAsCommand

public SwtSaveAsCommand(ApplicationFrame applicationFrame,
                        java.lang.String command)
Creates a new SwtSaveAsCommand.

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

perform

public void perform(java.lang.Object args)
Will show a dialog to set the destination and the format to save the graph to.

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

postPerform

protected void postPerform(int type,
                           GraphDocument docToSaveAs,
                           GraphDocument copy)

This method gives a chance to subclasses to perform extra actions once the command is performed

Parameters:
type - the type of the copy
docToSaveAs - the initial graph document
copy - the new graph document

doSave

protected void doSave(ExportSettings expSettings,
                      int type,
                      org.eclipse.swt.graphics.Image image,
                      SwtGraphPanel sgp,
                      GraphDocument gDoc,
                      java.io.File file)

This routines performs the saving of the passed document or image depending on type.

Parameters:
expSettings - these are the export settings for the new image.
type - one of:
image - the image to save. Can be null if type is GraphFileConstants.TYPE_RASTER_BITMAP.
sgp - the SwtGraphPanel
gDoc - the GraphDocument
file - the File to save.

getNewName

public java.lang.String getNewName()

Return the new name for the copy

Returns:
the new name for the copy

setNewName

public void setNewName(java.lang.String newName)

Stores the new name for the copy

Parameters:
newName - the new name for the copy

getDocumentToSaveAs

public GraphDocument getDocumentToSaveAs()

Returns the GraphDocument which has to be saved as ...

Returns:
the GraphDocument which has to be saved as ...

getFileChooser

protected GraphFileChooser getFileChooser(org.eclipse.swt.widgets.Shell parent)
Returns the file chooser which should be used for the save as dialog. Any extending classes can use this method to introduce its own file chooser version.

Parameters:
parent -
Returns:


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