Clover coverage report - Code Coverage for tapestry release 4.0-beta-9
Coverage timestamp: Sat Oct 1 2005 08:36:20 EDT
file stats: LOC: 71   Methods: 2
NCLOC: 38   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
ObjectArrayRenderStrategy.java 100% 100% 100% 100%
coverage
 1    // Copyright 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.describe;
 16   
 17    import org.apache.tapestry.IMarkupWriter;
 18    import org.apache.tapestry.IRequestCycle;
 19   
 20    /**
 21    * Renders an object array as an unordered list; each element is recursively rendered.
 22    *
 23    * @author Howard M. Lewis Ship
 24    * @since 4.0
 25    */
 26    public class ObjectArrayRenderStrategy implements RenderStrategy
 27    {
 28    private RenderStrategy _renderStrategy;
 29   
 30  3 public void renderObject(Object object, IMarkupWriter writer, IRequestCycle cycle)
 31    {
 32  3 Object[] array = (Object[]) object;
 33   
 34  3 if (array.length == 0)
 35    {
 36  1 writer.begin("em");
 37  1 writer.print("empty list");
 38  1 writer.end();
 39  1 return;
 40    }
 41   
 42  2 writer.begin("ul");
 43   
 44  2 for (int i = 0; i < array.length; i++)
 45    {
 46  3 writer.begin("li");
 47   
 48  3 Object item = array[i];
 49   
 50  3 if (item == null)
 51    {
 52  1 writer.begin("em");
 53  1 writer.print("<NULL>");
 54  1 writer.end();
 55    }
 56    else
 57  2 _renderStrategy.renderObject(item, writer, cycle);
 58   
 59  3 writer.end();
 60   
 61    }
 62   
 63  2 writer.end();
 64    }
 65   
 66  1 public void setRenderStrategy(RenderStrategy renderStrategy)
 67    {
 68  1 _renderStrategy = renderStrategy;
 69    }
 70   
 71    }