public abstract class FormControl extends Object
Modifier and Type | Class and Description |
---|---|
class |
FormControl.Scriptable
implementation of Scriptable input elements
|
Modifier and Type | Field and Description |
---|---|
static String |
BUTTON_TYPE |
static String |
CHECKBOX_TYPE |
static String |
FILE_TYPE |
static String |
HIDDEN_TYPE |
static String |
IMAGE_BUTTON_TYPE |
static String |
MULTIPLE_TYPE |
static String |
PASSWORD_TYPE |
static String |
RADIO_BUTTON_TYPE |
static String |
RESET_BUTTON_TYPE |
static String |
SINGLE_TYPE |
static String |
SUBMIT_BUTTON_TYPE |
static String |
TEXT_TYPE |
static String |
TEXTAREA_TYPE |
static String |
UNDEFINED_TYPE |
Modifier | Constructor and Description |
---|---|
protected |
FormControl(WebForm form,
HTMLControl control)
initialize the given form control from a Webform and a HTMLControl
|
Modifier and Type | Method and Description |
---|---|
protected abstract void |
addValues(ParameterProcessor processor,
String characterSet) |
protected void |
claimUniqueValue(List values)
Sets this control to the next compatible value from the list, removing it from the list.
|
protected void |
claimValueIsRequired(List values,
String value)
Removes the specified required value from the list of values, throwing an exception if it is missing.
|
boolean |
doEvent(String eventScript)
Deprecated.
since 1.7 - use doEventScript instead
|
boolean |
doEventScript(String eventScript)
optional do the event if it's defined
|
protected boolean |
doOnChangeEvent()
Performs the 'onchange' event defined for this control.
|
protected boolean |
doOnClickEvent()
Performs the 'onClick' event defined for this control.
|
protected boolean |
doOnMouseDownEvent()
Performs the 'onMouseDown' event defined for this control.
|
protected boolean |
doOnMouseUpEvent()
Performs the 'onMouseUp' event defined for this control.
|
protected String |
emptyIfNull(String value) |
String |
getAttribute(String name)
get the Attribute with the given name - by delegating to
NodeUtils
|
protected String |
getAttribute(String name,
String defaultValue) |
String |
getClassName()
Returns the class associated with this element.
|
protected String[] |
getDisplayedOptions()
Returns the list of values displayed by this control, if any.
|
protected WebForm |
getForm() |
String |
getID()
Returns the ID associated with this element.
|
String |
getName()
Returns the name associated with this element.
|
Node |
getNode()
Returns the DOM node underlying this element.
|
String[] |
getOptionValues()
Returns the values permitted in this control.
|
ScriptableDelegate |
getParentDelegate()
Returns the scriptable delegate which can provide the scriptable delegate for this element.
|
ScriptingHandler |
getScriptingHandler()
Returns a scriptable object which can act as a proxy for this control.
|
String |
getTagName()
Returns the tag name of this node.
|
String |
getText()
Returns the text value of this block.
|
String |
getTitle()
Returns the title associated with this element.
|
abstract String |
getType()
Return the type of the control, as seen from JavaScript.
|
protected String |
getValueAttribute()
Returns the value of this control in the form.
|
protected abstract String[] |
getValues()
Returns the current value(s) associated with this control.
|
boolean |
handleEvent(String eventName)
handle the event with the given name by getting the
attribute and then executing the eventScript for it
|
boolean |
isDisabled()
Returns true if this control is disabled, meaning that it will not send a value to the server as part of a request.
|
boolean |
isHidden()
Returns true if this control is hidden.
|
protected boolean |
isMultiValued()
Returns true if a single control can have multiple values.
|
protected boolean |
isReadOnly()
Returns true if this control is read-only.
|
boolean |
isSupportedAttribute(String name)
Returns true if this element may have an attribute with the specified name.
|
ScriptableDelegate |
newScriptable()
Creates and returns a scriptable object for this control.
|
void |
removeAttribute(String name)
remove the Attribute with the given name - by delegating to NodeUtils
|
protected void |
reset()
Resets this control to its initial value.
|
protected void |
sendOnChangeEvent()
Deprecated.
since 1.7 use doOnChangeEvent instead
|
protected void |
sendOnClickEvent()
Deprecated.
since 1.7 use doOnClickEvent instead
|
protected void |
sendOnMouseDownEvent()
Deprecated.
since 1.7 use doOnMouseDownEvent instead
|
protected void |
sendOnMouseUpEvent()
Deprecated.
since 1.7 use doOnMouseUpEvent instead
|
void |
setAttribute(String name,
Object value)
set the Attribute with the given name - by delegating to NodeUtils
|
void |
setState(boolean state)
Sets the state of this boolean control.
|
protected void |
setValueAttribute(String value)
Sets the value of this control in the form.
|
protected void |
supportAttribute(String name) |
void |
toggle()
Toggles the value of this control.
|
public static final String UNDEFINED_TYPE
public static final String BUTTON_TYPE
public static final String RESET_BUTTON_TYPE
public static final String SUBMIT_BUTTON_TYPE
public static final String IMAGE_BUTTON_TYPE
public static final String RADIO_BUTTON_TYPE
public static final String CHECKBOX_TYPE
public static final String TEXT_TYPE
public static final String PASSWORD_TYPE
public static final String HIDDEN_TYPE
public static final String TEXTAREA_TYPE
public static final String FILE_TYPE
public static final String SINGLE_TYPE
public static final String MULTIPLE_TYPE
protected FormControl(WebForm form, HTMLControl control)
form
- control
- public abstract String getType()
protected abstract String[] getValues()
protected final WebForm getForm()
public ScriptableDelegate getParentDelegate()
HTMLElement
public String[] getOptionValues()
protected String[] getDisplayedOptions()
protected boolean isReadOnly()
public boolean isHidden()
public boolean isDisabled()
protected boolean isMultiValued()
protected abstract void addValues(ParameterProcessor processor, String characterSet) throws IOException
IOException
protected void claimUniqueValue(List values)
protected void reset()
public void toggle()
public void setState(boolean state)
protected void sendOnChangeEvent()
protected boolean doOnChangeEvent()
protected void sendOnClickEvent()
protected boolean doOnClickEvent()
protected void sendOnMouseUpEvent()
protected boolean doOnMouseUpEvent()
protected void sendOnMouseDownEvent()
protected boolean doOnMouseDownEvent()
public ScriptableDelegate newScriptable()
newScriptable
in interface HTMLElement
protected String getValueAttribute()
protected void setValueAttribute(String value)
protected final void claimValueIsRequired(List values, String value)
public String getID()
HTMLElement
getID
in interface HTMLElement
public String getClassName()
HTMLElement
getClassName
in interface HTMLElement
public String getTitle()
HTMLElement
getTitle
in interface HTMLElement
public String getName()
HTMLElement
getName
in interface HTMLElement
public ScriptingHandler getScriptingHandler()
getScriptingHandler
in interface HTMLElement
public boolean doEvent(String eventScript)
doEvent
in interface ScriptingEventHandler
eventScript
- - the script to usepublic boolean doEventScript(String eventScript)
doEventScript
in interface ScriptingEventHandler
public boolean handleEvent(String eventName)
ScriptingEventHandler
handleEvent
in interface ScriptingEventHandler
public String getText()
getText
in interface HTMLElement
public String getTagName()
HTMLElement
getTagName
in interface HTMLElement
public String getAttribute(String name)
getAttribute
in interface HTMLElement
name
- - the name of the attribute to getpublic void setAttribute(String name, Object value)
setAttribute
in interface HTMLElement
name
- - the name of the attribute to setvalue
- - the value to setpublic void removeAttribute(String name)
removeAttribute
in interface HTMLElement
name
- - the name of the attribute to removepublic boolean isSupportedAttribute(String name)
HTMLElement
isSupportedAttribute
in interface HTMLElement
public Node getNode()
HTMLElement
getNode
in interface HTMLElement
protected void supportAttribute(String name)
Copyright © 2012. All Rights Reserved.