|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.behavior.Behavior
public abstract class Behavior
Behaviors are kind of plug-ins for Components. They allow functionality to be added to a component and get essential events forwarded by the component. They can be bound to a concrete component (using the bind method which is called when the behavior is attached), but they don't need to. They can modify the components markup by changing the rendered ComponentTag. Behaviors can have their own models as well, and they are notified when these are to be detached by the component.
You also cannot modify a components model with a behavior.
IBehaviorListener
,
IHeaderContributor
,
AbstractAjaxBehavior
,
AttributeModifier
,
Serialized FormConstructor Summary | |
---|---|
Behavior()
Constructor |
Method Summary | |
---|---|
void |
afterRender(Component component)
Called when a component that has this behavior coupled was rendered. |
void |
beforeRender(Component component)
Called when a component is about to render. |
void |
bind(Component component)
Bind this handler to the given component. |
boolean |
canCallListenerInterface(Component component,
Method method)
Checks whether or not a listener interface can be invoked on this behavior. |
void |
detach(Component component)
Allows the behavior to detach any state it has attached during request processing. |
boolean |
getStatelessHint(Component component)
This method returns false if the behavior generates a callback url (for example ajax behaviors) |
boolean |
isEnabled(Component component)
Called when a components is rendering and wants to render this behavior. |
boolean |
isTemporary(Component component)
Specifies whether or not this behavior is temporary. |
void |
onComponentTag(Component component,
ComponentTag tag)
Called any time a component that has this behavior registered is rendering the component tag. |
void |
onConfigure(Component component)
Called immediately after the onConfigure method in a component. |
void |
onEvent(Component component,
IEvent<?> event)
Called to notify the behavior about any events sent to the component |
void |
onException(Component component,
RuntimeException exception)
In case an unexpected exception happened anywhere between onComponentTag(org.apache.wicket.Component, org.apache.wicket.markup.ComponentTag) and afterRender(org.apache.wicket.Component), onException() will be called for any behavior. |
void |
onRemove(Component component)
Called to notify that the component is being removed from its parent |
void |
renderHead(Component component,
IHeaderResponse response)
Render to the web response whatever the component wants to contribute to the head section. |
void |
unbind(Component component)
Notifies the behavior it is removed from the specified component |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Behavior()
Method Detail |
---|
public void beforeRender(Component component)
component
- the component that has this behavior coupledpublic void afterRender(Component component)
component
- the component that has this behavior coupledpublic void bind(Component component)
component
- the component to bind topublic void unbind(Component component)
component
- the component this behavior is unbound frompublic void detach(Component component)
component
- the component that initiates the detachment of this behaviorpublic void onException(Component component, RuntimeException exception)
afterRender(Component)
, you should do the same in the implementation of this method.
component
- the component that has a reference to this behavior and during which processing
the exception occurredexception
- the unexpected exceptionpublic boolean getStatelessHint(Component component)
component
- the component that has this behavior coupled.
public boolean isEnabled(Component component)
component
- the component that has this behavior coupled
public void onComponentTag(Component component, ComponentTag tag)
component
- the component that renders this tag currentlytag
- the tag that is renderedpublic boolean isTemporary(Component component)
component
-
public boolean canCallListenerInterface(Component component, Method method)
Component.canCallListenerInterface(Method)
,
this method has the same semantics.
WARNING: Read the javadoc of Component.canCallListenerInterface(Method)
for important
security-related information.
component
- component this behavior is attached tomethod
- listener method being invoked
public void renderHead(Component component, IHeaderResponse response)
renderHead
in interface IComponentAwareHeaderContributor
component
- response
- Response objectpublic void onConfigure(Component component)
component
- the component being configuredpublic void onEvent(Component component, IEvent<?> event)
onEvent
in interface IComponentAwareEventSink
component
- component that owns this sink. For example, if the implementation of this
interface is a Behavior
then component parameter will contain the
component to which the behavior is attached.IComponentAwareEventSink.onEvent(org.apache.wicket.Component,
org.apache.wicket.event.IEvent)
public void onRemove(Component component)
component
- the removed component
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |