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