Package docking.widgets.dialogs

# Class NumberInputDialog

java.lang.Object
docking.DialogComponentProvider
docking.widgets.dialogs.AbstractNumberInputDialog
docking.widgets.dialogs.NumberInputDialog

All Implemented Interfaces:
  `ActionContextProvider`, `StatusListener`, `TaskListener`

public class NumberInputDialog extends AbstractNumberInputDialog

DialogComponentProvider that provides information to create a modal dialog to prompt for a number (int) to be input by the user.

If an initial value is specified it is not in the range of min,max, it will be set to the min.

If the maximum value indicated is less than the minimum then the max is the largest positive integer. Otherwise the maximum valid value is as indicated.

This dialog component provider class can be used by various classes and therefore should not have its size or position remembered by the tool.showDialog() call parameters.

To display the dialog call:

         String entryType = "items";
         int initial = 5; // initial value in text field.
         int min = 1;     // minimum valid value in text field.
         int max = 10;    // maximum valid value in text field.

         NumberInputDialog numInputProvider = new NumberInputProvider(entryType, initial, min, max);
         if (numInputProvider.show()) {
               // not cancelled
               int result = numInputProvider.getValue();
         }

- ## Field Summary

  ### Fields inherited from class docking.widgets.dialogs.AbstractNumberInputDialog

  `defaultMessage, label, max, min, numberInputField, wasCancelled`

  ### Fields inherited from class docking.DialogComponentProvider

  `applyButton, buttonPanel, cancelButton, dismissButton, okButton, rootPanel`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `NumberInputDialog(String entryType, int initial, int min)`
  Constructs a new NumberInputDialog
  `NumberInputDialog(String entryType, int initial, int min, int max)`
  Constructs a new NumberInputDialog
  `NumberInputDialog(String title, String prompt, Integer initialValue, int min, int max, boolean showAsHex)`
  Show a number input dialog

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `getValue()`
  Convert the input to an int value

  ### Methods inherited from class docking.widgets.dialogs.AbstractNumberInputDialog

  `buildDefaultPrompt, buildMainPanel, cancelCallback, getBigIntegerValue, getIntValue, getLongValue, getMax, getMin, okCallback, setDefaultMessage, setInput, show, toBig, updateOKButtonEnablement, wasCancelled`

  ### Methods inherited from class docking.DialogComponentProvider

  `addAction, addApplyButton, addButton, addCancelButton, addDismissButton, addOKButton, addWorkPanel, alertMessage, alertMessage, applyCallback, cancelCurrentTask, clearScheduledTask, clearStatusText, close, closeDialog, dialogClosed, dialogShown, 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, 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`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### NumberInputDialog

    public NumberInputDialog(String entryType, int initial, int min)
    Constructs a new NumberInputDialog
    Parameters:
      `entryType` - item type the number indicates (i.e. "duplicates", "items", or "elements")
      `initial` - default value displayed in the text field
      `min` - minimum value allowed

  - ### NumberInputDialog

    public NumberInputDialog(String entryType, int initial, int min, int max)
    Constructs a new NumberInputDialog
    Parameters:
      `entryType` - item type the number indicates (i.e. "duplicates", "items", or "elements")
      `initial` - default value displayed in the text field
      `min` - minimum value allowed
      `max` - maximum value allowed

  - ### NumberInputDialog

    public NumberInputDialog(String title, String prompt, Integer initialValue, int min, int max, boolean showAsHex)
    Show a number input dialog
    Parameters:
      `title` - The title of the dialog
      `prompt` - the prompt to display before the number input field
      `initialValue` - the default value to display, null will leave the field blank
      `min` - the minimum allowed value of the field
      `max` - the maximum allowed value of the field
      `showAsHex` - if true, the initial value will be displayed as hex

- ## Method Details

  - ### getValue

    public int getValue()
    Convert the input to an int value
    Returns:
      the int value
    Throws:
      `NumberFormatException` - if entered value cannot be parsed
      `IllegalStateException` - if the dialog was cancelled