Home » tapestry-src-5.0.19 » org.apache.tapestry5.corelib.components » [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.corelib.components;
   16   
   17   import org.apache.tapestry5.ComponentResources;
   18   import org.apache.tapestry5.MarkupWriter;
   19   import org.apache.tapestry5.annotations.Parameter;
   20   import org.apache.tapestry5.ioc.annotations.Inject;
   21   
   22   /**
   23    * Used to output raw markup to the client. Unlike, say, an expansion, the output from OutputRaw is unfiltered, with any
   24    * special characters or entities left exactly as is. This is used in situations where the markup is provided
   25    * externally, rather than constructed within Tapestry.
   26    *
   27    * @see MarkupWriter#writeRaw(String)
   28    */
   29   public class OutputRaw
   30   {
   31       /**
   32        * The value to to render. If unbound, and a property of the container matches the component's id, then that
   33        * property will be the source of the value.
   34        */
   35       @Parameter(required = true, autoconnect = true)
   36       private String value;
   37   
   38       @Inject
   39       private ComponentResources resources;
   40   
   41       boolean beginRender(MarkupWriter writer)
   42       {
   43           if (value != null && value.length() > 0) writer.writeRaw(value);
   44   
   45           // Abort the rest of the render.
   46   
   47           return false;
   48       }
   49   
   50       // For testing:
   51   
   52       void setValue(String value)
   53       {
   54           this.value = value;
   55       }
   56   
   57   }

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