|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xnap.commons.gui.Dialogs
public class Dialogs
Provides a set of static methods to display common dialogs.
Nested Class Summary | |
---|---|
static class |
Dialogs.FileListCellRenderer
This class provides a list renderer for File objects. |
Constructor Summary | |
---|---|
Dialogs()
|
Method Summary | |
---|---|
static boolean |
executeCopy(Component parent,
File[] files,
File target)
Copies files to target . |
static boolean |
executeMove(Component parent,
File[] files,
File target)
Moves files to target . |
static String |
requestInput(Component parent,
String message,
String title)
Shows an input dialog and returns the entered value or null . |
static String |
requestPassword(Component parent,
String message,
String title)
Shows a password input dialog and returns the entered value or null . |
static boolean |
showCloseDialog(Component parent,
String message,
BooleanSetting setting)
Shows a confirmation dialog asking the user if he really wants to quit the application. |
static int |
showConfirmDialog(Component parent,
String message,
String title,
int optionType,
BooleanSetting setting)
Shows a confirmation dialog and with a message and check box that can be selected to not display the dialog in the future anymore. |
static File[] |
showCopyDialog(Component parent,
File[] files,
File target,
BooleanSetting setting)
Displays a dialog that with a list of files asking the user to confirm a copy operation to the specified target. |
static File[] |
showDeleteDialog(Component parent,
File[] files,
BooleanSetting setting)
Displays a dialog that with a list of files asking the user to confirm a delete operation. |
static void |
showError(Component parent,
String message)
Displays a dialog with a message indicating the cause of an error. |
static void |
showError(Component parent,
String message,
Exception e)
Displays a dialog with a message indicating the cause of an error a stack trace of the specified exception providing details. |
static void |
showError(Component parent,
String message,
String title)
Displays a dialog with a message indicating the cause of an error. |
static void |
showError(Component parent,
String message,
String title,
Exception exception)
Displays a dialog with a message indicating the cause of an error a stack trace of the specified exception providing details. |
static File[] |
showFilesActionDialog(Component parent,
File[] files,
String message,
String title,
BooleanSetting setting)
Displays a dialog with a message, a list of files and a check box that can be selected to not display the dialog in the future anymore. |
static void |
showInfo(Component parent,
String message,
String title)
Displays a dialog with an information message. |
static File[] |
showMoveDialog(Component parent,
File[] files,
File target,
BooleanSetting setting)
Displays a dialog that with a list of files asking the user to confirm a delete operation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Dialogs()
Method Detail |
---|
public static boolean executeCopy(Component parent, File[] files, File target)
files
to target
. Shows a dialog
in case of an error.
files
- the files to copytarget
- the target directory
files
is empty
TODO copying could be costly, show progress dialog here too, see DropFileTree..FileHelper.copy(File, File)
public static boolean executeMove(Component parent, File[] files, File target)
files
to target
. Shows a dialog
in case of an error. Renames each file in case it already exists
in target
.
files
- the files to copytarget
- the target directory
files
is emptypublic static String requestInput(Component parent, String message, String title)
null
.
parent
- the parent component the input dialog is centered onmessage
- the message giving details about the requested inputtitle
- the title of the dialog
null
if the dialog was cancelledpublic static String requestPassword(Component parent, String message, String title)
null
.
parent
- the parent component the input dialog is centered onmessage
- the message giving details about the requested inputtitle
- the title of the dialog
null
if the dialog was cancelledpublic static boolean showCloseDialog(Component parent, String message, BooleanSetting setting)
It also offers a checkbox "Always quit without prompting me." If the user
checks it, the next time this function is called it will return true
without showing the dialog.
parent
- the parent component this dialog is centered onmessage
- a message explaining what it means to quit the
applicationsetting
- the boolean setting that stores the state of the checkbox
public static int showConfirmDialog(Component parent, String message, String title, int optionType, BooleanSetting setting)
If the specified setting is not null
and it's value is
false
the dialog is not displayed and
JOptionPane.YES_OPTION
is returned.
parent
- parent component used for centering the dialogmessage
- the message to showtitle
- the title of the message borderoptionType
- an int designating the options available on the
dialog: JOptionPane.YES_NO_OPTION
, or
JOptionPane.YES_NO_CANCEL_OPTION
setting
- used to store the reverse state of the
public static File[] showCopyDialog(Component parent, File[] files, File target, BooleanSetting setting)
If the specified setting is not null
and it's value is
false
the dialog is not displayed and the specified
files are returned.
parent
- the dialog parentfiles
- the files that are to be displayed in the listtarget
- the destination pathsetting
- used to store the reverse state of the
showFilesActionDialog(Component, File[], String, String, BooleanSetting)
public static File[] showDeleteDialog(Component parent, File[] files, BooleanSetting setting)
If the specified setting is not null
and it's value is
false
the dialog is not displayed and the specified
files are returned.
parent
- the dialog parentfiles
- the files that are to be displayed in the listsetting
- used to store the reverse state of the
showFilesActionDialog(Component, File[], String, String, BooleanSetting)
public static void showError(Component parent, String message)
parent
- the parent componentmessage
- the error messagepublic static void showError(Component parent, String message, Exception e)
parent
- the parent componentmessage
- the error messagepublic static void showError(Component parent, String message, String title)
parent
- the parent componentmessage
- the error messagetitle
- the dialog titlepublic static void showError(Component parent, String message, String title, Exception exception)
parent
- the parent componentmessage
- the error messagetitle
- the dialog titleexception
- the exception that caused the errorpublic static File[] showFilesActionDialog(Component parent, File[] files, String message, String title, BooleanSetting setting)
If the specified setting is not null
and it's value is
false
the dialog is not displayed and the specified
files are returned.
parent
- the dialog parentfiles
- the files that are to be displayed in the listtitle
- the dialog's titlemessage
- the messagesetting
- used to store the reverse state of the
public static void showInfo(Component parent, String message, String title)
parent
- the parent componentmessage
- the error messagetitle
- the dialog titleJOptionPane.showMessageDialog(java.awt.Component, java.lang.Object, java.lang.String, int)
public static File[] showMoveDialog(Component parent, File[] files, File target, BooleanSetting setting)
If the specified setting is not null
and it's value is
false
the dialog is not displayed and the specified
files are returned.
parent
- the dialog parentfiles
- the files that are to be displayed in the listtarget
- the destination pathsetting
- used to store the reverse state of the
showFilesActionDialog(Component, File[], String, String, BooleanSetting)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |