public class DialogUtils
extends java.lang.Object
Constructor and Description |
---|
DialogUtils()
Constructor method for i18n purposes only.
|
Modifier and Type | Method and Description |
---|---|
static java.awt.Point |
centerForScreen(int width,
int height)
Calculates the position for the current screen.
|
static java.awt.Point |
centerForWindow(java.awt.Window parent,
int width,
int height)
Calculates the position for a dialog window on the screen.
|
static void |
copyScreenShot(java.awt.image.BufferedImage screenshot)
Copies the screenshot to the system clipboard for other applications to use.
|
static javax.swing.JDialog |
createComponentDialog(java.awt.Component comp,
java.awt.Window window,
java.lang.String title,
javax.swing.ImageIcon icon)
Creates a new separate dialog window to display a component.
|
static javax.swing.JFrame |
createComponentFrame(java.awt.Component comp,
java.awt.Window window,
java.lang.String title,
javax.swing.ImageIcon icon)
Creates a new separate frame window to display a component.
|
static java.awt.Container[] |
findParents(java.awt.Component comp,
java.lang.Class type)
Determines the component's parent containers of special type.
|
static java.awt.Container[] |
findParents(java.awt.Component comp,
java.lang.String clazz)
Determines the component's parent containers of special type.
|
static java.awt.Window |
getActiveWindow(java.awt.Component comp)
Provides the window on top of the window hierarchy of the given component.
|
static ConfigurableUnit |
getConfigurableUnit(javax.swing.JFileChooser chooser)
Convenience to get a
ConfigurableUnit for JFileChooser . |
static java.awt.Dialog |
getDialogParent(java.awt.Component comp)
Determines the component's top-level container.
|
static java.lang.String |
getDisplayType(java.lang.Class clazz)
Convenience to get a display type for a certain Commons dialog type.
|
static java.awt.Frame |
getFrameParent(java.awt.Component comp)
Determines the component's top-level container.
|
static java.awt.image.BufferedImage |
getScreenShot(java.awt.Component target)
Takes a screenshot of the given window.
|
static java.awt.Window |
getWindowParent(java.awt.Component comp)
Determines the component's top-level container.
|
static void |
printScreenShot(java.awt.image.BufferedImage screenshot,
java.lang.String jobname)
Takes a screenshot of the given window and opens a print dialog.
|
static boolean |
saveData(java.io.InputStream istream,
java.awt.Component parent,
java.lang.String unitid,
ApplicationModel model,
java.lang.String filename,
SuffixFilter[] filters,
boolean allfilter,
SuffixFilter defaultfilter,
java.util.Vector<java.io.File> target)
Presents a file chooser dialog and writes the data to the file.
|
static boolean |
saveData(java.io.InputStream istream,
java.awt.Component parent,
java.lang.String unitid,
ApplicationModel model,
java.lang.String filename,
SuffixFilter[] filters,
boolean allfilter,
SuffixFilter defaultfilter,
java.util.Vector<org.apache.commons.vfs2.FileObject> target,
java.util.Vector<VFSConnection> connections,
VFSConnection vfsconn,
DockingManager dockingmanager,
boolean editingallowed)
Presents a file chooser dialog and writes the data to the URL.
|
static boolean |
saveData(java.io.InputStream istream,
java.awt.Component parent,
java.lang.String unitid,
ApplicationModel model,
java.lang.String filename,
java.util.Vector<java.io.File> target)
Presents a file chooser dialog and writes the data to the file.
|
static boolean |
saveData(java.io.InputStream istream,
java.awt.Component parent,
java.lang.String unitid,
ApplicationModel model,
java.lang.String filename,
java.util.Vector<org.apache.commons.vfs2.FileObject> target,
java.util.Vector<VFSConnection> connections,
VFSConnection vfsconn,
DockingManager dockingmanager,
boolean editingallowed)
Presents a file chooser dialog and writes the data to the URL.
|
static java.io.File |
saveScreenShot(java.awt.image.BufferedImage screenshot,
java.awt.Component parent,
java.lang.String unitid,
ApplicationModel model,
java.lang.String filename)
Presents a file chooser dialog and writes the image to the file.
|
public DialogUtils() throws java.lang.InstantiationException
I18NExtractor
).
java.lang.InstantiationException
- Error indicationpublic static java.io.File saveScreenShot(java.awt.image.BufferedImage screenshot, java.awt.Component parent, java.lang.String unitid, ApplicationModel model, java.lang.String filename)
screenshot
- The screenshot to be storedparent
- The parent componentunitid
- The unique identifier for the instance, maybe null
model
- The configuration, maybe null
filename
- The desired filename, maybe null
null
indicates errorpublic static java.awt.Point centerForWindow(java.awt.Window parent, int width, int height)
null
then the point is calculated for the whole desktop automatically.
parent
- The parent window to center the dialog, for desktop if null
width
- The width of the dialog to be centeredheight
- The height of the dialog to be centeredpublic static java.awt.Point centerForScreen(int width, int height)
width
- The width of the dialog to be centeredheight
- The height of the dialog to be centeredpublic static java.awt.Dialog getDialogParent(java.awt.Component comp)
comp
- The desired componentnull
java.lang.NullPointerException
- Error casepublic static java.awt.Frame getFrameParent(java.awt.Component comp)
comp
- The desired componentnull
java.lang.NullPointerException
- Error casepublic static java.awt.Window getActiveWindow(java.awt.Component comp)
comp
- The component to be analyzednull
java.lang.NullPointerException
- If the parameters are null
public static java.awt.Window getWindowParent(java.awt.Component comp)
comp
- The desired componentnull
java.lang.NullPointerException
- Error casepublic static java.awt.Container[] findParents(java.awt.Component comp, java.lang.String clazz)
null
).
comp
- The desired componentclazz
- The desired parent type in FQN, may be null
java.lang.NullPointerException
- Error casepublic static java.awt.Container[] findParents(java.awt.Component comp, java.lang.Class type)
null
).
comp
- The desired componenttype
- The desired parent type, may be null
java.lang.NullPointerException
- Error casepublic static java.awt.image.BufferedImage getScreenShot(java.awt.Component target)
invokeLater()
.
target
- The GUI component to shoot, whole screen if null
null
if an error occurspublic static void printScreenShot(java.awt.image.BufferedImage screenshot, java.lang.String jobname)
screenshot
- The screenshot to be printedjobname
- The application specific job name, may be null
public static void copyScreenShot(java.awt.image.BufferedImage screenshot)
screenshot
- The screenshot to be copiedpublic static boolean saveData(java.io.InputStream istream, java.awt.Component parent, java.lang.String unitid, ApplicationModel model, java.lang.String filename, java.util.Vector<java.io.File> target)
istream
- The data stream to be storedparent
- The parent componentunitid
- The unique identifier for the instance, maybe null
model
- The configuration, maybe null
filename
- The desired filename, maybe null
target
- Data holder for target file, empty on cancelpublic static boolean saveData(java.io.InputStream istream, java.awt.Component parent, java.lang.String unitid, ApplicationModel model, java.lang.String filename, SuffixFilter[] filters, boolean allfilter, SuffixFilter defaultfilter, java.util.Vector<java.io.File> target)
istream
- The data stream to be storedparent
- The parent componentunitid
- The unique identifier for the instance, maybe null
model
- The configuration, maybe null
filename
- The desired filename, maybe null
filters
- The suffix filters (optional)allfilter
- Add the default filter *.*?defaultfilter
- Default filter to select initially (optional)target
- Data holder for target file, empty on cancelpublic static boolean saveData(java.io.InputStream istream, java.awt.Component parent, java.lang.String unitid, ApplicationModel model, java.lang.String filename, java.util.Vector<org.apache.commons.vfs2.FileObject> target, java.util.Vector<VFSConnection> connections, VFSConnection vfsconn, DockingManager dockingmanager, boolean editingallowed)
istream
- The data stream to be storedparent
- The parent componentunitid
- The unique identifier for the instance, maybe null
model
- The configuration, maybe null
filename
- The desired filename, maybe null
target
- Data holder for target URL, empty on cancelconnections
- The VFS connections to present with combo boxvfsconn
- The selected connection (optional)dockingmanager
- The docking manager (optional)editingallowed
- Connection management?public static boolean saveData(java.io.InputStream istream, java.awt.Component parent, java.lang.String unitid, ApplicationModel model, java.lang.String filename, SuffixFilter[] filters, boolean allfilter, SuffixFilter defaultfilter, java.util.Vector<org.apache.commons.vfs2.FileObject> target, java.util.Vector<VFSConnection> connections, VFSConnection vfsconn, DockingManager dockingmanager, boolean editingallowed)
istream
- The data stream to be storedparent
- The parent componentunitid
- The unique identifier for the instance, maybe null
model
- The configuration, maybe null
filename
- The desired filename, maybe null
filters
- The suffix filters (optional)allfilter
- Add the default filter *.*?defaultfilter
- Default filter to select initially (optional)target
- Data holder for target URL, empty on cancelconnections
- The VFS connections to present with combo boxvfsconn
- The selected connection (optional)dockingmanager
- The docking manager (optional)editingallowed
- Connection management?public static java.lang.String getDisplayType(java.lang.Class clazz)
clazz
- The dialog classpublic static ConfigurableUnit getConfigurableUnit(javax.swing.JFileChooser chooser)
ConfigurableUnit
for JFileChooser
.
chooser
- The target file chooserpublic static javax.swing.JDialog createComponentDialog(java.awt.Component comp, java.awt.Window window, java.lang.String title, javax.swing.ImageIcon icon)
comp
- The componentwindow
- The parental window (optional)title
- The decoration text (optional)icon
- The dialog icon (optional)java.lang.NullPointerException
- If a parameter is null
public static javax.swing.JFrame createComponentFrame(java.awt.Component comp, java.awt.Window window, java.lang.String title, javax.swing.ImageIcon icon)
comp
- The componentwindow
- The parental window (optional)title
- The decoration text (optional)icon
- The dialog icon (optional)java.lang.NullPointerException
- If a parameter is null
Copyright © 2005-2013 Leisenfels UG (haftungsbeschränkt). All rights reserved.