svn commit: r12590 - trunk/src_new/org/argouml/uml: diagram/ui ui
[email protected] 10 May 2007 16:25:25 -0000
Newsgroups
gmane.comp.lang.uml.argouml.cvs
Message-ID
<[email protected] >
Author: tfmorris
Date: 2007-05-10 09:25:24-0700
New Revision: 12590
Modified:
trunk/src_new/org/argouml/uml/diagram/ui/ActionSaveDiagramToClipboard.java
trunk/src_new/org/argouml/uml/ui/ActionSaveAllGraphics.java
trunk/src_new/org/argouml/uml/ui/ActionSaveGraphics.java
Log:
Replace use of deprecated Cmd* classes
Modified: trunk/src_new/org/argouml/uml/diagram/ui/ActionSaveDiagramToClipboard.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/ActionSaveDiagramToClipboard.java?view=diff&rev=12590&p1=trunk/src_new/org/argouml/uml/diagram/ui/ActionSaveDiagramToClipboard.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/ActionSaveDiagramToClipboard.java&r1=12589&r2=12590
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/ui/ActionSaveDiagramToClipboard.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/ActionSaveDiagramToClipboard.java 2007-05-10 09:25:24-0700
@@ -43,7 +43,7 @@
import org.argouml.configuration.Configuration;
import org.argouml.i18n.Translator;
import org.argouml.uml.ui.SaveGraphicsManager;
-import org.tigris.gef.base.CmdSaveGIF;
+import org.tigris.gef.base.SaveGIFAction;
import org.tigris.gef.base.Editor;
import org.tigris.gef.base.Globals;
import org.tigris.gef.base.Layer;
@@ -118,7 +118,7 @@
}
// background color.
- g.setColor(new Color(CmdSaveGIF.TRANSPARENT_BG_COLOR));
+ g.setColor(new Color(SaveGIFAction.TRANSPARENT_BG_COLOR));
g.fillRect(0, 0, drawingArea.width * scale, drawingArea.height * scale);
g.translate(-drawingArea.x, -drawingArea.y);
ce.print(g);
@@ -191,7 +191,6 @@
* @see java.awt.datatransfer.Transferable#getTransferDataFlavors()
*/
public synchronized DataFlavor[] getTransferDataFlavors() {
-
return (supportedFlavors);
}
@@ -206,7 +205,6 @@
DataFlavor.imageFlavor.getMimeType()) && parFlavor
.getHumanPresentableName().equals(
DataFlavor.imageFlavor.getHumanPresentableName()));
-
}
/*
Modified: trunk/src_new/org/argouml/uml/ui/ActionSaveAllGraphics.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/ui/ActionSaveAllGraphics.java?view=diff&rev=12590&p1=trunk/src_new/org/argouml/uml/ui/ActionSaveAllGraphics.java&p2=trunk/src_new/org/argouml/uml/ui/ActionSaveAllGraphics.java&r1=12589&r2=12590
==============================================================================
--- trunk/src_new/org/argouml/uml/ui/ActionSaveAllGraphics.java (original)
+++ trunk/src_new/org/argouml/uml/ui/ActionSaveAllGraphics.java 2007-05-10 09:25:24-0700
@@ -29,6 +29,7 @@
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.net.MalformedURLException;
import java.util.Iterator;
import java.util.Vector;
@@ -44,19 +45,19 @@
import org.argouml.ui.ArgoFrame;
import org.argouml.ui.ProjectBrowser;
import org.argouml.ui.targetmanager.TargetManager;
+import org.tigris.gef.base.SaveGraphicsAction;
import org.argouml.uml.diagram.ArgoDiagram;
-import org.tigris.gef.base.CmdSaveGraphics;
import org.tigris.gef.base.Diagram;
import org.tigris.gef.undo.UndoableAction;
import org.tigris.gef.util.Util;
-
/**
* Wraps a CmdSaveGIF or CmdSave(E)PS to allow selection of an output file.
* Introduced thanks to issue 2126. Saves diagrams only as GIFs. <p>
*
* TODO: Add a user choice for other formats (PNG, SVG,...)
- *
+ * TODO: Why is this an UndoableAction? (and how?) - tfm
+ *
* @author Leonardo Souza Mario Bueno ([email protected] )
*/
@@ -64,10 +65,6 @@
private static final Logger LOG =
Logger.getLogger(ActionSaveAllGraphics.class);
-
- ////////////////////////////////////////////////////////////////
- // constructors
-
/**
* The constructor.
*
@@ -80,13 +77,7 @@
Translator.localize("action.save-all-graphics"));
}
-
- ////////////////////////////////////////////////////////////////
- // main methods
-
- /*
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
+ @Override
public void actionPerformed( ActionEvent ae ) {
super.actionPerformed(ae);
trySave( false );
@@ -141,7 +132,7 @@
if ( target instanceof Diagram ) {
String defaultName = ((Diagram) target).getName();
defaultName = Util.stripJunk(defaultName);
- // FIX - It's probably worthwhile to abstract and factor
+ // TODO: It's probably worthwhile to abstract and factor
// this chooser and directory stuff. More file handling is
// coming, I'm sure.
try {
@@ -149,8 +140,8 @@
+ SaveGraphicsManager.getInstance().getDefaultSuffix());
String name = theFile.getName();
String path = theFile.getParent();
- CmdSaveGraphics cmd = SaveGraphicsManager.getInstance()
- .getSaveCommandBySuffix(
+ SaveGraphicsAction cmd = SaveGraphicsManager.getInstance()
+ .getSaveActionBySuffix(
SaveGraphicsManager.getInstance().getDefaultSuffix());
if (cmd == null) {
pb.showStatus("Unknown graphics file type with extension "
@@ -199,7 +190,7 @@
return null;
}
- private boolean saveGraphicsToFile(File theFile, CmdSaveGraphics cmd,
+ private boolean saveGraphicsToFile(File theFile, SaveGraphicsAction cmd,
boolean overwrite) throws IOException {
if ( theFile.exists() && !overwrite ) {
int response =
@@ -216,7 +207,7 @@
cmd.setStream(fo);
cmd.setScale(Configuration.getInteger(
SaveGraphicsManager.KEY_GRAPHICS_RESOLUTION, 1));
- cmd.doIt();
+ cmd.actionPerformed(null);
} finally {
if (fo != null) {
fo.close();
@@ -234,7 +225,7 @@
chooser = new JFileChooser(p.getURI().toURL().getFile());
}
}
- catch ( Exception ex ) {
+ catch ( MalformedURLException ex ) {
LOG.error("exception in opening JFileChooser", ex);
}
@@ -247,4 +238,4 @@
return chooser;
}
-} /* end class ActionSaveAllGraphics */
+}
Modified: trunk/src_new/org/argouml/uml/ui/ActionSaveGraphics.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/ui/ActionSaveGraphics.java?view=diff&rev=12590&p1=trunk/src_new/org/argouml/uml/ui/ActionSaveGraphics.java&p2=trunk/src_new/org/argouml/uml/ui/ActionSaveGraphics.java&r1=12589&r2=12590
==============================================================================
--- trunk/src_new/org/argouml/uml/ui/ActionSaveGraphics.java (original)
+++ trunk/src_new/org/argouml/uml/ui/ActionSaveGraphics.java 2007-05-10 09:25:24-0700
@@ -45,7 +45,7 @@
import org.argouml.ui.ExceptionDialog;
import org.argouml.ui.ProjectBrowser;
import org.argouml.util.SuffixFilter;
-import org.tigris.gef.base.CmdSaveGraphics;
+import org.tigris.gef.base.SaveGraphicsAction;
import org.tigris.gef.base.Diagram;
import org.tigris.gef.util.Util;
@@ -164,9 +164,9 @@
throws FileNotFoundException, IOException {
SaveGraphicsManager sgm = SaveGraphicsManager.getInstance();
- CmdSaveGraphics cmd = null;
+ SaveGraphicsAction cmd = null;
- cmd = sgm.getSaveCommandBySuffix(suffix);
+ cmd = sgm.getSaveActionBySuffix(suffix);
if (cmd == null) {
return false;
}
@@ -190,7 +190,7 @@
cmd.setStream(fo);
cmd.setScale(Configuration.getInteger(
SaveGraphicsManager.KEY_GRAPHICS_RESOLUTION, 1));
- cmd.doIt();
+ cmd.actionPerformed(null);
fo.close();
if (useUI) {
ProjectBrowser.getInstance().showStatus("Wrote " + theFile);
@@ -229,4 +229,4 @@
}
return false;
}
-} /* end class ActionSaveGraphics */
+}