Clover coverage report - Code Coverage for tapestry release 4.0-rc-2
Coverage timestamp: Sat Dec 17 2005 09:39:46 PST
file stats: LOC: 62   Methods: 1
NCLOC: 22   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
Image.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.html;
 16   
 17    import org.apache.tapestry.AbstractComponent;
 18    import org.apache.tapestry.IAsset;
 19    import org.apache.tapestry.IMarkupWriter;
 20    import org.apache.tapestry.IRequestCycle;
 21    import org.apache.tapestry.Tapestry;
 22   
 23    /**
 24    * Used to insert an image. To create a rollover image, use the {@link Rollover} class, which
 25    * integrates a link with the image assets used with the button. [<a
 26    * href="../../../../../ComponentReference/Image.html">Component Reference</a>]
 27    *
 28    * @author Howard Lewis Ship
 29    */
 30   
 31    public abstract class Image extends AbstractComponent
 32    {
 33    /**
 34    * Renders the &lt;img&gt; element.
 35    */
 36   
 37  13 protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
 38    {
 39    // Doesn't contain a body so no need to do anything on rewind (assumes no
 40    // sideffects to accessor methods via bindings).
 41   
 42  13 if (cycle.isRewinding())
 43  1 return;
 44   
 45  12 IAsset imageAsset = getImage();
 46   
 47  12 if (imageAsset == null)
 48  1 throw Tapestry.createRequiredParameterException(this, "image");
 49   
 50  11 String imageURL = imageAsset.buildURL();
 51   
 52  11 writer.beginEmpty("img");
 53   
 54  11 writer.attribute("src", imageURL);
 55   
 56  11 renderInformalParameters(writer, cycle);
 57   
 58  11 writer.closeTag();
 59    }
 60   
 61    public abstract IAsset getImage();
 62    }