org.apache.click.extras.control
Class PageSubmit

java.lang.Object
  extended by org.apache.click.control.AbstractControl
      extended by org.apache.click.control.Field
          extended by org.apache.click.control.Button
              extended by org.apache.click.control.Submit
                  extended by org.apache.click.extras.control.PageSubmit
All Implemented Interfaces:
Serializable, Control, Stateful

public class PageSubmit
extends Submit

Provides a Page redirect Submit control:   <input type='submit'>.

The PageSubmit is a Submit button which enables you to redirect to another page from a Form, without having to define a listener method.

This control is typically used for Cancel buttons.

PageSubmit Example

The example code below will redirect the request to the HomePage if the cancel button is pressed.
    form.add(new Submit("ok", " OK ", this, "onOkClick"));
    form.add(new PageSubmit("cancel", "Cancel", HomePage.class));
 

See also the W3C HTML reference INPUT

See Also:
Serialized Form

Field Summary
protected  Class<? extends Page> pageClass
          The target page to redirect to.
 
Fields inherited from class org.apache.click.control.Submit
clicked
 
Fields inherited from class org.apache.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.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
PageSubmit()
          Create an PageSubmit button with no name or target page class defined.
PageSubmit(String name)
          Create a PageSubmit button with the given name.
PageSubmit(String name, Class<? extends Page> pageClass)
          Create a PageSubmit button with the given name and target pageClass.
PageSubmit(String name, String label)
          Create a PageSubmit button with the given name and label.
PageSubmit(String name, String label, Class<? extends Page> pageClass)
          Create a PageSubmit button with the given name, label and target pageClass.
 
Method Summary
 Class<? extends Page> getPageClass()
          Return the target page class to redirect to.
 boolean onClick()
          The submit buttons callback listener, which will redirect the page to the defined target page class and return false to abort any further processing.
 void setPageClass(Class<? extends Page> pageClass)
          Set the target page class to redirect to.
 
Methods inherited from class org.apache.click.control.Submit
bindRequestValue, getCancelJavaScriptValidation, getType, isClicked, onProcess, setCancelJavaScriptValidation
 
Methods inherited from class org.apache.click.control.Button
getControlSizeEst, getOnClick, getTag, render, setOnClick
 
Methods inherited from class org.apache.click.control.Field
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.apache.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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

pageClass

protected Class<? extends Page> pageClass
The target page to redirect to.

Constructor Detail

PageSubmit

public PageSubmit(String name)
Create a PageSubmit button with the given name.

Parameters:
name - the button name

PageSubmit

public PageSubmit(String name,
                  String label)
Create a PageSubmit button with the given name and label.

Parameters:
name - the button name
label - the button display label

PageSubmit

public PageSubmit(String name,
                  Class<? extends Page> pageClass)
Create a PageSubmit button with the given name and target pageClass.

Parameters:
name - the button name
pageClass - the target page class

PageSubmit

public PageSubmit(String name,
                  String label,
                  Class<? extends Page> pageClass)
Create a PageSubmit button with the given name, label and target pageClass.

Parameters:
name - the button name
label - the button display label
pageClass - the target page class

PageSubmit

public PageSubmit()
Create an PageSubmit button with no name or target page class defined.

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

Method Detail

getPageClass

public Class<? extends Page> getPageClass()
Return the target page class to redirect to.

Returns:
the target page class to redirect to

setPageClass

public void setPageClass(Class<? extends Page> pageClass)
Set the target page class to redirect to.

Parameters:
pageClass - the target page class to redirect to

onClick

public boolean onClick()
The submit buttons callback listener, which will redirect the page to the defined target page class and return false to abort any further processing.

Returns:
false to abort any further processing