org.argouml.uml.ui
Class ActionSaveGraphics

java.lang.Object
  extended byjavax.swing.AbstractAction
      extended byorg.argouml.uml.ui.UMLAction
          extended byorg.argouml.uml.ui.ActionSaveGraphics
All Implemented Interfaces:
Action, ActionListener, Cloneable, CommandLineInterface, EventListener, Serializable

public class ActionSaveGraphics
extends UMLAction
implements CommandLineInterface

Wraps a CmdSaveGIF or CmdSave(E)PS to allow selection of an output file.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.AbstractAction
 
Field Summary
private static Logger LOG
           
 
Fields inherited from class org.argouml.uml.ui.UMLAction
HAS_ICON, NO_ICON
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
ActionSaveGraphics()
          Constructor for this action.
 
Method Summary
 void actionPerformed(ActionEvent ae)
          Perform the work the action is supposed to do.
 boolean doCommand(String argument)
          Execute this action from the command line.
private  boolean doSave(File theFile, String suffix, boolean overwrite)
          Actually do the saving.
 boolean trySave(boolean overwrite)
          Method that does almost everything in this class.
 
Methods inherited from class org.argouml.uml.ui.UMLAction
getMnemonic, getValue, isEnabled, putValue, shouldBeEnabled, updateEnabled, updateEnabled
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

private static final Logger LOG
Constructor Detail

ActionSaveGraphics

public ActionSaveGraphics()
Constructor for this action.

Method Detail

actionPerformed

public void actionPerformed(ActionEvent ae)
Description copied from class: UMLAction
Perform the work the action is supposed to do. This method needs to be overridden by all actions, since it only shows a fake progressbar...

Specified by:
actionPerformed in interface ActionListener
Overrides:
actionPerformed in class UMLAction
See Also:
UMLAction.actionPerformed(ActionEvent)

trySave

public boolean trySave(boolean overwrite)
Method that does almost everything in this class.

Parameters:
overwrite - True if we shouldn't care that we erase an old copy.
Returns:
true if all went well.

doSave

private boolean doSave(File theFile,
                       String suffix,
                       boolean overwrite)
                throws FileNotFoundException,
                       IOException
Actually do the saving.

Parameters:
theFile - is the file that we are writing to
suffix - is the suffix. Used for deciding what format the file shall have.
overwrite - is true if we are not supposed to warn that we are replacing an old file.
Returns:
true if it was successful.
Throws:
FileNotFoundException
IOException

doCommand

public boolean doCommand(String argument)
Execute this action from the command line. TODO: The underlying GEF library relies on Acme that doesn't allow us to create these files unless there is a window showing. For this reason I have had to split the performing of commands in Main.main(String[]) so that we can, by not supplying the -batch option, run these commands with the window showing. Hopefully this can eventually be fixed.

Specified by:
doCommand in interface CommandLineInterface
Parameters:
argument - is the file name that we save to.
Returns:
true if it is OK.
See Also:
CommandLineInterface.doCommand(String)


ArgoUML © 1996-2004 (20050222)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook