com.nordija.tapestry.bayeux.link
Class ClickOnce

java.lang.Object
  extended by org.apache.hivemind.impl.BaseLocatable
      extended by org.apache.tapestry.AbstractComponent
          extended by org.apache.tapestry.BaseComponent
              extended by com.nordija.tapestry.bayeux.link.ClickOnce
All Implemented Interfaces:
org.apache.hivemind.Locatable, org.apache.hivemind.LocationHolder, org.apache.tapestry.IComponent, org.apache.tapestry.IDirectEvent, org.apache.tapestry.IRender, org.apache.tapestry.ITemplateComponent

public abstract class ClickOnce
extends org.apache.tapestry.BaseComponent

A base component used to render a LinkSubmit, DirectLink or ActionLink with a javascript onClick event handler that secures that the rendered component cannot be activated more than once.

The component takes care of any user defined onClick eventhandler and secures that it is executed upon a user click.

Note The component uses javascript statehandling to prevent more than one click, so be careful if you uses this component together with the AJAX technology.

Since:
1.3.0
Version:
$Id: ClickOnce.java 93 2007-05-19 09:21:20Z jeyben $
Author:
Jacob von Eyben www.nordija.com

Field Summary
static java.lang.String DEFAULT_FUNCTION_NAME
           
static java.lang.String SUBMITFLAG
           
 
Constructor Summary
ClickOnce()
           
 
Method Summary
protected static java.lang.String extractOnclick(java.lang.String onclick)
          Finds the onClick function call defined by the user.
abstract  boolean getDisabled()
           
abstract  java.lang.String getFunctionName()
           
abstract  java.lang.String getIdParameter()
           
abstract  java.lang.String getNestedFunctionCall()
           
abstract  java.lang.String getOnclick()
           
 java.util.Map getScriptSymbols()
           
protected  void renderComponent(org.apache.tapestry.IMarkupWriter writer, org.apache.tapestry.IRequestCycle cycle)
           
abstract  void setFunctionName(java.lang.String name)
           
abstract  void setIdParameter(java.lang.String value)
           
abstract  void setNestedFunctionCall(java.lang.String nestedFunctionCall)
           
 
Methods inherited from class org.apache.tapestry.BaseComponent
addOuter, finishLoad
 
Methods inherited from class org.apache.tapestry.AbstractComponent
addAsset, addBody, addComponent, checkActiveLock, cleanupAfterRender, enterActiveState, equals, finishLoad, generateClientId, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getBody, getBodyCount, getBoundId, getClientId, getComponent, getComponents, getContainedComponent, getContainer, getEventInvoker, getExtendedId, getId, getIdPath, getListeners, getMessages, getNamespace, getPage, getRenderWorker, getSpecification, getSpecifiedId, getTemplateTagName, hashCode, isInActiveState, isParameterBound, isRendering, isStateful, pageEndRender, peekClientId, prepareForRender, render, renderBody, renderIdAttribute, renderInformalParameters, setBinding, setClientId, setContainedComponent, setContainer, 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.IComponent
addAsset, addBody, addComponent, enterActiveState, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getClientId, getComponent, getComponents, getContainedComponent, getContainer, getEventInvoker, getExtendedId, getId, getIdPath, getListeners, getMessages, getNamespace, getPage, getSpecification, getSpecifiedId, getTemplateTagName, isRendering, peekClientId, 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

DEFAULT_FUNCTION_NAME

public static final java.lang.String DEFAULT_FUNCTION_NAME
See Also:
Constant Field Values

SUBMITFLAG

public static final java.lang.String SUBMITFLAG
See Also:
Constant Field Values
Constructor Detail

ClickOnce

public ClickOnce()
Method Detail

getOnclick

public abstract java.lang.String getOnclick()

getDisabled

public abstract boolean getDisabled()

setFunctionName

public abstract void setFunctionName(java.lang.String name)

getFunctionName

public abstract java.lang.String getFunctionName()

setNestedFunctionCall

public abstract void setNestedFunctionCall(java.lang.String nestedFunctionCall)

getNestedFunctionCall

public abstract java.lang.String getNestedFunctionCall()

setIdParameter

public abstract void setIdParameter(java.lang.String value)

getIdParameter

public abstract java.lang.String getIdParameter()

renderComponent

protected void renderComponent(org.apache.tapestry.IMarkupWriter writer,
                               org.apache.tapestry.IRequestCycle cycle)
Overrides:
renderComponent in class org.apache.tapestry.BaseComponent

getScriptSymbols

public java.util.Map getScriptSymbols()

extractOnclick

protected static java.lang.String extractOnclick(java.lang.String onclick)
Finds the onClick function call defined by the user. If the function begins with 'return' this is removed

Parameters:
onclick - the javascript code to execute
Returns:
if onClick is null or empty, null is returned, otherwise a string


Copyright © 2004-2007 Nordija A/S. All Rights Reserved.