001    // Copyright 2004, 2005 The Apache Software Foundation
002    //
003    // Licensed under the Apache License, Version 2.0 (the "License");
004    // you may not use this file except in compliance with the License.
005    // You may obtain a copy of the License at
006    //
007    //     http://www.apache.org/licenses/LICENSE-2.0
008    //
009    // Unless required by applicable law or agreed to in writing, software
010    // distributed under the License is distributed on an "AS IS" BASIS,
011    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012    // See the License for the specific language governing permissions and
013    // limitations under the License.
014    package org.apache.tapestry.form;
015    
016    import org.apache.tapestry.IMarkupWriter;
017    import org.apache.tapestry.IRequestCycle;
018    
019    
020    /**
021     * Interface used by {@link PropertySelection} to render each option.
022     */
023    public interface IOptionRenderer
024    {
025    
026        /**
027         * Called after the initial <code>&lt;select&gt;</code> tag has been rendered. It is expected that implementations
028         * will then do whatever is necessary to render each option available in the model and defer writing the end 
029         * <code>&lt;/select&gt;</code> to the calling component.
030         * 
031         * @param writer
032         *          The markup writer to use.
033         * @param cycle
034         *          The associated cycle.
035         * @param model
036         *          Model containing values / labels / etc..
037         * @param selected
038         *          The currently selected object value, if any. Will be null if no value is currently selected.
039         */
040        void renderOptions(IMarkupWriter writer, IRequestCycle cycle, IPropertySelectionModel model, Object selected);
041    }