org.apache.tapestry.form
Class LinkSubmit

java.lang.Object
  extended by org.apache.hivemind.impl.BaseLocatable
      extended by org.apache.tapestry.AbstractComponent
          extended by org.apache.tapestry.form.AbstractFormComponent
              extended by org.apache.tapestry.form.LinkSubmit
All Implemented Interfaces:
org.apache.hivemind.Locatable, org.apache.hivemind.LocationHolder, IFormComponent, IComponent, IDirectEvent, IDynamicInvoker, Component, IRender

public abstract class LinkSubmit
extends AbstractFormComponent

Implements a component that submits its enclosing form via a JavaScript link. [ Component Reference ]

Author:
Richard Lewis-Shell

Field Summary
static String ATTRIBUTE_NAME
          The name of an IRequestCycle attribute in which the current submit link is stored.
 
Fields inherited from class org.apache.tapestry.AbstractComponent
_body, _bodyCount
 
Constructor Summary
LinkSubmit()
           
 
Method Summary
protected  void cleanupAfterRender(IRequestCycle cycle)
          Invoked by AbstractComponent.render(IMarkupWriter, IRequestCycle)after the component renders.
abstract  IActionListener getAction()
          parameter.
protected  boolean getCanTakeFocus()
          Links can not take focus, ever.
abstract  boolean getDefer()
          parameter.
abstract  IEngineService getDirectService()
          Injected.
abstract  IActionListener getListener()
          parameter.
abstract  ListenerInvoker getListenerInvoker()
          Injected.
abstract  Object getParameters()
          parameter.
protected  boolean getRenderBodyOnRewind()
          Returns true; the LinkSubmit's body should render during a rewind, even if the component is itself disabled.
abstract  IScript getSubmitScript()
          Injected.
abstract  String getSubmitType()
          The type of submission, normal/cancel/refresh.
abstract  Object getTag()
          parameter.
abstract  List getUpdateComponents()
          If set, will be used to update/refresh portions of a response during XHR requests.
abstract  boolean isAsync()
          Used to specify whether or not the result of this invocation should be returned asynchronously or use normal browser page reload semantics.
protected  boolean isClicked(IRequestCycle cycle, String name)
          Checks the submit name (FormConstants.SUBMIT_NAME_PARAMETER) to see if it matches this LinkSubmit's assigned element name.
abstract  boolean isJson()
          Used to specify that the return invocation of the response created should be in the "http://json.org" format.
protected  void prepareForRender(IRequestCycle cycle)
          Invoked by AbstractComponent.render(IMarkupWriter, IRequestCycle)to prepare the component to render.
protected  void renderFormComponent(IMarkupWriter writer, IRequestCycle cycle)
          Invoked from AbstractFormComponent.renderComponent(IMarkupWriter, IRequestCycle) to render the component.
protected  void renderSubmitBindings(IMarkupWriter writer, IRequestCycle cycle)
          Manages rendering of important submit client side bindings, like invoking the right submit type or any of the optional IDynamicInvoker parameters.
protected  void rewindFormComponent(IMarkupWriter writer, IRequestCycle cycle)
          Invoked from AbstractFormComponent.renderComponent(IMarkupWriter, IRequestCycle) to rewind the component.
abstract  void setSelected(Object tag)
          parameter.
 
Methods inherited from class org.apache.tapestry.form.AbstractFormComponent
generateClientId, getForm, getIdParameter, getName, isRequired, peekClientId, renderComponent, renderDelegateAttributes, renderDelegatePrefix, renderDelegateSuffix, setForm, setName, setName
 
Methods inherited from class org.apache.tapestry.AbstractComponent
addAsset, addBody, addComponent, checkActiveLock, enterActiveState, equals, finishLoad, finishLoad, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getBody, getBodyCount, getBoundId, getClientId, getComponent, getComponents, getContainedComponent, getContainedRenderers, getContainer, getEventInvoker, getExtendedId, getId, getIdPath, getInnerRenderers, getListeners, getMessages, getNamespace, getPage, getRenderWorker, getSpecification, getSpecifiedId, getTemplateTagName, hasEvents, hashCode, isInActiveState, isParameterBound, isRendering, isStateful, pageEndRender, render, renderBody, renderIdAttribute, renderInformalParameters, setBinding, setClientId, setContainedComponent, setContainer, setHasEvents, setId, setNamespace, setPage, setTemplateTagName, toString, triggerEvent
 
Methods inherited from class org.apache.hivemind.impl.BaseLocatable
getLocation, setLocation
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.tapestry.form.IFormComponent
getClientId, getDisplayName, isDisabled
 
Methods inherited from interface org.apache.tapestry.IComponent
addAsset, addBody, addComponent, enterActiveState, finishLoad, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getComponent, getComponents, getContainedComponent, getContainer, getEventInvoker, getExtendedId, getId, getIdPath, getListeners, getMessages, getNamespace, getPage, getSpecification, getSpecifiedId, getTemplateTagName, isRendering, renderBody, setBinding, setClientId, setContainedComponent, setContainer, setId, setNamespace, setPage, setTemplateTagName
 
Methods inherited from interface org.apache.tapestry.IRender
render
 
Methods inherited from interface org.apache.hivemind.LocationHolder
setLocation
 
