Class WField

    • Method Detail

      • getField

        public WComponent getField()
        Returns:
        the field
      • getErrorIndicator

        public WFieldErrorIndicator getErrorIndicator()
        Returns:
        the field's error indicator
      • getWarningIndicator

        public WFieldWarningIndicator getWarningIndicator()
        Returns:
        the field's warning indicator
      • setMandatory

        @Deprecated
        public void setMandatory​(boolean mandatory)
        Deprecated.
        set mandatory directly on the required component.
        Sets whether this field is mandatory.

        The mandatory flag will only be set if the field is a Input component or WFieldSet.

        Parameters:
        mandatory - true for mandatory, false for optional
      • setMandatory

        @Deprecated
        public void setMandatory​(boolean mandatory,
                                 String errorMessage)
        Deprecated.
        set mandatory directly on the required component.
        Sets whether this field is mandatory.

        The mandatory flag will only be set if the field is a Input component or WFieldSet.

        Parameters:
        mandatory - true for mandatory, false for optional
        errorMessage - the error message to display on validation error.
      • addValidator

        public void addValidator​(FieldValidator validator)
        Adds a validator to the input field.

        The validator will only be added if the field is a Input component.

        Parameters:
        validator - the validator to add.
      • setLabelText

        public void setLabelText​(String text)
        Updates the label text (if label exists).
        Parameters:
        text - the new label text
      • getLabelText

        public String getLabelText()
        Gets the label text (if label exists) else returns null.
        Returns:
        the text of the label component of this field.
      • getInputWidth

        public int getInputWidth()
        Indicates the desired width of the input field, as a percentage of the available space.
        Returns:
        the percentage width, or 0 to use the default field width.
      • setInputWidth

        public void setInputWidth​(int inputWidth)
        Sets the desired width of the input field, as a percentage of the available space.
        Parameters:
        inputWidth - the percentage width, or <= 0 to use the default field width.
      • toString

        public String toString()
        Description copied from class: AbstractWComponent
        Creates a String representation of this component; usually for debugging purposes.
        Overrides:
        toString in class AbstractWComponent
        Returns:
        a String representation of this component, for debugging purposes.
      • getComponentModel

        protected WField.FieldModel getComponentModel()
        Returns the effective component model for this component. Subclass may override this method to narrow the return type to their specific model type.
        Overrides:
        getComponentModel in class AbstractWComponent
        Returns:
        the effective component model
      • getOrCreateComponentModel

        protected WField.FieldModel getOrCreateComponentModel()
        Retrieves the model for this component so that it can be modified. If this method is called during request processing, and a session specific model does not yet exist, then a new model is created. Subclasses may override this method to narrow the return type to their specific model type.
        Overrides:
        getOrCreateComponentModel in class AbstractWComponent
        Returns:
        the model for this component