Class DefaultWidgetModel

    • Method Detail

      • getObjectPool

        public List<?> getObjectPool()
        Description copied from interface: WidgetModel
        Gets the available objects for use with the widget. For example, ObjectWidgets typically display a dropdown combo box providing multiple choice selection between these objects.

        Note that this list does not represent a constraint in allowed widget values, but rather provides a list of possibilities in cases where the realm of values is not defined by the type in some other way.

        Specified by:
        getObjectPool in interface WidgetModel
        See Also:
        ObjectWidget
      • isStyle

        public boolean isStyle​(String style)
        Description copied from interface: WidgetModel
        Gets whether the widget is the given style. A widget may have multiple styles separated by commas, so this method is more correct than using style.equals(getItem().getWidgetStyle()).
        Specified by:
        isStyle in interface WidgetModel
      • getValue

        public Object getValue()
        Description copied from interface: WidgetModel
        Gets the current value of the module input.

        In the case of inputs with a limited set of choices (i.e., ChoiceWidgets and ObjectWidgets), this method ensures the value is in the set; if not, it returns the first item of the set.

        Specified by:
        getValue in interface WidgetModel
      • setValue

        public void setValue​(Object value)
        Description copied from interface: WidgetModel
        Sets the current value of the module input.
        Specified by:
        setValue in interface WidgetModel
      • callback

        public void callback()
        Description copied from interface: WidgetModel
        Executes the callback associated with this widget's associated input.
        Specified by:
        callback in interface WidgetModel
      • getMin

        public Number getMin()
        Description copied from interface: WidgetModel
        Gets the minimum value for the module input.
        Specified by:
        getMin in interface WidgetModel
        Returns:
        The minimum value, or null if the type is unbounded.
      • getMax

        public Number getMax()
        Description copied from interface: WidgetModel
        Gets the maximum value for the module input.
        Specified by:
        getMax in interface WidgetModel
        Returns:
        The maximum value, or null if the type is unbounded.
      • getStepSize

        public Number getStepSize()
        Description copied from interface: WidgetModel
        Gets the step size between values for the module input.
        Specified by:
        getStepSize in interface WidgetModel
        Returns:
        The step size, or 1 by default.
      • getChoices

        public String[] getChoices()
        Description copied from interface: WidgetModel
        Gets the multiple choice list for the module input.
        Specified by:
        getChoices in interface WidgetModel
        Returns:
        The available choices, or an empty list if not multiple choice.
        See Also:
        ChoiceWidget
      • getText

        public String getText()
        Description copied from interface: WidgetModel
        Gets the input's value rendered as a string.
        Specified by:
        getText in interface WidgetModel
        Returns:
        String representation of the input value, or the empty string if the value is null or the null character ('\0').
      • isCharacter

        public boolean isCharacter()
        Description copied from interface: WidgetModel
        Gets whether the input is a character type (i.e., Character or char).
        Specified by:
        isCharacter in interface WidgetModel
      • isNumber

        public boolean isNumber()
        Description copied from interface: WidgetModel
        Gets whether the input is a number type (e.g., int, float or any Number implementation.
        Specified by:
        isNumber in interface WidgetModel
      • isBoolean

        public boolean isBoolean()
        Description copied from interface: WidgetModel
        Gets whether the input is a boolean type (i.e., Boolean or boolean).
        Specified by:
        isBoolean in interface WidgetModel
      • isMultipleChoice

        public boolean isMultipleChoice()
        Description copied from interface: WidgetModel
        Gets whether the input provides a restricted set of choices.
        Specified by:
        isMultipleChoice in interface WidgetModel
      • isType

        public boolean isType​(Class<?> type)
        Description copied from interface: WidgetModel
        Gets whether the input is compatible with the given type.
        Specified by:
        isType in interface WidgetModel
      • setInitialized

        public void setInitialized​(boolean initialized)
        Description copied from interface: WidgetModel
        Toggles the widget's initialization state. An initialized widget can be assumed to be an active part of a container InputPanel.
        Specified by:
        setInitialized in interface WidgetModel
      • isInitialized

        public boolean isInitialized()
        Description copied from interface: WidgetModel
        Gets the widget's initialization state. An initialized widget can be assumed to be an active part of a container InputPanel.
        Specified by:
        isInitialized in interface WidgetModel
      • updateValidation

        public void updateValidation()
        Description copied from interface: WidgetModel
        Re-runs this item's validation and updates the stored validation message.

        This should be called on all widgets whenever any parameter value changes, since a change to one parameter may affect the validity of others.

        Specified by:
        updateValidation in interface WidgetModel
        See Also:
        WidgetModel.getValidationMessage()