Package org.svetovid.dialogs
Class AbstractDialogFactory
java.lang.Object
org.svetovid.dialogs.AbstractDialogFactory
- All Implemented Interfaces:
DialogFactory
- Direct Known Subclasses:
DefaultDialogFactory
This is a default implementation of a dialog factory used for showing various
types of dialog boxes containing messages, information, questions, etc. For
documentation see
DialogFactory interface.- Version:
- 1.0
- Author:
- Ivan Pribela
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classprotected classprotected class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ResourceBundleprotected Clipboardprotected Iconprotected Iconprotected Iconprotected intprotected Iconprotected Iconprotected Iconprotected Iconprotected Iconprotected Iconprotected Iconprotected Localeprotected String[]protected Iconprotected Iconprotected Iconprotected booleanprotected String[]protected String[]protected String[]protected Iconprotected Iconprotected Iconprotected Iconprotected Iconprotected Iconprotected String[]protected String[] -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractDialogFactory(Locale locale, Clipboard clipboard) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddAutoCloseSupport(JDialog dialog, JOptionPane pane, int timeout) protected voidaddAutoFocusSupport(JDialog dialog, JOptionPane pane, JComponent component) protected voidaddClipboardSupport(JDialog dialog, JOptionPane pane, Clipboard clipboard, String text) protected voidprotected voidappendStackTraceAsCause(StringBuilder b, Throwable t, StackTraceElement[] originalStack) protected voidprotected voidappendThrowable(StringBuilder b, Throwable t, boolean isCause) booleanaskConfirmation(Component component, String text) Displays confirmation message box containing desired message, and asking from the user to answer {code Yes} orNo.protected booleanaskConfirmation(Component component, String text, int timeout) askConfirmationWithCancel(Component component, String text) Displays confirmation message box containing desired message, and asking from the user to answer Yes, No or Cancel.protected BooleanaskConfirmationWithCancel(Component component, String text, int timeout) Displays login dialog box containing desired message, and asking for user name and password.protected LoginDataDisplays login dialog box containing desired message, and asking for user name and password.protected LoginDatachar[]askPassword(Component component, String text) Displays password dialog box containing desired message, and asking from the user to enter password.protected char[]askPassword(Component component, String text, int timeout) askQuestion(Component component, String text) Displays question message box containing desired question, and asking the user to enter the answer.askQuestion(Component component, String text, int timeout) askQuestion(Component component, String text, Object[] options, Object defaultOption) Displays question message box containing desired question, and asking the user to choose one of the provided options.protected ObjectaskQuestion(Component component, String text, Object[] options, Object defaultOption, int timeout) askQuestion(Component component, String text, String answer) Displays question message box containing desired question, and asking the user to enter the answer.protected StringaskQuestion(Component component, String text, String answer, int timeout) protected Stringprotected static StringcopyStringFromClipboard(Clipboard clipboard) protected static voidcopyStringToClipboard(Clipboard clipboard, String text) protected JDialogcreateDialog(Component component, JOptionPane pane, String title, int timeout) protected JDialogcreateDialog(Component component, JOptionPane pane, String title, String text, int timeout) protected JDialogcreateDialog(Component component, JOptionPane pane, String title, JComponent focus, int timeout) protected JDialogcreateDialog(Component component, JOptionPane pane, String title, JComponent focus, String text, int timeout) protected voiddestroyDialog(JDialog dialog, JOptionPane pane) protected ClipboardReturns a dialog icon of the desired type.protected Localeprotected voidsetClipboard(Clipboard newValue) protected voidbooleanshowDialog(Component component, Component content, String title, Icon icon) Displays a dialog with the given icon and title containing the supplied component.protected booleanshowDialog(Component component, Component content, String title, Icon icon, int timeout) <T> TshowDialog(Component component, DialogContent<T> content, String title, Icon icon) Displays a dialog with the given icon and title containing the supplied content.protected <T> TshowDialog(Component component, DialogContent<T> content, String title, Icon icon, int timeout) voidDisplays error message box containing desired message.protected voidvoidDisplays error message box containing desired message and optionally stack-trace of the supplied exception.protected voidvoidshowException(Component component, Throwable th) Displays error message box containing stack-trace of the supplied exception.protected voidshowException(Component component, Throwable th, int timeout) voidshowInformation(Component component, String text) Displays informational message box containing desired message.protected voidshowInformation(Component component, String text, int timeout) voidshowMessage(Component component, String text) Displays message box containing desired message.protected voidshowMessage(Component component, String text, int timeout) voidshowWarning(Component component, String text) Displays warning message box containing desired message.protected voidshowWarning(Component component, String text, int timeout)
-
Field Details
-
locale
-
clipboard
-
defaultAutoCloseTimeout
protected int defaultAutoCloseTimeout -
bundle
-
okOptions
-
yesNoOptions
-
yesNoCancelOptions
-
okCancelOptions
-
loginExitOptions
-
okWithDetailsOptions
-
messageIcon
-
informationIcon
-
warningIcon
-
errorIcon
-
confirmationIcon
-
questionIcon
-
passwordIcon
-
loginIcon
-
exceptionIcon
-
timeoutIcon
-
findIcon
-
replaceIcon
-
fontIcon
-
colorIcon
-
folderIcon
-
fileIcon
-
dateIcon
-
timeIcon
-
logoIcon
-
newStackTraceStyle
protected boolean newStackTraceStyle
-
-
Constructor Details
-
AbstractDialogFactory
-
-
Method Details
-
getClipboard
-
setClipboard
-
getLocale
-
setLocale
-
showMessage
Description copied from interface:DialogFactoryDisplays message box containing desired message.- Specified by:
showMessagein interfaceDialogFactory- Parameters:
component- determines the frame in which the dialog is displayed; if the parentComponent has no Frame, a default Frame is used.text- text which will be displayed in the message box.
-
showMessage
-
showInformation
Description copied from interface:DialogFactoryDisplays informational message box containing desired message.- Specified by:
showInformationin interfaceDialogFactory- Parameters:
component- determines the frame in which the dialog is displayed; if the parentComponent has no Frame, a default Frame is used.text- text which will be displayed in the message box.
-
showInformation
-
showWarning
Description copied from interface:DialogFactoryDisplays warning message box containing desired message.- Specified by:
showWarningin interfaceDialogFactory- Parameters:
component- determines the frame in which the dialog is displayed; if the parentComponent has no Frame, a default Frame is used.text- text which will be displayed in the message box.
-
showWarning
-
showError
Description copied from interface:DialogFactoryDisplays error message box containing desired message.- Specified by:
showErrorin interfaceDialogFactory- Parameters:
component- determines the frame in which the dialog is displayed; if the parentComponent has no Frame, a default Frame is used.text- text which will be displayed in the message box.
-
showError
-
showError
Description copied from interface:DialogFactoryDisplays error message box containing desired message and optionally stack-trace of the supplied exception.- Specified by:
showErrorin interfaceDialogFactory- Parameters:
component- determines the frame in which the dialog is displayed; if the parentComponent has no Frame, a default Frame is used.text- text which will be displayed in the message box.th- exception which is used to build up the stack-trace information.
-
showError
-
showException
Description copied from interface:DialogFactoryDisplays error message box containing stack-trace of the supplied exception.- Specified by:
showExceptionin interfaceDialogFactory- Parameters:
component- determines the frame in which the dialog is displayed; if the parentComponent has no Frame, a default Frame is used.th- exception which is used to build up the stack-trace information.
-
showException
-
askConfirmation
Description copied from interface:DialogFactoryDisplays confirmation message box containing desired message, and asking from the user to answer {code Yes} orNo.- Specified by:
askConfirmationin interfaceDialogFactory- Parameters:
component- determines the frame in which the dialog is displayed; if the parentComponent has no Frame, a default Frame is used.text- text which will be displayed in the message box.- Returns:
trueif user answeredyes;falseotherwise.
-
askConfirmation
-
askConfirmationWithCancel
Description copied from interface:DialogFactoryDisplays confirmation message box containing desired message, and asking from the user to answer Yes, No or Cancel.- Specified by:
askConfirmationWithCancelin interfaceDialogFactory- Parameters:
component- determines the frame in which the dialog is displayed; if the parentComponent has no Frame, a default Frame is used.text- text which will be displayed in the message box.- Returns:
trueif user answeredyes;falseif user answeredno; andnullotherwise.
-
askConfirmationWithCancel
-
askQuestion
Description copied from interface:DialogFactoryDisplays question message box containing desired question, and asking the user to enter the answer.- Specified by:
askQuestionin interfaceDialogFactory- Parameters:
component- determines the frame in which the dialog is displayed; if the parentComponent has no Frame, a default Frame is used.text- text which will be displayed in the message box.- Returns:
Stringcontaining text that user entered;nullif user has chosen not to answer.
-
askQuestion
-
askQuestion
Description copied from interface:DialogFactoryDisplays question message box containing desired question, and asking the user to enter the answer.- Specified by:
askQuestionin interfaceDialogFactory- Parameters:
component- determines the frame in which the dialog is displayed; if the parentComponent has no Frame, a default Frame is used.text- text which will be displayed in the message box.answer- the initial answer for user to modify.- Returns:
Stringcontaining text that user entered;nullif user has chosen not to answer.
-
askQuestion
-
askQuestion
Description copied from interface:DialogFactoryDisplays question message box containing desired question, and asking the user to choose one of the provided options.- Specified by:
askQuestionin interfaceDialogFactory- Parameters:
component- determines the frame in which the dialog is displayed; if the parentComponent has no Frame, a default Frame is used.text- text which will be displayed in the message box.options- list of available options for the user to choose from.defaultOption- initial option that is to be selected.- Returns:
- one of the options provided or
nullif user has chosen not to answer.
-
askQuestion
-
askPassword
Description copied from interface:DialogFactoryDisplays password dialog box containing desired message, and asking from the user to enter password.- Specified by:
askPasswordin interfaceDialogFactory- Parameters:
component- determines the frame in which the dialog is displayed; if the parentComponent has no Frame, a default Frame is used.text- text which will be displayed in the dialog box.- Returns:
- password entered by the user as an array of
char;nullif user has chosen not to enter the password.
-
askPassword
-
askLogin
Description copied from interface:DialogFactoryDisplays login dialog box containing desired message, and asking for user name and password.- Specified by:
askLoginin interfaceDialogFactory- Parameters:
component- determines the frame in which the dialog is displayed; if the parentComponent has no Frame, a default Frame is used.text- text which will be displayed in the dialog box.- Returns:
- user data (user name and password) stored in
LoginDataobject;nullif user has chosen not to enter login data.
-
askLogin
-
askLogin
Description copied from interface:DialogFactoryDisplays login dialog box containing desired message, and asking for user name and password.- Specified by:
askLoginin interfaceDialogFactory- Parameters:
component- determines the frame in which the dialog is displayed; if the parentComponent has no Frame, a default Frame is used.text- text which will be displayed in the dialog box.username- default user name.- Returns:
- user data (user name and password) stored in
LoginDataobject;nullif user has chosen not to enter login information.
-
askLogin
-
showDialog
Description copied from interface:DialogFactoryDisplays a dialog with the given icon and title containing the supplied component.- Specified by:
showDialogin interfaceDialogFactory- Parameters:
component- determines the frame in which the dialog is displayed; if the parentComponent has no Frame, a default Frame is used.content- the component to display on the dialogtitle- title of the dialogicon- icon to display on the dialog- Returns:
trueif user answeredok;falseotherwise.
-
showDialog
-
showDialog
Description copied from interface:DialogFactoryDisplays a dialog with the given icon and title containing the supplied content.- Specified by:
showDialogin interfaceDialogFactory- Type Parameters:
T- type of dialog content- Parameters:
component- determines the frame in which the dialog is displayed; if the parentComponent has no Frame, a default Frame is used.content- the component to display on the dialogtitle- title of the dialogicon- icon to display on the dialog- Returns:
- The object retrieved from the content component if user answered
ok;nullotherwise.
-
showDialog
protected <T> T showDialog(Component component, DialogContent<T> content, String title, Icon icon, int timeout) -
getIcon
Description copied from interface:DialogFactoryReturns a dialog icon of the desired type.- Specified by:
getIconin interfaceDialogFactory- Parameters:
type- determines which icon to return: "question", "warning", "error", or other- Returns:
- Returns a dialog icon of the given type.
-
createDialog
-
createDialog
protected JDialog createDialog(Component component, JOptionPane pane, String title, JComponent focus, int timeout) -
createDialog
protected JDialog createDialog(Component component, JOptionPane pane, String title, String text, int timeout) -
createDialog
protected JDialog createDialog(Component component, JOptionPane pane, String title, JComponent focus, String text, int timeout) -
destroyDialog
-
addAutoFocusSupport
-
addClipboardSupport
protected void addClipboardSupport(JDialog dialog, JOptionPane pane, Clipboard clipboard, String text) -
addAutoCloseSupport
-
constructStackTrace
-
appendStackTrace
-
appendStackTraceAsCause
protected void appendStackTraceAsCause(StringBuilder b, Throwable t, StackTraceElement[] originalStack) -
appendThrowable
-
appendStackTraceElement
-
copyStringToClipboard
-
copyStringFromClipboard
-