org.apache.wicket.markup.transformer
Class AbstractTransformerBehavior

java.lang.Object
  extended by org.apache.wicket.behavior.AbstractBehavior
      extended by org.apache.wicket.markup.transformer.AbstractTransformerBehavior
All Implemented Interfaces:
Serializable, IBehavior, IComponentConfigurationBehavior, IClusterable, IHeaderContributor, ITransformer
Direct Known Subclasses:
XsltTransformerBehavior

public abstract class AbstractTransformerBehavior
extends AbstractBehavior
implements ITransformer

A IBehavior which can be added to any component. It allows to post-process (transform) the markup generated by the component.

Author:
Juergen Donnerstag
See Also:
AbstractOutputTransformerContainer, Serialized Form

Constructor Summary
AbstractTransformerBehavior()
          Construct.
 
Method Summary
 void beforeRender(Component component)
          Called when a component is about to render.
 void cleanup()
          This method is called either by AbstractBehavior.onRendered(Component) or AbstractBehavior.onException(Component, RuntimeException) AFTER they called their respective template methods.
protected  Response newResponse()
          Create a new response object which is used to store the markup generated by the child objects.
 void onComponentTag(Component component, ComponentTag tag)
          Called any time a component that has this behavior registered is rendering the component tag.
 void onException(Component component, RuntimeException exception)
          In case an unexpected exception happened anywhere between onComponentTag() and rendered(), onException() will be called for any behavior.
 void onRendered(Component component)
          Called when a component that has this behavior coupled was rendered.
abstract  CharSequence transform(Component component, CharSequence output)
          Will be invoked after all child components have been processed to allow for transforming the markup generated.
 
Methods inherited from class org.apache.wicket.behavior.AbstractBehavior
afterRender, bind, detach, detachModel, exception, getStatelessHint, isEnabled, isTemporary, onConfigure, rendered, renderHead
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractTransformerBehavior

public AbstractTransformerBehavior()
Construct.

Method Detail

newResponse

protected Response newResponse()
Create a new response object which is used to store the markup generated by the child objects.

Returns:
Response object. Must not be null

onComponentTag

public 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)

beforeRender

public void beforeRender(Component component)
Description copied from interface: IBehavior
Called when a component is about to render.

Specified by:
beforeRender in interface IBehavior
Overrides:
beforeRender in class AbstractBehavior
Parameters:
component - the component that has this behavior coupled
See Also:
AbstractBehavior.beforeRender(org.apache.wicket.Component)

onRendered

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

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

cleanup

public void cleanup()
Description copied from class: AbstractBehavior
This method is called either by AbstractBehavior.onRendered(Component) or AbstractBehavior.onException(Component, RuntimeException) AFTER they called their respective template methods. Override this template method to do any necessary cleanup.

Overrides:
cleanup in class AbstractBehavior
See Also:
AbstractBehavior.cleanup()

onException

public void onException(Component component,
                        RuntimeException exception)
Description copied from class: AbstractBehavior
In case an unexpected exception happened anywhere between onComponentTag() and rendered(), onException() will be called for any behavior.

Overrides:
onException in class AbstractBehavior
Parameters:
component - the component that has a reference to this behavior and during which processing the exception occurred
exception - the unexpected exception
See Also:
AbstractBehavior.onException(org.apache.wicket.Component, java.lang.RuntimeException)

transform

public abstract CharSequence transform(Component component,
                                       CharSequence output)
                                throws Exception
Description copied from interface: ITransformer
Will be invoked after all child components have been processed to allow for transforming the markup generated.

Specified by:
transform in interface ITransformer
Parameters:
component - The associated Wicket component
output - The markup generated by the child components
Returns:
The output which will be appended to the original response
Throws:
Exception
See Also:
ITransformer.transform(org.apache.wicket.Component, CharSequence)


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