Class Button
- java.lang.Object
-
- org.openidentityplatform.openam.click.control.AbstractControl
-
- org.openidentityplatform.openam.click.control.Field
-
- org.openidentityplatform.openam.click.control.Button
-
- All Implemented Interfaces:
Serializable,org.apache.click.Stateful,org.openidentityplatform.openam.click.Control
public class Button extends Field
Provides a Button control: <input type='button'/>.
The Button control is used to render a JavaScript enabled button which can perform client side logic. The Button control provides no server side processing. If server side processing is required useExample <input type='button' value='Button'/> Submitinstead.Button Example
The example below adds a back button to a form, which when clicked returns to the previous page.Button backButton = new Button("back", " < Back "); backButton.setOnClick("history.back();"); backButton.setTitle("Return to previous page"); form.add(backButton);
HTML output:<input type='button' name='back' value=' < Back ' onclick='history.back();' title='Return to previous page'/>See also W3C HTML reference INPUT- See Also:
Reset,Submit, Serialized Form
-
-
Field Summary
-
Fields inherited from class org.openidentityplatform.openam.click.control.Field
disabled, error, focus, form, help, label, labelStyle, labelStyleClass, parentStyleClassHint, parentStyleHint, readonly, required, tabindex, title, trim, validate, value
-
Fields inherited from class org.openidentityplatform.openam.click.control.AbstractControl
actionListener, attributes, behaviors, headElements, listener, listenerMethod, messages, name, parent, styles
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetControlSizeEst()Return the estimated rendered control size in characters.StringgetOnClick()Returns the button onclick attribute value, or null if not defined.StringgetTag()Return the button's html tag:input.StringgetType()Return the input type: 'button'.booleanonProcess()For non Ajax requests this method returns true, as buttons by default perform no server side logic.voidrender(HtmlStringBuffer buffer)Render the HTML representation of the Button.voidsetOnClick(String value)Sets the button onclick attribute value.-
Methods inherited from class org.openidentityplatform.openam.click.control.Field
bindRequestValue, getError, getErrorLabel, getFocus, getFocusJavaScript, getForm, getHelp, getId, getLabel, getLabelStyle, getLabelStyleClass, getParentStyleClassHint, getParentStyleHint, getRequestValue, getState, getTabIndex, getTextAlign, getTitle, getValidate, getValidationJavaScript, getValue, getValueObject, getWidth, isDisabled, isHidden, isReadonly, isRequired, isTrim, isValid, removeState, renderTagBegin, restoreState, saveState, setDisabled, setError, setErrorMessage, setErrorMessage, setFocus, setForm, setHelp, setLabel, setLabelStyle, setLabelStyleClass, setListener, setParent, setParentStyleClassHint, setParentStyleHint, setReadonly, setRequired, setState, setTabIndex, setTextAlign, setTitle, setTrim, setValidate, setValue, setValueObject, setWidth, validate
-
Methods inherited from class org.openidentityplatform.openam.click.control.AbstractControl
addBehavior, addStyleClass, appendAttributes, dispatchActionEvent, getActionListener, getAttribute, getAttributes, getBehaviors, getContext, getHeadElements, getHtmlImports, getMessage, getMessage, getMessages, getName, getPage, getParent, getStyle, getStyles, hasAttribute, hasAttributes, hasBehaviors, hasStyles, isAjaxTarget, onDeploy, onDestroy, onInit, onRender, removeBehavior, removeStyleClass, renderTagEnd, setActionListener, setAttribute, setId, setName, setStyle, toString
-
-
-
-
Constructor Detail
-
Button
public Button(String name)
Create a button with the given name.- Parameters:
name- the button name
-
Button
public Button(String name, String label)
Create a button with the given name and label. The button label is rendered as the HTML "value" attribute.- Parameters:
name- the button namelabel- the button label
-
Button
public Button()
Create a button with no name defined.Please note the control's name must be defined before it is valid.
-
-
Method Detail
-
getTag
public String getTag()
Return the button's html tag:input.- Overrides:
getTagin classAbstractControl- Returns:
- this controls html tag
- See Also:
AbstractControl.getTag()
-
getOnClick
public String getOnClick()
Returns the button onclick attribute value, or null if not defined.- Returns:
- the button onclick attribute value, or null if not defined.
-
setOnClick
public void setOnClick(String value)
Sets the button onclick attribute value.- Parameters:
value- the onclick attribute value.
-
getType
public String getType()
Return the input type: 'button'.- Returns:
- the input type: '
button'
-
onProcess
public boolean onProcess()
For non Ajax requests this method returns true, as buttons by default perform no server side logic. If the button is an Ajax target and a behavior is defined, the behavior action will be invoked.- Specified by:
onProcessin interfaceorg.openidentityplatform.openam.click.Control- Overrides:
onProcessin classField- Returns:
- true to continue Page event processing or false otherwise
- See Also:
Field.onProcess()
-
getControlSizeEst
public int getControlSizeEst()
Description copied from class:AbstractControlReturn the estimated rendered control size in characters.- Overrides:
getControlSizeEstin classAbstractControl- Returns:
- the estimated rendered control size in characters
- See Also:
AbstractControl.getControlSizeEst()
-
render
public void render(HtmlStringBuffer buffer)
Render the HTML representation of the Button. Note the button label is rendered as the HTML "value" attribute.- Specified by:
renderin interfaceorg.openidentityplatform.openam.click.Control- Overrides:
renderin classAbstractControl- Parameters:
buffer- the specified buffer to render the control's output to- See Also:
AbstractControl.toString()
-
-