001    // Copyright 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    
015    package org.apache.tapestry.form;
016    
017    import org.apache.tapestry.FormBehavior;
018    import org.apache.tapestry.IRender;
019    import org.apache.tapestry.engine.ILink;
020    
021    /**
022     * Interface for a utility object that encapsulates the majority of the
023     * {@link org.apache.tapestry.form.Form}'s behavior.
024     * 
025     * @author Howard M. Lewis Ship
026     * @since 4.0
027     */
028    public interface FormSupport extends FormBehavior
029    {
030    
031        /**
032         * Invoked when the form is rendering. This should only be invoked by the {@link Form}
033         * component.
034         * 
035         * @param method
036         *            the HTTP method ("get" or "post")
037         * @param informalParametersRenderer
038         *            object that will render informal parameters
039         * @param link
040         *            The link to which the form will submit (encapsulating the URL and the query
041         *            parameters)
042         */
043        public void render(String method, IRender informalParametersRenderer, ILink link);
044    
045        /**
046         * Invoked to rewind the form, which renders the body of the form, allowing form element
047         * components to pull data from the request and update page properties. This should only be
048         * invoked by the {@link Form} component.
049         * 
050         * @return a code indicating why the form was submitted: {@link FormConstants#SUBMIT_NORMAL},
051         *         {@link FormConstants#SUBMIT_CANCEL} or {@link FormConstants#SUBMIT_REFRESH}.
052         */
053        public String rewind();
054    }