Clover coverage report - Code Coverage for tapestry release 4.0-beta-2
Coverage timestamp: Sat Jul 9 2005 22:02:17 EDT
file stats: LOC: 65   Methods: 1
NCLOC: 15   Classes: 1
30 day Evaluation License registered to hlship@comcast.net Your 30 day evaluation period has expired. Please visit http://www.cenqua.com to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
RenderBlock.java 100% 100% 100% 100%
coverage
 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.components;
 16   
 17    import org.apache.tapestry.AbstractComponent;
 18    import org.apache.tapestry.IComponent;
 19    import org.apache.tapestry.IMarkupWriter;
 20    import org.apache.tapestry.IRequestCycle;
 21   
 22    /**
 23    * Renders the text and components wrapped by a {@link Block}component. [ <a
 24    * href="../../../../../ComponentReference/RenderBlock.html">Component Reference </a>]
 25    * <p>
 26    * It is possible for an RenderBlock to obtain a Block from a page <em>other than</em> the render
 27    * page. This works, even when the Block contains links, forms and form components. The action and
 28    * direct services will create URLs that properly address this situation.
 29    * <p>
 30    * However, because the rendering page can't know ahead of time about these foreign Blocks,
 31    * {@link org.apache.tapestry.event.PageBeginRenderListener} and
 32    * {@link org.apache.tapestry.event.PageEndRenderListener} methods (for components and objects of the
 33    * foreign page) via RenderBlock will <em>not</em> be executed. This specifically affects the
 34    * methods of the {@link org.apache.tapestry.event.PageBeginRenderListener} and
 35    * {@link org.apache.tapestry.event.PageEndRenderListener} interfaces.
 36    * <p>
 37    * Before rendering its {@link Block}, RenderBlock will set itself as the Block's inserter, and
 38    * will reset the inserter after the {@link Block}is rendered. This gives the components contained
 39    * in the {@link Block}access to its inserted environment via the RenderBlock. In particular this
 40    * allows the contained components to access the informal parameters of the RenderBlock which
 41    * effectively allows parameters to be passed to the components contained in a Block.
 42    *
 43    * @author Howard Lewis Ship
 44    */
 45   
 46    public abstract class RenderBlock extends AbstractComponent
 47    {
 48    /**
 49    * If block is not null, then
 50    * {@link Block#renderForComponent(IMarkupWriter, IRequestCycle, IComponent)} is invoked.
 51    */
 52   
 53  2 protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
 54    {
 55  2 Block block = getBlock();
 56   
 57  2 if (block == null)
 58  1 return;
 59   
 60  1 block.renderForComponent(writer, cycle, this);
 61    }
 62   
 63    public abstract Block getBlock();
 64   
 65    }