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;
 
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(s):
Eelco Hillenius
Ralf Ebert
Igor Vaynberg
 
 public abstract class AbstractAjaxBehavior extends AbstractBehavior
 	implements
 {
 
 	private static final long serialVersionUID = 1L;
the component that this handler is bound to.
 
 	private Component component;

Construct.
 
 	{
 	}

Bind this handler to the given component.

Parameters:
hostComponent the component to bind to
 
 	public final void bind(final Component hostComponent)
 	{
 		if (hostComponent == null)
 		{
 			throw new IllegalArgumentException("Argument hostComponent must be not null");
 		}
 
 		if ( != null)
 		{
 			throw new IllegalStateException("this kind of handler cannot be attached to " +
 				"multiple components; it is already attached to component " +  +
 				", but component " + hostComponent + " wants to be attached too");
 
 		}
 
 		 = hostComponent;
 
 		// call the callback
 		onBind();
 	}

Gets the url that references this handler.

Returns:
the url that references this handler
 
 	/*
 	 * TODO 1.4 remove this and only keep the (boolean) variant. its a huge mess to have both
 	 * because both need to be overridable and you never know which one an intermediary subclass
 	 * overrides to add its behavior, or all subclasses must be made to override both :|
 	 */
 	{
 		return getCallbackUrl(true);
 	}

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
	public CharSequence getCallbackUrl(final boolean onlyTargetActivePage)
	{
		if (getComponent() == null)
		{
				"Behavior must be bound to a component to create the URL");
		}
		if (onlyTargetActivePage)
		{
		}
		else
		{
		}
		return getComponent().urlFor(thisrli);
	}

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

	public final void onRendered(final Component hostComponent)
	{
	}

	public void renderHead(final IHeaderResponse response)
	{
	}

Gets the component that this handler is bound to.

Returns:
the component that this handler is bound to
	protected final Component getComponent()
	{
		return ;
	}

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
	protected void onComponentTag(final ComponentTag tag)
	{
	}

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

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
	protected void onComponentRendered()
	{
	}

	public boolean getStatelessHint(Component component)
	{
		return false;
	}
	// TODO the next three methods will be removed with next commit. Here as
	// final to help with refactoring
	protected final String getImplementationId()
	{
		return "foo";
	}
	protected final void onRenderHeadContribution(final Response response)
	{
	}
	protected final void onRenderHeadInitContribution(final Response response)
	{
	}
New to GrepCode? Check out our FAQ X