Methods inherited from interface org.apache.hivemind.Locatable
getLocation
 

Field Detail

ATTRIBUTE_NAME

public static final String ATTRIBUTE_NAME
The name of an IRequestCycle attribute in which the current submit link is stored. LinkSubmits do not nest.

See Also:
Constant Field Values
Constructor Detail

LinkSubmit

public LinkSubmit()
Method Detail

isClicked

protected boolean isClicked(IRequestCycle cycle,
                            String name)
Checks the submit name (FormConstants.SUBMIT_NAME_PARAMETER) to see if it matches this LinkSubmit's assigned element name.

Parameters:
cycle - The current request.
name - The name of this form element.
Returns:
true if this submit was clicked

renderFormComponent

protected void renderFormComponent(IMarkupWriter writer,
                                   IRequestCycle cycle)
Description copied from class: AbstractFormComponent
Invoked from AbstractFormComponent.renderComponent(IMarkupWriter, IRequestCycle) to render the component.

Specified by:
renderFormComponent in class AbstractFormComponent
See Also:
AbstractFormComponent.renderFormComponent(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle)

prepareForRender

protected void prepareForRender(IRequestCycle cycle)
Description copied from class: AbstractComponent
Invoked by AbstractComponent.render(IMarkupWriter, IRequestCycle)to prepare the component to render. This implementation sets JavaBeans properties from matching bound parameters. The default implementation of this method is empty.

Overrides:
prepareForRender in class AbstractComponent
See Also:
AbstractComponent.prepareForRender(org.apache.tapestry.IRequestCycle)

cleanupAfterRender

protected void cleanupAfterRender(IRequestCycle cycle)
Description copied from class: AbstractComponent
Invoked by AbstractComponent.render(IMarkupWriter, IRequestCycle)after the component renders.

Overrides:
cleanupAfterRender in class AbstractComponent
See Also:
AbstractComponent.cleanupAfterRender(org.apache.tapestry.IRequestCycle)

getCanTakeFocus

protected boolean getCanTakeFocus()
Links can not take focus, ever.

Overrides:
getCanTakeFocus in class AbstractFormComponent

getRenderBodyOnRewind

protected boolean getRenderBodyOnRewind()
Returns true; the LinkSubmit's body should render during a rewind, even if the component is itself disabled.

Overrides:
getRenderBodyOnRewind in class AbstractFormComponent
Returns:
false; override this method to change.

rewindFormComponent

protected void rewindFormComponent(IMarkupWriter writer,
                                   IRequestCycle cycle)
Description copied from class: AbstractFormComponent
Invoked from AbstractFormComponent.renderComponent(IMarkupWriter, IRequestCycle) to rewind the component. If the component is disabled this will not be invoked.

Specified by:
rewindFormComponent in class AbstractFormComponent
See Also:
AbstractFormComponent.rewindFormComponent(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle)

renderSubmitBindings

protected void renderSubmitBindings(IMarkupWriter writer,
                                    IRequestCycle cycle)
Manages rendering of important submit client side bindings, like invoking the right submit type or any of the optional IDynamicInvoker parameters.

Parameters:
writer - The writer to use to write content.
cycle - The current request cycle.

getListener

public abstract IActionListener getListener()
parameter.


getAction

public abstract IActionListener getAction()
parameter.


getTag

public abstract Object getTag()
parameter.


setSelected

public abstract void setSelected(Object tag)
parameter.


getDefer

public abstract boolean getDefer()
parameter.


getParameters

public abstract Object getParameters()
parameter.


getSubmitType

public abstract String getSubmitType()
The type of submission, normal/cancel/refresh.


getUpdateComponents

public abstract List getUpdateComponents()
If set, will be used to update/refresh portions of a response during XHR requests.

For instance, if you have a page listing projects and you wanted to update an Any components contents whenever one of the project links was clicked you would use a DirectLink with the parameters:

      updateComponents="{'projectDetails'}"
      async="true"
 

Specified by:
getUpdateComponents in interface IDynamicInvoker
Returns:
The list of components to update, if any.

isAsync

public abstract boolean isAsync()
Used to specify whether or not the result of this invocation should be returned asynchronously or use normal browser page reload semantics.

Async being true means responses will be encoded as XML using XmlHttpRequests. If you would like your request/response to be in another format - like JSON - you must also specify the additional parameter IDynamicInvoker.isJson(). Without setting the IDynamicInvoker.getUpdateComponents() parameter this parameter is pretty useless.

Specified by:
isAsync in interface IDynamicInvoker
Returns:
True if invocation should be processed asynchronously.
See Also:
IDynamicInvoker.isJson()

isJson

public abstract boolean isJson()
Used to specify that the return invocation of the response created should be in the "http://json.org" format. Without setting the IDynamicInvoker.getUpdateComponents() parameter this parameter is pretty useless.

Specified by:
isJson in interface IDynamicInvoker
Returns:
True if response should be encoded using JSON semantics.
See Also:
org.apache.tapestry.IJSONRender}

getDirectService

public abstract IEngineService getDirectService()
Injected.


getListenerInvoker

public abstract ListenerInvoker getListenerInvoker()
Injected.


getSubmitScript

public abstract IScript getSubmitScript()
Injected.



Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.