Home » tapestry-src-5.0.19 » org.apache.tapestry5.corelib.mixins » [javadoc | source]

    1   // Copyright 2006, 2007 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.corelib.mixins;
   16   
   17   import org.apache.tapestry5.ComponentResources;
   18   import org.apache.tapestry5.MarkupWriter;
   19   import org.apache.tapestry5.annotations;
   20   import org.apache.tapestry5.ioc.annotations.Inject;
   21   
   22   /**
   23    * Used to render out all informal parameters, at the end of the {@link org.apache.tapestry5.annotations.BeginRender}
   24    * phase.
   25    * <p/>
   26    * This mixin can be used with components that render a single tag inside the {@link BeginRender} phase. RenderInformals
   27    * will activate during the PostBeginRender phase to write additional attributes, from the informal parameters, into the
   28    * active element.
   29    * <p/>
   30    * If you want this behavior, but need to render more than a single tag, then implement render phase methods for the
   31    * {@link BeforeRenderTemplate} and {@link AfterRenderTemplate} phases. Use those phases to write the additional
   32    * elements and close them.
   33    * <p/>
   34    * This is often used as a base class, for cases where a component doesn't have other mixins.
   35    */
   36   @MixinAfter
   37   @SupportsInformalParameters
   38   public class RenderInformals
   39   {
   40       @Inject
   41       private ComponentResources resources;
   42   
   43       void beginRender(MarkupWriter writer)
   44       {
   45           resources.renderInformalParameters(writer);
   46       }
   47   }

Home » tapestry-src-5.0.19 » org.apache.tapestry5.corelib.mixins » [javadoc | source]