org.xhtmlrenderer.simple.xhtml.controls
Class AbstractControl

java.lang.Object
  extended by 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


Constructor Summary
AbstractControl(XhtmlForm form, Element e)
           
 
Method Summary
 void addFormControlListener(FormControlListener listener)
           
static String collectText(Element e)
           
protected  void fireChanged()
           
protected  void fireEnabled()
           
protected  void fireSuccessful()
           
 Element getElement()
           
 XhtmlForm getForm()
           
 String getInitialValue()
           
static int getIntAttribute(Element e, String attribute, int def)
           
 String[] getMultipleValues()
           
 String getName()
           
 String getValue()
           
 boolean isEnabled()
          Is this control enabled?
 boolean isHidden()
           
 boolean isMultiple()
           
 boolean isSuccessful()
          Is this control successful?
 void removeFormControlListener(FormControlListener listener)
           
 void reset()
          Reset the control to it's initial state
 void setEnabled(boolean enabled)
          Enable/disable this control
protected  void setInitialValue(String value)
           
 void setMultipleValues(String[] values)
          Sets the control's current values (when isMultiple returns true).
 void setSuccessful(boolean successful)
          Sets this control's successful state.
 void setValue(String value)
          Sets the control's current value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractControl

public AbstractControl(XhtmlForm form,
                       Element e)
Method Detail

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 void setInitialValue(String value)

getValue

public 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)


Copyright © 2013. All Rights Reserved.