Class InputWithChoicesDialog

java.lang.Object
docking.DialogComponentProvider
docking.widgets.dialogs.InputWithChoicesDialog
All Implemented Interfaces:
ActionContextProvider, StatusListener, TaskListener

public class InputWithChoicesDialog extends DialogComponentProvider
A dialog that has text fields to get user input.
  • 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 of isCanceled() to know whether or not the user canceled the operation. To get the user selected value use the getValue() value(s) entered by the user. If the user cancelled the operation, then null will be returned from getValue().
      Parameters:
      dialogTitle - used as the name of the dialog's title bar
      label - value to use for the label of the text field
      optionValues - values to populate the combo box
      initialValue - the initial value; may be null
      messageIcon - 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 of isCanceled() to know whether or not the user canceled the operation. To get the user selected value use the getValue() value(s) entered by the user. If the user cancelled the operation, then null will be returned from getValue().
      Parameters:
      dialogTitle - used as the name of the dialog's title bar
      label - value to use for the label of the text field
      optionValues - values to populate the combo box
      initialValue - the initial value; may be null
      allowEdits - true allows the user to add custom entries by entering text
      messageIcon - 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 class DialogComponentProvider
    • okCallback

      protected void okCallback()
      Description copied from class: DialogComponentProvider
      The callback method for when the "OK" button is pressed.
      Overrides:
      okCallback in class DialogComponentProvider
    • 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 class DialogComponentProvider
    • isCanceled

      public boolean isCanceled()
      Returns if this dialog is canceled.
      Returns:
      true if canceled
    • getValue

      public String getValue()
      Return the value of the first combo box.
      Returns:
      the value
    • setValue

      public void setValue(String value)
      Set the current choice to value.
      Parameters:
      value - updated choice
      Throws:
      NoSuchElementException - if edits not permitted and value is not a valid choice