Class AbstractControl

java.lang.Object
org.xhtmlrenderer.simple.xhtml.controls.AbstractControl
All Implemented Interfaces:
FormControl
Direct Known Subclasses:
ButtonControl, CheckControl, HiddenControl, SelectControl, TextControl

public abstract class AbstractControl extends Object implements FormControl
  • Field Details

    • _form

      private final XhtmlForm _form
    • _element

      private final Element _element
    • _name

      private final String _name
    • _initialValue

      private String _initialValue
    • _value

      private String _value
    • _successful

      private boolean _successful
    • _enabled

      private boolean _enabled
    • _listeners

      private final List<FormControlListener> _listeners
  • Constructor Details

  • Method Details

    • getNameOrId

      private static String getNameOrId(Element e)
    • fireChanged

      protected void fireChanged()
    • fireSuccessful

      protected void fireSuccessful()
    • fireEnabled

      protected void fireEnabled()
    • addFormControlListener

      public void addFormControlListener(FormControlListener listener)
      Specified by:
      addFormControlListener in interface FormControl
    • removeFormControlListener

      public void removeFormControlListener(FormControlListener listener)
      Specified by:
      removeFormControlListener in interface FormControl
    • getElement

      public Element getElement()
      Specified by:
      getElement in interface FormControl
      Returns:
      the associated element
    • getForm

      public XhtmlForm getForm()
      Specified by:
      getForm in interface FormControl
      Returns:
      the associated form
    • getName

      public String getName()
      Specified by:
      getName in interface FormControl
      Returns:
      the name of the control
    • getInitialValue

      public String getInitialValue()
      Specified by:
      getInitialValue in interface FormControl
      Returns:
      the initial value
    • setInitialValue

      protected final void setInitialValue(String value)
    • getValue

      public final String getValue()
      Specified by:
      getValue in interface FormControl
      Returns:
      the control's current value or null if isMultiple returns true
    • setValue

      public void setValue(String value)
      Description copied from interface: FormControl
      Sets the control's current value. This has no effect when isMultiple returns true.
      Specified by:
      setValue in interface FormControl
    • getMultipleValues

      public String[] getMultipleValues()
      Specified by:
      getMultipleValues in interface FormControl
      Returns:
      the control's current values or null if isMultiple returns false
    • setMultipleValues

      public void setMultipleValues(String[] values)
      Description copied from interface: FormControl
      Sets the control's current values (when isMultiple returns true). This has no effect when isMultiple returns false.
      Specified by:
      setMultipleValues in interface FormControl
    • isHidden

      public boolean isHidden()
    • isEnabled

      public boolean isEnabled()
      Description copied from interface: FormControl
      Is this control enabled?
      Specified by:
      isEnabled in interface FormControl
      Returns:
      true if this control is enabled
    • isSuccessful

      public boolean isSuccessful()
      Description copied from interface: FormControl
      Is this control successful?
      Specified by:
      isSuccessful in interface FormControl
      Returns:
      true if this control is successful and its name-value pair should be submitted, false otherwise.
    • isMultiple

      public boolean isMultiple()
      Specified by:
      isMultiple in interface FormControl
      Returns:
      true if this control accepts multiple values, false otherwise
    • setSuccessful

      public void setSuccessful(boolean successful)
      Description copied from interface: FormControl
      Sets this control's successful state.
      Specified by:
      setSuccessful in interface FormControl
    • setEnabled

      public void setEnabled(boolean enabled)
      Description copied from interface: FormControl
      Enable/disable this control
      Specified by:
      setEnabled in interface FormControl
    • reset

      public void reset()
      Description copied from interface: FormControl
      Reset the control to it's initial state
      Specified by:
      reset in interface FormControl
    • collectText

      public static String collectText(Element e)
    • getIntAttribute

      public static int getIntAttribute(Element e, String attribute, int def)