kcl.waterloo.actions
Class ActionServices
- java.lang.Object
-
- kcl.waterloo.actions.ActionServices
-
public class ActionServices extends java.lang.ObjectThis class provides static methods for commmon menu and button actions used in various Waterloo project packages. These methods are intended primarily for use within Waterloo code - but may also be useful in user-developed menus/GUIs.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static voidcopy(GJBasicPanel panel)Copies the graphics of a GJBasicPanel or subclass to the clipboard.static voidcopyAsImage(GJBasicPanel panel)Copies the graphics of a GJBasicPanel or subclass to the clipboard in bitmap format only.static javax.swing.SwingWorker<java.lang.Boolean,java.lang.Void>copyGraphics(GJBasicPanel panel)Copies the graphics of a GJBasicPanel or subclass to the clipboard in the background.static voiddeployAs(java.awt.Component c2)static voiddeployAs(java.awt.Component parent, java.awt.Component c2)static voideditDefaults()static java.awt.ComponentgetCopyOrSaveTarget(java.awt.Component c)static java.lang.StringgetExtension(java.lang.String s)static booleanisExportFactoryPresent()static booleanisUseChooser()static FileWrapperopen()static FileWrapperopen(java.awt.Component parent)Displays a file open dialog, loads the selected Waterloo graphics XML file and returns the details in a FileWrapper instance.static FileWrappersave(java.awt.Component parent, java.lang.Object o)Displays a file chooser and saves the specified Object to file by calling the GJEncoder save method.static FileWrappersave(java.lang.Object o)static voidsaveAs(java.awt.Component c)static voidsaveAs(java.awt.Component parent, java.awt.Component c)Displays a file save dialog and saves a Component in the selected format.static voidsetUseChooser(boolean aUseChooser)
-
-
-
Method Detail
-
isUseChooser
public static boolean isUseChooser()
- Returns:
- the useChooser flag
-
setUseChooser
public static void setUseChooser(boolean aUseChooser)
- Parameters:
aUseChooser- if true, file dialogs will use the cross-platform JFileChooser. If false, a FileDialog will be used.
-
open
public static FileWrapper open()
-
open
public static FileWrapper open(java.awt.Component parent)
Displays a file open dialog, loads the selected Waterloo graphics XML file and returns the details in a FileWrapper instance. If the file contains multiple objects, the contents will be an ArrayList of objects.- Parameters:
parent- the component whose parent Frame (if any) will be used- Returns:
- the de-serialized file contents
-
save
public static FileWrapper save(java.lang.Object o)
-
save
public static FileWrapper save(java.awt.Component parent, java.lang.Object o)
Displays a file chooser and saves the specified Object to file by calling the GJEncoder save method.- Parameters:
parent-o- Object recognizable by GJDecoder- Returns:
- a FileWrapper
-
deployAs
public static void deployAs(java.awt.Component c2)
-
deployAs
public static void deployAs(java.awt.Component parent, java.awt.Component c2)
-
saveAs
public static void saveAs(java.awt.Component c)
-
saveAs
public static void saveAs(java.awt.Component parent, java.awt.Component c)Displays a file save dialog and saves a Component in the selected format.- Parameters:
parent-c- an AWT component
-
copy
public static void copy(GJBasicPanel panel)
Copies the graphics of a GJBasicPanel or subclass to the clipboard.- Parameters:
panel- a GJBasicPanel
-
copyGraphics
public static javax.swing.SwingWorker<java.lang.Boolean,java.lang.Void> copyGraphics(GJBasicPanel panel)
Copies the graphics of a GJBasicPanel or subclass to the clipboard in the background. Returns the associated SwingWorker.- Parameters:
panel- a GJBasicPanel- Returns:
- the SwingWorker
for the task
-
copyAsImage
public static void copyAsImage(GJBasicPanel panel)
Copies the graphics of a GJBasicPanel or subclass to the clipboard in bitmap format only.- Parameters:
panel- a GJBasicPanel
-
getCopyOrSaveTarget
public static java.awt.Component getCopyOrSaveTarget(java.awt.Component c)
-
editDefaults
public static void editDefaults()
-
isExportFactoryPresent
public static boolean isExportFactoryPresent()
- Returns:
- the Singleton.exportFactoryPresent
-
getExtension
public static java.lang.String getExtension(java.lang.String s)
-
-
DMelt 3.0 © DataMelt by jWork.ORG