001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.wicket.model;
018
019import org.apache.wicket.Component;
020
021/**
022 * This is a marker interface for models that can be inherited from components higher in the
023 * hierarchy.
024 * 
025 * If a model implements this interface then you can give the parent container this model and all
026 * the child (recursively) components will also get and then set that model on their own if they are
027 * created with a null model
028 * 
029 * <pre>
030 * Form form = new Form(&quot;form&quot;, new ModelImplementingIInheritableModel());
031 * new TextField(&quot;textfield&quot;); // notice textfield is created with a null model
032 * </pre>
033 * 
034 * @author jcompagner
035 * @author Igor Vaynberg (ivaynberg)
036 * @param <T>
037 *            The model object type
038 */
039public interface IComponentInheritedModel<T> extends IModel<T>
040{
041        /**
042         * @param <W>
043         *            the model object type of the wrapped model
044         * @param component
045         * @return The WrapModel that wraps this model
046         */
047        <W> IWrapModel<W> wrapOnInheritance(Component component);
048}