com.tensegrity.skeleton.swt.commands
Class SwtInsertImageCommand

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

public class SwtInsertImageCommand
extends AbstractInsertElementCommand

This command, to be used within applications in a SWT context, is used in order to insert a VisualNode containing an image on the active GraphDocument. The inserted image is choosen by the application user when presented a FileDialog dialog.

Version:
$Id: SwtInsertImageCommand.java,v 1.4 2005/08/02 08:18:44 SebastienGuyon Exp $
Author:
Arnd Houben

Field Summary
 
Fields inherited from class com.tensegrity.skeleton.commands.AbstractInsertElementCommand
ELEMENTNAME_CHART_NODE, ELEMENTNAME_IMAGE, ELEMENTNAME_TABLE_NODE
 
Constructor Summary
SwtInsertImageCommand(ApplicationFrame applicationFrame, java.lang.String command)
          Creates the SwtInsertImageCommand which is used in order to insert a VisualNode containing an image on the active GraphDocument.
 
Method Summary
 void addImage(java.io.File imgFile)
          Adds a visual node representing the given image file to the current graph document at the given coordinates.
 boolean isEnabled()
          Overridden to restrict the availability of this command to the case that the "ImageNode" element is in the pool.
 void perform(java.lang.Object args)
          Updates the StatusBar with this commands title string.
 
Methods inherited from class com.tensegrity.skeleton.commands.AbstractInsertElementCommand
addElement, addElement, toLog
 
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

SwtInsertImageCommand

public SwtInsertImageCommand(ApplicationFrame applicationFrame,
                             java.lang.String command)
Creates the SwtInsertImageCommand which is used in order to insert a VisualNode containing an image on the active GraphDocument.

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

perform

public final 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)

addImage

public void addImage(java.io.File imgFile)
Adds a visual node representing the given image file to the current graph document at the given coordinates. A raster is created for each file and is pooled in the ImagePool of the framework, so it's only loaded once.

Parameters:
imgFile - The image file to load

isEnabled

public boolean isEnabled()
Overridden to restrict the availability of this command to the case that the "ImageNode" element is in the pool.

Specified by:
isEnabled in interface Command
Overrides:
isEnabled in class GraphDocumentCommand
Returns:
True, if the command is currently available


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