Package org.svetovid.dialogs
Interface DialogFactory
- All Known Implementing Classes:
AbstractDialogFactory
,AutoCloseDialogFactory
,DefaultDialogFactory
public interface DialogFactory
This is an interface for factory classes used for creating and showing
various types of dialog boxes containing messages, information, questions,
etc.
- Version:
- 1.0
- Author:
- Ivan Pribela
-
Method Summary
Modifier and TypeMethodDescriptionboolean
askConfirmation
(Component component, String text) Displays confirmation message box containing desired message, and asking from the user to answer {code Yes} orNo
.askConfirmationWithCancel
(Component component, String text) Displays confirmation message box containing desired message, and asking from the user to answer Yes, No or Cancel.Displays login dialog box containing desired message, and asking for user name and password.Displays login dialog box containing desired message, and asking for user name and password.char[]
askPassword
(Component component, String text) Displays password dialog box containing desired message, and asking from the user to enter password.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, Object[] options, Object defaultOption) Displays question message box containing desired question, and asking the user to choose one of the provided options.askQuestion
(Component component, String text, String answer) Displays question message box containing desired question, and asking the user to enter the answer.Returns a dialog icon of the desired type.boolean
showDialog
(Component component, Component content, String title, Icon icon) Displays a dialog with the given icon and title containing the supplied component.<T> T
showDialog
(Component component, DialogContent<T> content, String title, Icon icon) Displays a dialog with the given icon and title containing the supplied content.void
Displays error message box containing desired message.void
Displays error message box containing desired message and optionally stack-trace of the supplied exception.void
showException
(Component component, Throwable th) Displays error message box containing stack-trace of the supplied exception.void
showInformation
(Component component, String text) Displays informational message box containing desired message.void
showMessage
(Component component, String text) Displays message box containing desired message.void
showWarning
(Component component, String text) Displays warning message box containing desired message.
-
Method Details
-
showMessage
Displays message box containing desired message.- 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
Displays informational message box containing desired message.- 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
Displays warning message box containing desired message.- 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
Displays error message box containing desired message.- 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
Displays error message box containing desired message and optionally stack-trace of the supplied exception.- 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.
-
showException
Displays error message box containing stack-trace of the supplied exception.- 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.
-
askConfirmation
Displays confirmation message box containing desired message, and asking from the user to answer {code Yes} orNo
.- 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:
true
if user answeredyes
;false
otherwise.
-
askConfirmationWithCancel
Displays confirmation message box containing desired message, and asking from the user to answer Yes, No or Cancel.- 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:
true
if user answeredyes
;false
if user answeredno
; andnull
otherwise.
-
askQuestion
Displays question message box containing desired question, and asking the user to enter the answer.- 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:
String
containing text that user entered;null
if user has chosen not to answer.
-
askQuestion
Displays question message box containing desired question, and asking the user to enter the answer.- 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:
String
containing text that user entered;null
if user has chosen not to answer.
-
askQuestion
Displays question message box containing desired question, and asking the user to choose one of the provided options.- 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
null
if user has chosen not to answer.
-
askPassword
Displays password dialog box containing desired message, and asking from the user to enter password.- 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
;null
if user has chosen not to enter the password.
-
askLogin
Displays login dialog box containing desired message, and asking for user name and password.- 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
LoginData
object;null
if user has chosen not to enter login data.
-
askLogin
Displays login dialog box containing desired message, and asking for user name and password.- 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
LoginData
object;null
if user has chosen not to enter login information.
-
showDialog
Displays a dialog with the given icon and title containing the supplied component.- 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:
true
if user answeredok
;false
otherwise.
-
showDialog
Displays a dialog with the given icon and title containing the supplied content.- 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
;null
otherwise.
-
getIcon
Returns a dialog icon of the desired type.- Parameters:
type
- determines which icon to return: "question", "warning", "error", or other- Returns:
- Returns a dialog icon of the given type.
-