Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Licensed to the Apache Software Foundation (ASF) under one or more
   * contributor license agreements.  See the NOTICE file distributed with
   * this work for additional information regarding copyright ownership.
   * The ASF licenses this file to You under the Apache License, Version 2.0
   * (the "License"); you may not use this file except in compliance with
   * the License.  You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 package org.apache.wicket.behavior;
 
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(s):
Ralf Ebert
Eelco Hillenius
 
 public abstract class AbstractBehavior implements IBehaviorIHeaderContributor
 {
 
 	private static final long serialVersionUID = 1L;

Construct.
 
 	public AbstractBehavior()
 	{
 	}

 
 	public void beforeRender(Component component)
 	{
 	}

 
 	public void bind(final Component component)
 	{
 	}

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

 
 	public void detach(Component component)
 	{
 
 	}

 
 	public final void exception(Component componentRuntimeException exception)
 	{
 		try
 		{
 			onException(componentexception);
 		}
 		finally
 		{
 			cleanup();
 		}
 	}

 
 	public boolean getStatelessHint(Component component)
 	{
 		return true;
 	}

	public void onComponentTag(final Component componentfinal ComponentTag tag)
	{
	}

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 occurred
exception the unexpected exception
	public void onException(Component componentRuntimeException exception)
	{
	}

Called when a component that has this behavior coupled was rendered.

Parameters:
component the component that has this behavior coupled
	public void onRendered(Component component)
	{
	}

	public final void afterRender(final Component component)
	{
		try
		{
			onRendered(component);
		}
		finally
		{
		}
	}

	public void renderHead(IHeaderResponse response)
	{
	}

	public boolean isEnabled(Component component)
	{
		return true;
	}

	public boolean isTemporary()
	{
		return false;
	}
	// TODO remove these methods after compatibility release

Deprecated:
replaced by detach(org.apache.wicket.Component)
Parameters:
component
	public final void detachModel(Component component)
	{
	}

Deprecated:
replaced by afterRender(org.apache.wicket.Component)
Parameters:
component
	public final void rendered(Component component)
	{
	}
New to GrepCode? Check out our FAQ X