org.argouml.uml.ui
Class ActionSaveGraphics

java.lang.Object
  |
  +--javax.swing.AbstractAction
        |
        +--org.argouml.uml.ui.UMLAction
              |
              +--org.argouml.uml.ui.ActionSaveGraphics
All Implemented Interfaces:
javax.swing.Action, java.awt.event.ActionListener, java.lang.Cloneable, CommandLineInterface, java.util.EventListener, java.io.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

Field Summary
protected static Logger cat
          Deprecated. as of 0.15.4. Will be made private. Use your own logger.
static java.lang.String separator
          Deprecated. by Linus Tolke as of 0.15.4. Get this information from some java.io class.
static ActionSaveGraphics SINGLETON
          Deprecated. by Linus Tolke as of 0.15.4 this should not be used. We are changing this action so that it will no longer be a singleton. Use the constructor to create yourself a new instance of this object instead.
 
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(java.awt.event.ActionEvent ae)
          Perform the work the action is supposed to do.
 boolean doCommand(java.lang.String argument)
          Execute this action from the command line.
private  boolean doSave(java.io.File theFile, java.lang.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, getShortcut, getValue, isEnabled, markNeedsSave, putValue, shouldBeEnabled, stripJunk, 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

cat

protected static Logger cat
Deprecated. as of 0.15.4. Will be made private. Use your own logger.


SINGLETON

public static ActionSaveGraphics SINGLETON
Deprecated. by Linus Tolke as of 0.15.4 this should not be used. We are changing this action so that it will no longer be a singleton. Use the constructor to create yourself a new instance of this object instead.


separator

public static final java.lang.String separator
Deprecated. by Linus Tolke as of 0.15.4. Get this information from some java.io class.

See Also:
java.io, Constant Field Values
Constructor Detail

ActionSaveGraphics

public ActionSaveGraphics()
Constructor for this action.

Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent ae)
Description copied from class: UMLAction
Perform the work the action is supposed to do.

Specified by:
actionPerformed in interface java.awt.event.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(java.io.File theFile,
                       java.lang.String suffix,
                       boolean overwrite)
                throws java.io.FileNotFoundException,
                       java.io.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.
java.io.FileNotFoundException
java.io.IOException

doCommand

public boolean doCommand(java.lang.String argument)
Execute this action from the command line.

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 (20040306)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook