Class AbstractNumberInputDialog

    • Field Detail

      • wasCancelled

        protected boolean wasCancelled
      • min

        protected java.math.BigInteger min
      • max

        protected java.math.BigInteger max
      • label

        protected javax.swing.JLabel label
      • defaultMessage

        protected java.lang.String defaultMessage
    • Constructor Detail

      • AbstractNumberInputDialog

        public AbstractNumberInputDialog​(java.lang.String title,
                                         java.lang.String prompt,
                                         java.lang.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
      • AbstractNumberInputDialog

        public AbstractNumberInputDialog​(java.lang.String title,
                                         java.lang.String prompt,
                                         java.math.BigInteger initialValue,
                                         java.math.BigInteger min,
                                         java.math.BigInteger 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 Detail

      • buildMainPanel

        protected javax.swing.JPanel buildMainPanel​(java.lang.String prompt,
                                                    boolean showAsHex)
        Define the Main panel for the dialog here
        Parameters:
        prompt - the prompt label text
        showAsHex - if true, show the value as hex
        Returns:
        JPanel the completed Main Panel
      • okCallback

        protected void okCallback()
        Gets called when the user clicks on the OK Action for the dialog.
        Overrides:
        okCallback in class DialogComponentProvider
      • wasCancelled

        public boolean wasCancelled()
        Return whether the user cancelled the input dialog
        Returns:
        true if cancelled
      • getBigIntegerValue

        public java.math.BigInteger getBigIntegerValue()
        Get the current input value
        Returns:
        the value
        Throws:
        java.lang.NumberFormatException - if entered value cannot be parsed
        java.lang.IllegalStateException - if the dialog was cancelled
      • getLongValue

        public long getLongValue()
        Get the current input value as a long
        Returns:
        the value
        Throws:
        java.lang.NumberFormatException - if entered value cannot be parsed
        java.lang.IllegalStateException - if the dialog was cancelled
        java.lang.ArithmeticException - if the value in this field will not fit into a long
      • getIntValue

        public int getIntValue()
        Get the current input value as an int
        Returns:
        the value
        Throws:
        java.lang.NumberFormatException - if entered value cannot be parsed
        java.lang.IllegalStateException - if the dialog was cancelled
        java.lang.ArithmeticException - if the value in this field will not fit into an int
      • show

        public boolean show()
        show displays the dialog, gets the user input
        Returns:
        false if the user cancelled the operation
      • setInput

        public void setInput​(int value)
        Sets the value in the input field to the indicated value.
        Parameters:
        value - the value
      • setDefaultMessage

        public void setDefaultMessage​(java.lang.String defaultMessage)
        Sets the default message to be displayed when valid values are in the text fields.
        Parameters:
        defaultMessage - the message to be displayed when valid values are in the text fields.
      • getMin

        public int getMin()
        Return the minimum acceptable value.
        Returns:
        the min
      • getMax

        public int getMax()
        Return the maximum acceptable value.
        Returns:
        the max
      • updateOKButtonEnablement

        protected void updateOKButtonEnablement()
      • buildDefaultPrompt

        protected static java.lang.String buildDefaultPrompt​(java.lang.String entryType,
                                                             int min,
                                                             int max)
      • toBig

        protected static java.math.BigInteger toBig​(java.lang.Integer i)