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
015package org.apache.tapestry.contrib.form;
016
017import org.apache.tapestry.IMarkupWriter;
018import org.apache.tapestry.IRequestCycle;
019import org.apache.tapestry.form.IPropertySelectionModel;
020
021/**
022 *  Defines an object that works with a {@link MultiplePropertySelection} component
023 *  to render the individual elements obtained from the {@link IPropertySelectionModel model}.
024 *
025 *  @author Sanjay Munjal
026 *
027 **/
028
029public interface IMultiplePropertySelectionRenderer
030{
031    /**
032     *  Begins the rendering of the {@link MultiplePropertySelection}.
033     *
034     **/
035
036    public void beginRender(
037        MultiplePropertySelection component,
038        IMarkupWriter writer,
039        IRequestCycle cycle);
040
041    /**
042     *  Invoked for each element obtained from the {@link IPropertySelectionModel model}.
043     *
044     **/
045
046    public void renderOption(
047        MultiplePropertySelection component,
048        IMarkupWriter writer,
049        IRequestCycle cycle,
050        IPropertySelectionModel model,
051        Object option,
052        int index,
053        boolean selected);
054
055    /**
056     *  Ends the rendering of the {@link MultiplePropertySelection}.
057     *
058     **/
059
060    public void endRender(
061        MultiplePropertySelection component,
062        IMarkupWriter writer,
063        IRequestCycle cycle);
064}