wicket.behavior
Class AbstractBehavior

java.lang.Object
  extended by wicket.behavior.AbstractBehavior
All Implemented Interfaces:
java.io.Serializable, IBehavior
Direct Known Subclasses:
AbstractAjaxBehavior, AbstractHeaderContributor, AbstractTransformerBehavior, AttributeModifier, SimpleAttributeModifier

public abstract class AbstractBehavior
extends java.lang.Object
implements IBehavior

Adapter implementation of IBehavior. It is recommended to extend from this class instead of directly implementing IBehavior as this class has an extra clean

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

Constructor Summary
AbstractBehavior()
          Construct.
 
Method Summary
 void bind(Component component)
          Bind this handler to the given component.
 void cleanup()
          This method is called either by onRendered(Component) or onException(Component, RuntimeException) AFTER they called their respective template methods.
 void detachModel(Component component)
          Provides for the ability to detach any models this behavior has.
 void exception(Component component, java.lang.RuntimeException exception)
          In case an unexpected exception happened anywhere between onComponentTag() and rendered(), onException() will be called for any behavior.
 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, java.lang.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.
 void rendered(Component component)
          Called when a component that has this behavior coupled was rendered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractBehavior

public AbstractBehavior()
Construct.

Method Detail

bind

public void bind(Component component)
Description copied from interface: IBehavior
Bind this handler to the given component. This method is called by the host component immediately after this behavior is added to it. This method is useful if you need to do initialization based on the component it is attached can you can't wait to do it at render time. Keep in mind that if you decide to keep a reference to the host component, it is not thread safe anymore, and should thus only be used in situations where you do not reuse the behavior for multiple components.

Specified by:
bind in interface IBehavior
Parameters:
component - the component to bind to
See Also:
IBehavior.bind(wicket.Component)

detachModel

public void detachModel(Component component)
Description copied from interface: IBehavior
Provides for the ability to detach any models this behavior has. This method is called by the components which have this behavior attached to them when they are detaching their models themselves (ie after rendering). Note that if you share a behavior between components, this method is called multiple times. YOU MUST CALL SUPER WHEN IMPLEMENTING THIS METHOD

Specified by:
detachModel in interface IBehavior
Parameters:
component - the component that initiates the detachement of this behavior
See Also:
IBehavior.detachModel(Component)

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
Parameters:
component - the component that renders this tag currently
tag - the tag that is rendered
See Also:
IBehavior.onComponentTag(wicket.Component, wicket.markup.ComponentTag)

rendered

public final void rendered(Component component)
Description copied from interface: IBehavior
Called when a component that has this behavior coupled was rendered.

Specified by:
rendered in interface IBehavior
Parameters:
component - the component that has this behavior coupled
See Also:
IBehavior.rendered(wicket.Component)

onRendered

public void onRendered(Component component)
Called when a component that has this behavior coupled was rendered.

Parameters:
component - the component that has this behavior coupled

exception

public void exception(Component component,
                      java.lang.RuntimeException exception)
Description copied from interface: IBehavior
In case an unexpected exception happened anywhere between onComponentTag() and rendered(), onException() will be called for any behavior. Typically, if you clean up resources in IBehavior.rendered(Component), you should do the same in the implementation of this method.

Specified by:
exception in interface IBehavior
Parameters:
component - the component that has a reference to this behavior and during which processing the exception occured
exception - the unexpected exception
See Also:
IBehavior.exception(wicket.Component, java.lang.RuntimeException)

onException

public void onException(Component component,
                        java.lang.RuntimeException exception)
In case an unexpected exception happened anywhere between onComponentTag() and rendered(), onException() will be called for any behavior.

Parameters:
component - the component that has a reference to this behavior and during which processing the exception occured
exception - the unexpected exception

cleanup

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



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