|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.click.control.AbstractControl net.sf.click.control.Field net.sf.click.control.Button net.sf.click.control.ActionButton
Provides a ActionButton control: <input type="button"/>.
ActionLink
control, where you can attach
action listeners to the button. When the button is clicked it will make a
JavaScript GET request. This request is then processed by the ActionButton
and its listener is invoked.
ActionButton actionButton = new ActionButton("button"); actionButton.setListener(this, "onButtonClick"); addControl(actionButton);Please Note do not add ActionButton instances to the Form object, as the GET request it generates will never be processed by the Form, and in turn the Form will not invoke the ActionButton's onProcess() method.
ActionLink
,
Serialized FormField Summary | |
static String |
ACTION_BUTTON
The action button parameter name: actionButton. |
protected boolean |
clicked
The button is clicked. |
protected Map |
parameters
The link parameters map. |
static String |
VALUE
The value parameter name: value. |
Fields inherited from class net.sf.click.control.Field |
disabled, error, focus, form, help, label, readonly, required, tabindex, title, validate, value |
Fields inherited from class net.sf.click.control.AbstractControl |
actionListener, attributes, listener, listenerMethod, messages, name, parent, styles |
Fields inherited from interface net.sf.click.Control |
CONTROL_MESSAGES |
Constructor Summary | |
ActionButton()
Create an ActionButton with no name defined. |
|
ActionButton(Object listener,
String method)
Create an ActionButton for the given listener object and listener method. |
|
ActionButton(String name)
Create an ActionButton for the given name. |
|
ActionButton(String name,
Object listener,
String method)
Create an ActionButton for the given name, listener object and listener method. |
|
ActionButton(String name,
String label)
Create an ActionButton for the given name and label. |
|
ActionButton(String name,
String label,
Object listener,
String method)
Create an ActionButton for the given name, label, listener object and listener method. |
Method Summary | |
void |
bindRequestValue()
This method binds the submitted request value to the ActionLink's value. |
String |
getOnClick()
Return the ActionButton anchor <a> tag href attribute value. |
String |
getOnClick(Object value)
Return the ActionButton onclick attribute for the given value. |
String |
getParameter(String name)
Return the button request parameter value for the given name, or null if the parameter value does not exist. |
Map |
getParameters()
Return the ActionButton parameters Map. |
String |
getValue()
Returns the ActionButton value if the action link was processed and has a value, or null otherwise. |
Double |
getValueDouble()
Returns the ActionButton Double value if the action button was processed and has a value, or null otherwise. |
Integer |
getValueInteger()
Returns the ActionButton Integer value if the action button was processed and has a value, or null otherwise. |
Long |
getValueLong()
Returns the ActionButton Long value if the action button was processed and has a value, or null otherwise. |
Object |
getValueObject()
Return the value of the ActionButton. |
boolean |
hasParameters()
Return true if the ActionButton has parameters or false otherwise. |
boolean |
isClicked()
Returns true if the ActionButton was clicked, otherwise returns false. |
boolean |
onProcess()
This method will set the isClicked() property to true if the
ActionButton was clicked, and if an action callback listener was set
this will be invoked. |
void |
render(HtmlStringBuffer buffer)
Render the HTML representation of the ActionButton. |
void |
setName(String name)
Set the name of the Control. |
void |
setParameter(String name,
String value)
Set the button parameter with the given parameter name and value. |
void |
setParent(Object parent)
Set the parent of the ActionButton. |
void |
setValue(String value)
Set the ActionButton value. |
void |
setValueObject(Object object)
Set the value of the field using the given object. |
Methods inherited from class net.sf.click.control.Button |
getControlSizeEst, getTag, getType, onRender, setOnClick |
Methods inherited from class net.sf.click.control.Field |
getError, getErrorLabel, getFocus, getFocusJavaScript, getForm, getHelp, getId, getLabel, getRequestValue, getTabIndex, getTextAlign, getTitle, getValidate, getValidationJavaScript, getWidth, isDisabled, isHidden, isReadonly, isRequired, isValid, onInit, setDisabled, setError, setErrorMessage, setErrorMessage, setErrorMessage, setErrorMessage, setFocus, setForm, setHelp, setLabel, setListener, setReadonly, setRequired, setTabIndex, setTextAlign, setTitle, setValidate, setWidth, validate |
Methods inherited from class net.sf.click.control.AbstractControl |
addStyleClass, appendAttributes, getActionListener, getAttribute, getAttributes, getContext, getHtmlImports, getMessage, getMessage, getMessage, getMessages, getName, getPage, getParent, getStyle, getStyles, hasAttribute, hasAttributes, hasStyles, onDeploy, onDestroy, registerActionEvent, removeStyleClass, renderTagBegin, renderTagEnd, setActionListener, setAttribute, setId, setStyle, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final String ACTION_BUTTON
public static final String VALUE
protected boolean clicked
protected Map parameters
Constructor Detail |
public ActionButton(String name)
name
- the action button name
IllegalArgumentException
- if the name is nullpublic ActionButton(String name, String label)
name
- the action button namelabel
- the action button label
IllegalArgumentException
- if the name is nullpublic ActionButton(Object listener, String method)
listener
- the listener target objectmethod
- the listener method to call
IllegalArgumentException
- if the name, listener or method is null
or if the method is blankpublic ActionButton(String name, Object listener, String method)
name
- the action button namelistener
- the listener target objectmethod
- the listener method to call
IllegalArgumentException
- if the name, listener or method is null
or if the method is blankpublic ActionButton(String name, String label, Object listener, String method)
name
- the action button namelabel
- the action button labellistener
- the listener target objectmethod
- the listener method to call
IllegalArgumentException
- if the name, listener or method is null
or if the method is blankpublic ActionButton()
Method Detail |
public boolean isClicked()
public void setName(String name)
setName
in interface Control
setName
in class AbstractControl
name
- of the control
IllegalArgumentException
- if the name is nullControl.setName(String)
public void setParent(Object parent)
setParent
in interface Control
setParent
in class Field
parent
- the parent of the Control
IllegalStateException
- if AbstractControl.name
is not defined
IllegalArgumentException
- if the given parent instance is
referencing this object: if (parent == this)Control.setParent(Object)
public String getOnClick(Object value)
value
- the ActionButton value parameter
public String getOnClick()
getOnClick
in class Button
public String getParameter(String name)
name
- the name of request parameter
public void setParameter(String name, String value)
name
- the attribute namevalue
- the attribute value
IllegalArgumentException
- if name parameter is nullpublic Map getParameters()
public boolean hasParameters()
public String getValue()
getValue
in class Field
public Double getValueDouble()
NumberFormatException
- if the value cannot be parsed into a Doublepublic Integer getValueInteger()
NumberFormatException
- if the value cannot be parsed into an Integerpublic Long getValueLong()
NumberFormatException
- if the value cannot be parsed into a Longpublic void setValue(String value)
setValue
in class Field
value
- the ActionButton valuepublic Object getValueObject()
getValueObject
in class Field
public void setValueObject(Object object)
setValueObject
in class Field
object
- the object value to setpublic void bindRequestValue()
bindRequestValue
in class Field
public boolean onProcess()
isClicked()
property to true if the
ActionButton was clicked, and if an action callback listener was set
this will be invoked.
onProcess
in interface Control
onProcess
in class Button
Control.onProcess()
public void render(HtmlStringBuffer buffer)
render
in interface Control
render
in class Button
buffer
- the specified buffer to render the control's output toAbstractControl.toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |