org.apache.click.extras.control
Class PageButton

java.lang.Object
  extended by org.apache.click.control.AbstractControl
      extended by org.apache.click.control.AbstractLink
          extended by org.apache.click.control.PageLink
              extended by org.apache.click.extras.control.PageButton
All Implemented Interfaces:
Serializable, Control, Stateful

public class PageButton
extends PageLink

Provides a Page link Button control:   <input type='button'>.

The PageButton is provides link style navigation button to a Page that is rendered in form of a button (an input HTML element with the type="button" more precisely) plus javascript getting the browser to the location of that Page.

PageButton Advantages

Note: this control is related to PageLink and not to PageSubmit.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.click.control.PageLink
pageClass
 
Fields inherited from class org.apache.click.control.AbstractLink
disabled, imageSrc, label, parameters, renderLabelAndImage, tabindex, title
 
Fields inherited from class org.apache.click.control.AbstractControl
actionListener, attributes, behaviors, headElements, listener, listenerMethod, messages, name, parent, styles
 
Fields inherited from interface org.apache.click.Control
CONTROL_MESSAGES
 
Constructor Summary
PageButton()
          Create a PageButton with no name defined.
PageButton(Class<? extends Page> targetPage)
          Create a PageButton for the given target Page class.
PageButton(String name)
          Create a PageButton for the given name.
PageButton(String name, Class<? extends Page> targetPage)
          Create a PageButton for the given name and target Page class.
PageButton(String name, String label, Class<? extends Page> targetPage)
          Create a PageButton for the given name, label and target Page class.
 
Method Summary
 String getOnClick()
          Return the Button's onClick() String, representing a javascript location of the Page to get.
 String getTag()
          Return the links html tag: input.
 void render(HtmlStringBuffer buffer)
          Render the HTML representation of the button.
 String toString()
          Return a HTML rendered Button string.
 
Methods inherited from class org.apache.click.control.PageLink
getHref, getPageClass, onProcess, setActionListener, setListener, setPageClass
 
Methods inherited from class org.apache.click.control.AbstractLink
bindRequestParameters, bindRequestValue, defineParameter, getId, getImageSrc, getLabel, getParameter, getParameters, getParameterValues, getState, getTabIndex, getTitle, hasParameters, isAjaxTarget, isDisabled, isRenderLabelAndImage, removeState, renderImgTag, renderParameters, restoreState, saveState, setDisabled, setImageSrc, setLabel, setParameter, setParameters, setParameterValues, setRenderLabelAndImage, setState, setTabIndex, setTitle
 
Methods inherited from class org.apache.click.control.AbstractControl
addBehavior, addStyleClass, appendAttributes, dispatchActionEvent, getActionListener, getAttribute, getAttributes, getBehaviors, getContext, getControlSizeEst, getHeadElements, getHtmlImports, getMessage, getMessage, getMessages, getName, getPage, getParent, getStyle, getStyles, hasAttribute, hasAttributes, hasBehaviors, hasStyles, onDeploy, onDestroy, onInit, onRender, removeBehavior, removeStyleClass, renderTagBegin, renderTagEnd, setAttribute, setId, setName, setParent, setStyle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PageButton

public PageButton(String name)
Create a PageButton for the given name.

Parameters:
name - the page button name
Throws:
IllegalArgumentException - if the name is null

PageButton

public PageButton(String name,
                  Class<? extends Page> targetPage)
Create a PageButton for the given name and target Page class.

Parameters:
name - the page button name
targetPage - the target page class
Throws:
IllegalArgumentException - if the name is null

PageButton

public PageButton(String name,
                  String label,
                  Class<? extends Page> targetPage)
Create a PageButton for the given name, label and target Page class.

Parameters:
name - the page button name
label - the page button label
targetPage - the target page class
Throws:
IllegalArgumentException - if the name is null

PageButton

public PageButton(Class<? extends Page> targetPage)
Create a PageButton for the given target Page class.

Parameters:
targetPage - the target page class
Throws:
IllegalArgumentException - if the name is null

PageButton

public PageButton()
Create a PageButton with no name defined.

Please note the control's name and target pageClass must be defined before it is valid.

Method Detail

getTag

public String getTag()
Return the links html tag: input.

Overrides:
getTag in class AbstractLink
Returns:
this controls html tag
See Also:
AbstractControl.getTag()

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:
render in interface Control
Overrides:
render in class AbstractLink
Parameters:
buffer - the specified buffer to render the control's output to

toString

public String toString()
Return a HTML rendered Button string. Note the button label is rendered as the HTML "value" attribute.

Overrides:
toString in class AbstractControl
Returns:
a HTML rendered Button string
See Also:
Object.toString()

getOnClick

public String getOnClick()
Return the Button's onClick() String, representing a javascript location of the Page to get.

Returns:
the Button's onClick() String, representing a javascript location of the Page to get.