Save This Page
Home » tapestry-src-5.0.19 » org.apache.tapestry5 » [javadoc | source]
    1   // Copyright 2007, 2008 The Apache Software Foundation
    2   //
    3   // Licensed under the Apache License, Version 2.0 (the "License");
    4   // you may not use this file except in compliance with the License.
    5   // You may obtain a copy of the License at
    6   //
    7   //     http://www.apache.org/licenses/LICENSE-2.0
    8   //
    9   // Unless required by applicable law or agreed to in writing, software
   10   // distributed under the License is distributed on an "AS IS" BASIS,
   11   // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   12   // See the License for the specific language governing permissions and
   13   // limitations under the License.
   14   
   15   package org.apache.tapestry5;
   16   
   17   import org.apache.tapestry5.dom.Element;
   18   
   19   /**
   20    * An object responsible for performing decorations around fields and field labels. The decorator is notified at
   21    * intervals by the fields and labels.
   22    * <p/>
   23    * In most western languages (written left to right) the label will render before the field, so the properties of the
   24    * Field may not be set yet (or may reflect a previous looping's rendering). It may be necessary to {@linkplain
   25    * org.apache.tapestry5.services.Heartbeat#defer(Runnable)} defer any rendering} until after the Label and the Field have
   26    * both had their change to initialize and render.
   27    */
   28   public interface ValidationDecorator
   29   {
   30       /**
   31        * Invoked by a {@link org.apache.tapestry5.corelib.components.Label} before rendering itself.
   32        *
   33        * @param field for this label
   34        */
   35       void beforeLabel(Field field);
   36   
   37       /**
   38        * Invoked after the label has rendered its tag, but before it has rendered content inside the tag, to allow the
   39        * decorator to write additional attributes.
   40        *
   41        * @param field        the field corresponding to the label
   42        * @param labelElement the element for this label
   43        */
   44       void insideLabel(Field field, Element labelElement);
   45   
   46   
   47       /**
   48        * Invoked by {@link org.apache.tapestry5.corelib.components.Label} after rendering itself.
   49        *
   50        * @param field
   51        */
   52       void afterLabel(Field field);
   53   
   54       /**
   55        * Renders immediately before the field itself. The field will typically render a single element, though a complex
   56        * field may render multiple elements or even some JavaScript.
   57        *
   58        * @param field
   59        */
   60       void beforeField(Field field);
   61   
   62       /**
   63        * Invoked at a point where the decorator may write additional attributes into the field. Generally speaking, you
   64        * will want to {@linkplain ComponentResources#renderInformalParameters(MarkupWriter) render informal parameters}
   65        * <strong>before</strong> invoking this method.
   66        *
   67        * @param field
   68        */
   69       void insideField(Field field);
   70   
   71       /**
   72        * Invoked after the field has completed rendering itself.
   73        */
   74       void afterField(Field field);
   75   }

Save This Page
Home » tapestry-src-5.0.19 » org.apache.tapestry5 » [javadoc | source]