Package docking.widgets.dialogs
Class InputWithChoicesDialog
java.lang.Object
docking.DialogComponentProvider
docking.widgets.dialogs.InputWithChoicesDialog
- All Implemented Interfaces:
ActionContextProvider
,StatusListener
,TaskListener
A dialog that has text fields to get user input.
-
Field Summary
Fields inherited from class docking.DialogComponentProvider
applyButton, buttonPanel, cancelButton, dismissButton, okButton, rootPanel
-
Constructor Summary
ConstructorDescriptionInputWithChoicesDialog
(String dialogTitle, String label, String[] optionValues, String initialValue, boolean allowEdits, Icon messageIcon) Creates a provider for a generic input dialog with the specified title, a label and a editable comboBox pre-populated with selectable values.InputWithChoicesDialog
(String dialogTitle, String label, String[] optionValues, String initialValue, Icon messageIcon) Creates a provider for a generic input dialog with the specified title, a label and a editable comboBox pre-populated with selectable values. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
The callback method for when the "Cancel" button is pressed.protected void
Override this method if you want to do something when the dialog is made visiblegetValue()
Return the value of the first combo box.boolean
Returns if this dialog is canceled.protected void
The callback method for when the "OK" button is pressed.void
Set the current choice to value.Methods inherited from class docking.DialogComponentProvider
addAction, addApplyButton, addButton, addCancelButton, addDismissButton, addOKButton, addWorkPanel, alertMessage, alertMessage, applyCallback, cancelCurrentTask, clearScheduledTask, clearStatusText, close, closeDialog, dialogClosed, dismissCallback, dispose, doInitialize, escapeCallback, executeProgressTask, getActionContext, getActions, getBackground, getBounds, getComponent, getDefaultButton, getDefaultSize, getDialogSize, getFocusComponent, getGlassPane, getHelpLocation, getId, getInitialLocation, getLocationOnScreen, getParent, getPreferredSize, getRememberLocation, getRememberSize, getStatusColor, getStatusLabel, getStatusText, getTaskMonitorComponent, getTaskScheduler, getTitle, getUseSharedLocation, hideTaskMonitorComponent, isApplyEnabled, isCancelEnabled, isModal, isOKEnabled, isResizeable, isRunningTask, isShowing, isTransient, isVisible, notifyContextChanged, removeAction, removeButton, removeWorkPanel, repack, setAccessibleDescription, setApplyEnabled, setApplyToolTip, setBackground, setCancelButtonText, setCancelEnabled, setCancelToolTip, setCursor, setDefaultButton, setDefaultSize, setDialogSize, setDismissToolTip, setFocusComponent, setGlassPane, setHelpLocation, setInitialLocation, setMinimumSize, setMinimumSize, setOkButtonText, setOkEnabled, setOkToolTip, setPreferredSize, setRememberLocation, setRememberSize, setResizable, setStatusJustification, setStatusText, setStatusText, setStatusText, setTitle, setTransient, setUseSharedLocation, showProgressBar, showTaskMonitorComponent, stopProgressTimer, taskCancelled, taskCompleted, toFront, toString, waitForCurrentTask
-
Constructor Details
-
InputWithChoicesDialog
public InputWithChoicesDialog(String dialogTitle, String label, String[] optionValues, String initialValue, Icon messageIcon) Creates a provider for a generic input dialog with the specified title, a label and a editable comboBox pre-populated with selectable values. The user can check the value ofisCanceled()
to know whether or not the user canceled the operation. To get the user selected value use thegetValue()
value(s) entered by the user. If the user cancelled the operation, then null will be returned fromgetValue()
.- Parameters:
dialogTitle
- used as the name of the dialog's title barlabel
- value to use for the label of the text fieldoptionValues
- values to populate the combo boxinitialValue
- the initial value; may be nullmessageIcon
- the icon to display on the dialog; may be null
-
InputWithChoicesDialog
public InputWithChoicesDialog(String dialogTitle, String label, String[] optionValues, String initialValue, boolean allowEdits, Icon messageIcon) Creates a provider for a generic input dialog with the specified title, a label and a editable comboBox pre-populated with selectable values. The user can check the value ofisCanceled()
to know whether or not the user canceled the operation. To get the user selected value use thegetValue()
value(s) entered by the user. If the user cancelled the operation, then null will be returned fromgetValue()
.- Parameters:
dialogTitle
- used as the name of the dialog's title barlabel
- value to use for the label of the text fieldoptionValues
- values to populate the combo boxinitialValue
- the initial value; may be nullallowEdits
- true allows the user to add custom entries by entering textmessageIcon
- the icon to display on the dialog; may be null
-
-
Method Details
-
dialogShown
protected void dialogShown()Description copied from class:DialogComponentProvider
Override this method if you want to do something when the dialog is made visible- Overrides:
dialogShown
in classDialogComponentProvider
-
okCallback
protected void okCallback()Description copied from class:DialogComponentProvider
The callback method for when the "OK" button is pressed.- Overrides:
okCallback
in classDialogComponentProvider
-
cancelCallback
protected void cancelCallback()Description copied from class:DialogComponentProvider
The callback method for when the "Cancel" button is pressed. The default behavior is to call setVisible(false) and dispose() on the dialog.- Overrides:
cancelCallback
in classDialogComponentProvider
-
isCanceled
public boolean isCanceled()Returns if this dialog is canceled.- Returns:
- true if canceled
-
getValue
Return the value of the first combo box.- Returns:
- the value
-
setValue
Set the current choice to value.- Parameters:
value
- updated choice- Throws:
NoSuchElementException
- if edits not permitted and value is not a valid choice
-