wicket.markup.html.form
Class Button

java.lang.Object
  extended bywicket.Component
      extended bywicket.MarkupContainer
          extended bywicket.markup.html.WebMarkupContainer
              extended bywicket.markup.html.form.FormComponent
                  extended bywicket.markup.html.form.Button
All Implemented Interfaces:
IAjaxListener, IHeaderContributor, IRequestListener, java.io.Serializable
Direct Known Subclasses:
ImageButton

public class Button
extends FormComponent

A form button.

Within a form, you can nest Button components. Note that you don't have to do this to let the form work (a simple <input type="submit".. suffices), but if you want to have different kinds of submit behaviour it might be a good idea to use Buttons.

When you add a Wicket Button to a form, and that button is clicked, by default the button's onSubmit method is called first, and after that the form's onSubmit button is called. If you want to change this (e.g. you don't want to call the form's onSubmit method, or you want it called before the button's onSubmit method), you can override Form.delegateSubmit.

One other option you should know of is the 'defaultFormProcessing' property of Button components. When you set this to false (default is true), all validation and formupdating is bypassed and the onSubmit method of that button is called directly, and the onSubmit method of the parent form is not called. A common use for this is to create a cancel button.

Author:
Jonathan Locke, Eelco Hillenius
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class wicket.markup.html.form.FormComponent
FormComponent.IVisitor
 
Nested classes inherited from class wicket.Component
Component.ComponentModelChange, Component.VisibilityChange
 
Field Summary
 
Fields inherited from class wicket.markup.html.form.FormComponent
FLAG_CONVERT_EMPTY_INPUT_STRING_TO_NULL, NO_INVALID_INPUT
 
Fields inherited from class wicket.Component
FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4
 
Constructor Summary
Button(java.lang.String id)
           
Button(java.lang.String id, IModel object)
           
 
Method Summary
 boolean getDefaultFormProcessing()
          Gets the defaultFormProcessing property.
protected  java.lang.String getOnClickScript()
           
protected  void onComponentTag(ComponentTag tag)
          Processes the component tag.
protected  void onSubmit()
          Override this method to provide special submit handling in a multi-button form
 Button setDefaultFormProcessing(boolean defaultFormProcessing)
          Sets the defaultFormProcessing property.
 void updateModel()
          Implemented by form component subclass to update the form component's model.
 
Methods inherited from class wicket.markup.html.form.FormComponent
add, getForm, getInput, getInputName, getLabel, getModelValue, getValidationType, getValidators, getValue, inputAsInt, inputAsInt, inputAsIntArray, inputAsStringArray, invalid, isMultiPart, isPersistent, isValid, isValidated, onInvalid, onModelChanged, onValid, setLabel, setModelValue, setPersistent, supportsPersistence, valid, validate
 
Methods inherited from class wicket.markup.html.WebMarkupContainer
getMarkupType, onRender, renderHead
 
Methods inherited from class wicket.MarkupContainer
add, autoAdd, contains, findMarkupStream, get, getAssociatedMarkupStream, getMarkupStream, internalAdd, internalBeginRequest, internalEndRequest, iterator, iterator, onComponentTagBody, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderComponentTagBody, replace, setMarkupStream, setModel, size, toString, toString, visitChildren, visitChildren
 
Methods inherited from class wicket.Component
add, add, addStateChange, checkComponentTag, checkComponentTagAttribute, debug, detachModel, error, exceptionMessage, fatal, findPage, findParent, findParentWithAssociatedMarkup, getAjaxHandlers, getApplication, getApplicationPages, getApplicationSettings, getClassRelativePath, getComparator, getConverter, getEscapeModelStrings, getFeedbackMessage, getFlag, getId, getLocale, getLocalizer, getModel, getModelObject, getModelObjectAsString, getPage, getPageFactory, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getResource, getResponse, getSession, getString, getString, getString, getStyle, getVariation, hasErrorMessage, hasFeedbackMessage, info, initModel, internalOnBeginRequest, internalOnEndRequest, internalOnModelChanged, internalOnModelChanging, isAncestorOf, isVersioned, isVisible, isVisibleInHierarchy, modelChanged, modelChanging, newPage, newPage, onBeginRequest, onEndRequest, onModelChanging, onRequest, onSessionAttach, redirectTo, remove, render, renderComponent, renderComponentTag, rendered, replaceComponentTagBody, sameRootModel, sameRootModel, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setModelObject, setRedirect, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisible, urlFor, urlFor, visitParents, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Button

public Button(java.lang.String id)
See Also:
Component.Component(String)

Button

public Button(java.lang.String id,
              IModel object)
See Also:
Component.Component(String, IModel)
Method Detail

getDefaultFormProcessing

public final boolean getDefaultFormProcessing()
Gets the defaultFormProcessing property. When false (default is true), all validation and formupdating is bypassed and the onSubmit method of that button is called directly, and the onSubmit method of the parent form is not called. A common use for this is to create a cancel button.

Returns:
defaultFormProcessing

setDefaultFormProcessing

public final Button setDefaultFormProcessing(boolean defaultFormProcessing)
Sets the defaultFormProcessing property. When false (default is true), all validation and formupdating is bypassed and the onSubmit method of that button is called directly, and the onSubmit method of the parent form is not called. A common use for this is to create a cancel button.

Parameters:
defaultFormProcessing - defaultFormProcessing
Returns:
This

updateModel

public void updateModel()
Description copied from class: FormComponent
Implemented by form component subclass to update the form component's model. DO NOT CALL THIS METHOD DIRECTLY UNLESS YOU ARE SURE WHAT YOU ARE DOING. USUALLY UPDATING YOUR MODEL IS HANDLED BY THE FORM, NOT DIRECTLY BY YOU.

Specified by:
updateModel in class FormComponent
See Also:
FormComponent.updateModel()

getOnClickScript

protected java.lang.String getOnClickScript()
Returns:
Any onClick JavaScript that should be used

onComponentTag

protected void onComponentTag(ComponentTag tag)
Processes the component tag.

Overrides:
onComponentTag in class FormComponent
Parameters:
tag - Tag to modify
See Also:
Component.onComponentTag(ComponentTag)

onSubmit

protected void onSubmit()
Override this method to provide special submit handling in a multi-button form



Copyright © 2004-2006 Wicket developers. All Rights Reserved.