Coverage Report - org.apache.tapestry.html.Body
 
Classes in this File Line Coverage Branch Coverage Complexity
Body
0%
0/15
N/A
1
 
 1  
 // Copyright 2004, 2005 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.tapestry.html;
 16  
 
 17  
 import org.apache.tapestry.AbstractComponent;
 18  
 import org.apache.tapestry.IMarkupWriter;
 19  
 import org.apache.tapestry.IRequestCycle;
 20  
 import org.apache.tapestry.services.ResponseBuilder;
 21  
 
 22  
 /**
 23  
  * The body of a Tapestry page. This is used since it allows components on the page access to an
 24  
  * initialization script (that is written the start, just inside the <body> tag). This is
 25  
  * currently used by {@link Rollover}and {@link Script}components. [ <a
 26  
  * href="../../../../../components/general/body.html">Component Reference </a>]
 27  
  * 
 28  
  * @author Howard Lewis Ship
 29  
  */
 30  
 
 31  0
 public abstract class Body extends AbstractComponent
 32  
 {
 33  
     
 34  
     protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
 35  
     {
 36  0
         IMarkupWriter nested = writer.getNestedWriter();
 37  
 
 38  0
         renderBody(nested, cycle);
 39  
         
 40  0
         getRenderWorker().renderBody(cycle, this);
 41  
         
 42  
         // This is a little tricky, if we didn't call this manually
 43  
         // now the page would never be able to have any javascript related
 44  
         // render workers actually work because the javascript output would
 45  
         // essentially be non writable
 46  
         
 47  0
         getRenderWorker().renderComponent(cycle, getPage());
 48  
         
 49  
         // Start the body tag.
 50  0
         writer.println();
 51  0
         writer.begin(getElement());
 52  
         
 53  0
         renderInformalParameters(writer, cycle);
 54  
         
 55  0
         renderIdAttribute(writer, cycle);
 56  
         
 57  0
         writer.println();
 58  
         
 59  
         // Write the page's scripting. This is included scripts
 60  
         // and dynamic JavaScript.
 61  
         
 62  0
         getBuilder().writeBodyScript(writer, cycle);
 63  
         
 64  
         // Close the nested writer, which dumps its buffered content
 65  
         // into its parent.
 66  
         
 67  0
         nested.close();
 68  
         
 69  
         // Any initialization should go at the very end of the document
 70  
         // just before the close body tag. Older version of Tapestry
 71  
         // would create a window.onload event handler, but this is better
 72  
         // (it doesn't have to wait for external images to load).
 73  
         
 74  0
         getBuilder().writeInitializationScript(writer);
 75  
         
 76  0
         writer.end(); // <body>
 77  0
     }
 78  
 
 79  
     /**
 80  
      * Parameter.
 81  
      */
 82  
     public abstract String getElement();
 83  
     
 84  
     public abstract ResponseBuilder getBuilder();
 85  
 }