Class AbstractControl
java.lang.Object
com.openhtmltopdf.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
Constructors Constructor Description AbstractControl(XhtmlForm form, Element e) -
Method Summary
Modifier and Type Method Description voidaddFormControlListener(FormControlListener listener)static StringcollectText(Element e)protected voidfireChanged()protected voidfireEnabled()protected voidfireSuccessful()ElementgetElement()XhtmlFormgetForm()StringgetInitialValue()static intgetIntAttribute(Element e, String attribute, int def)String[]getMultipleValues()StringgetName()StringgetValue()booleanisEnabled()Is this control enabled?booleanisHidden()booleanisMultiple()booleanisSuccessful()Is this control successful?voidremoveFormControlListener(FormControlListener listener)voidreset()Reset the control to it's initial statevoidsetEnabled(boolean enabled)Enable/disable this controlprotected voidsetInitialValue(String value)voidsetMultipleValues(String[] values)Sets the control's current values (when isMultiple returns true).voidsetSuccessful(boolean successful)Sets this control's successful state.voidsetValue(String value)Sets the control's current value.
-
Constructor Details
-
Method Details
-
fireChanged
protected void fireChanged() -
fireSuccessful
protected void fireSuccessful() -
fireEnabled
protected void fireEnabled() -
addFormControlListener
- Specified by:
addFormControlListenerin interfaceFormControl
-
removeFormControlListener
- Specified by:
removeFormControlListenerin interfaceFormControl
-
getElement
- Specified by:
getElementin interfaceFormControl- Returns:
- the associated element
-
getForm
- Specified by:
getFormin interfaceFormControl- Returns:
- the associated form
-
getName
- Specified by:
getNamein interfaceFormControl- Returns:
- the name of the control
-
getInitialValue
- Specified by:
getInitialValuein interfaceFormControl- Returns:
- the initial value
-
setInitialValue
-
getValue
- Specified by:
getValuein interfaceFormControl- Returns:
- the control's current value or
nullif isMultiple returns true
-
setValue
Description copied from interface:FormControlSets the control's current value. This has no effect when isMultiple returns true.- Specified by:
setValuein interfaceFormControl
-
getMultipleValues
- Specified by:
getMultipleValuesin interfaceFormControl- Returns:
- the control's current values or
nullif isMultiple returns false
-
setMultipleValues
Description copied from interface:FormControlSets the control's current values (when isMultiple returns true). This has no effect when isMultiple returns false.- Specified by:
setMultipleValuesin interfaceFormControl
-
isHidden
public boolean isHidden() -
isEnabled
public boolean isEnabled()Description copied from interface:FormControlIs this control enabled?- Specified by:
isEnabledin interfaceFormControl- Returns:
trueif this control is enabled
-
isSuccessful
public boolean isSuccessful()Description copied from interface:FormControlIs this control successful?- Specified by:
isSuccessfulin interfaceFormControl- Returns:
trueif this control is successful and its name-value pair should be submitted,falseotherwise.
-
isMultiple
public boolean isMultiple()- Specified by:
isMultiplein interfaceFormControl- Returns:
trueif this control accepts multiple values,falseotherwise
-
setSuccessful
public void setSuccessful(boolean successful)Description copied from interface:FormControlSets this control's successful state.- Specified by:
setSuccessfulin interfaceFormControl
-
setEnabled
public void setEnabled(boolean enabled)Description copied from interface:FormControlEnable/disable this control- Specified by:
setEnabledin interfaceFormControl
-
reset
public void reset()Description copied from interface:FormControlReset the control to it's initial state- Specified by:
resetin interfaceFormControl
-
collectText
-
getIntAttribute
-