org.apache.wicket.behavior
Class AbstractAjaxBehavior

java.lang.Object
  extended by org.apache.wicket.behavior.AbstractBehavior
      extended by org.apache.wicket.behavior.AbstractAjaxBehavior
All Implemented Interfaces:
java.io.Serializable, IBehavior, IBehaviorListener, IClusterable, IRequestListener, IHeaderContributor
Direct Known Subclasses:
AbstractDefaultAjaxBehavior

public abstract class AbstractAjaxBehavior
extends AbstractBehavior
implements IBehaviorListener, IHeaderContributor

Abstract class for handling Ajax roundtrips. This class serves as a base for javascript specific implementations, like ones based on Dojo or Scriptaculous, or Wicket's default.

Author:
Eelco Hillenius, Ralf Ebert, Igor Vaynberg
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.apache.wicket.behavior.IBehaviorListener
INTERFACE
 
Constructor Summary
AbstractAjaxBehavior()
          Construct.
 
Method Summary
 void bind(Component hostComponent)
          Bind this handler to the given component.
 java.lang.CharSequence getCallbackUrl()
          Gets the url that references this handler.
 java.lang.CharSequence getCallbackUrl(boolean onlyTargetActivePage)
          Gets the url that references this handler.
protected  Component getComponent()
          Gets the component that this handler is bound to.
protected  java.lang.String getImplementationId()
           
 boolean getStatelessHint(Component component)
          This method returns false if the behavior generates a callback url (for example ajax behaviors)
protected  void onBind()
          Called when the component was bound to it's host component.
protected  void onComponentRendered()
          Called to indicate that the component that has this handler registered has been rendered.
 void onComponentTag(Component component, ComponentTag tag)
          Called any time a component that has this behavior registered is rendering the component tag.
protected  void onComponentTag(ComponentTag tag)
          Called any time a component that has this handler registered is rendering the component tag.
 void onRendered(Component hostComponent)
          Called when a component that has this behavior coupled was rendered.
protected  void onRenderHeadContribution(Response response)
           
protected  void onRenderHeadInitContribution(Response response)
           
 void renderHead(IHeaderResponse response)
          Render to the web response whatever the component wants to contribute to the head section.
 
Methods inherited from class org.apache.wicket.behavior.AbstractBehavior
afterRender, beforeRender, cleanup, detach, detachModel, exception, isEnabled, isTemporary, onException, rendered
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.wicket.behavior.IBehaviorListener
onRequest
 

Constructor Detail

AbstractAjaxBehavior

public AbstractAjaxBehavior()
Construct.

Method Detail

bind

public final void bind(Component hostComponent)
Bind this handler to the given component.

Specified by:
bind in interface IBehavior
Overrides:
bind in class AbstractBehavior
Parameters:
hostComponent - the component to bind to
See Also:
IBehavior.bind(org.apache.wicket.Component)

getCallbackUrl

public java.lang.CharSequence getCallbackUrl()
Gets the url that references this handler.

Returns:
the url that references this handler

getCallbackUrl

public java.lang.CharSequence getCallbackUrl(boolean onlyTargetActivePage)
Gets the url that references this handler.

Parameters:
onlyTargetActivePage - if true the callback to this behavior will be ignore if the page is not the last one the user accessed
Returns:
the url that references this handler

onComponentTag

public final void onComponentTag(Component component,
                                 ComponentTag tag)
Description copied from interface: IBehavior
Called any time a component that has this behavior registered is rendering the component tag.

Specified by:
onComponentTag in interface IBehavior
Overrides:
onComponentTag in class AbstractBehavior
Parameters:
component - the component that renders this tag currently
tag - the tag that is rendered
See Also:
IBehavior.onComponentTag(org.apache.wicket.Component, org.apache.wicket.markup.ComponentTag)

onRendered

public final void onRendered(Component hostComponent)
Description copied from class: AbstractBehavior
Called when a component that has this behavior coupled was rendered.

Overrides:
onRendered in class AbstractBehavior
Parameters:
hostComponent - the component that has this behavior coupled
See Also:
AbstractBehavior.onRendered(org.apache.wicket.Component)

renderHead

public void renderHead(IHeaderResponse response)
Description copied from interface: IHeaderContributor
Render to the web response whatever the component wants to contribute to the head section. TODO: Post 1.3, add component parameter, so that the behaviors dont' have to track component instances

Specified by:
renderHead in interface IHeaderContributor
Overrides:
renderHead in class AbstractBehavior
Parameters:
response - Response object
See Also:
IHeaderContributor.renderHead(IHeaderResponse)

getComponent

protected final Component getComponent()
Gets the component that this handler is bound to.

Returns:
the component that this handler is bound to

onComponentTag

protected void onComponentTag(ComponentTag tag)
Called any time a component that has this handler registered is rendering the component tag. Use this method e.g. to bind to javascript event handlers of the tag

Parameters:
tag - the tag that is rendered

onBind

protected void onBind()
Called when the component was bound to it's host component. You can get the bound host component by calling getComponent.


onComponentRendered

protected void onComponentRendered()
Called to indicate that the component that has this handler registered has been rendered. Use this method to do any cleaning up of temporary state


getStatelessHint

public boolean getStatelessHint(Component component)
Description copied from interface: IBehavior
This method returns false if the behavior generates a callback url (for example ajax behaviors)

Specified by:
getStatelessHint in interface IBehavior
Overrides:
getStatelessHint in class AbstractBehavior
Parameters:
component - the component that has this behavior coupled.
Returns:
boolean true or false.
See Also:
AbstractBehavior.getStatelessHint(Component)

getImplementationId

protected final java.lang.String getImplementationId()

onRenderHeadContribution

protected final void onRenderHeadContribution(Response response)

onRenderHeadInitContribution

protected final void onRenderHeadInitContribution(Response response)


Copyright © 2004-2010 Apache Software Foundation. All Rights Reserved.