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.model;
 
A simple compound model which uses the component's name as the property expression to retrieve properties on the nested model object. CompoundPropertyModel is a chaining model so it will call get/setobject on the given object if the object is an instanceof IModel itself.

Author(s):
Jonathan Locke
See also:
IModel
Model
LoadableDetachableModel
IChainingModel
 
 {
 	private static final long serialVersionUID = 1L;
 
 	private Object target;

Constructor

Parameters:
object The model object, which may or may not implement IModel
 
 	public CompoundPropertyModel(final Object object)
 	{
 		 = object;
 	}

 
 	public Object getObject()
 	{
 		if ( instanceof IModel)
 		{
 			return ((IModel)).getObject();
 		}
 		return ;
 	}

 
 	public void setObject(Object object)
 	{
 		if ( instanceof IModel)
 		{
 			((IModel)).setObject(object);
 		}
 		else
 		{
 			 = object;
 		}
 	}

 
 	{
 		if ( instanceof IModel)
 		{
 			return (IModel);
 		}
 		return null;
 	}

 
 	public void setChainedModel(IModel model)
 	{
 		 = model;
 	}

	public void detach()
	{
		if ( instanceof IDetachable)
		{
		}
	}

Returns the property expression that should be used against the target object

Parameters:
component
Returns:
property expression that should be used against the target object
	protected String propertyExpression(Component component)
	{
		return component.getId();
	}

	{
		return new AttachedCompoundPropertyModel(component);
	}

Binds this model to a special property by returning a model that has this compound model as its nested/wrapped model and the property which should be evaluated. This can be used if the id of the Component isn't a valid property for the data object.

Parameters:
property
Returns:
The IModel that is a wrapper around the current model and the property
	public IModel bind(String property)
	{
		return new PropertyModel(thisproperty);
	}

Component aware variation of the CompoundPropertyModel that components that inherit the model get

Author(s):
ivaynberg
	private class AttachedCompoundPropertyModel extends AbstractPropertyModel implements IWrapModel
	{
		private static final long serialVersionUID = 1L;
		private final Component owner;

Constructor

Parameters:
owner component that this model has been attached to
		{
			this. = owner;
		}

		{
		}

		{
		}

		public void detach()
		{
			super.detach();
		}
	}

	public String toString()
	{
		AppendingStringBuffer sb = new AppendingStringBuffer().append("Model:classname=[" +
				getClass().getName() + "]");
		sb.append(":nestedModel=[").append().append("]");
		return sb.toString();
	}
	// TODO These methods are for helping people upgrade. Remove after
	// deprecation release.

Deprecated:
replace by IModel.getObject().
Parameters:
component
Returns:
	public final Object getObject(Component component)
	{
	}

Deprecated:
replace by IModel.setObject(java.lang.Object).
Parameters:
component
object
	public final void setObject(Component componentObject object)
	{
	}
New to GrepCode? Check out our FAQ X