net.sf.click.extras.control
Class PageSubmit

java.lang.Object
  extended bynet.sf.click.control.AbstractControl
      extended bynet.sf.click.control.Field
          extended bynet.sf.click.control.Button
              extended bynet.sf.click.control.Submit
                  extended bynet.sf.click.extras.control.PageSubmit
All Implemented Interfaces:
Control, Serializable

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

Author:
Malcolm Edgar
See Also:
Serialized Form

Field Summary
protected  Class pageClass
          The target page to redirect to.
 
Fields inherited from class net.sf.click.control.Submit
clicked
 
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
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 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 pageClass)
          Create a PageSubmit button with the given name, label and target pageClass.
 
Method Summary
 Class 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 pageClass)
          Set the target page class to redirect to.
 
Methods inherited from class net.sf.click.control.Submit
bindRequestValue, getCancelJavaScriptValidation, getType, isClicked, onProcess, setCancelJavaScriptValidation
 
Methods inherited from class net.sf.click.control.Button
getControlSizeEst, getOnClick, getTag, onRender, render, setOnClick
 
Methods inherited from class net.sf.click.control.Field
getError, getErrorLabel, getFocus, getFocusJavaScript, getForm, getHelp, getId, getLabel, getRequestValue, getTabIndex, getTextAlign, getTitle, getValidate, getValidationJavaScript, getValue, getValueObject, getWidth, isDisabled, isHidden, isReadonly, isRequired, isValid, onInit, setDisabled, setError, setErrorMessage, setErrorMessage, setErrorMessage, setErrorMessage, setFocus, setForm, setHelp, setLabel, setListener, setParent, setReadonly, setRequired, setTabIndex, setTextAlign, setTitle, setValidate, setValue, setValueObject, 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, 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 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 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 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 getPageClass()
Return the target page class to redirect to.

Returns:
the target page class to redirect to

setPageClass

public void setPageClass(Class 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