Clover coverage report - Code Coverage for tapestry release 4.0.2
Coverage timestamp: Thu Apr 13 2006 10:52:06 EDT
file stats: LOC: 92   Methods: 3
NCLOC: 41   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
SelectPropertySelectionRenderer.java 0% 0% 0% 0%
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.form;
 16   
 17    import org.apache.tapestry.IMarkupWriter;
 18    import org.apache.tapestry.IRequestCycle;
 19   
 20    /**
 21    * Implementation of {@link IPropertySelectionRenderer} that
 22    * produces a <select> element (containing <option> elements).
 23    *
 24    * @author Howard Lewis Ship
 25    *
 26    **/
 27   
 28    public class SelectPropertySelectionRenderer
 29    implements IPropertySelectionRenderer
 30    {
 31    /**
 32    * Writes the <select> element. If the
 33    * {@link PropertySelection} is {@link PropertySelection#isDisabled() disabled}
 34    * then a <code>disabled</code> attribute is written into the tag
 35    * (though Navigator 4 will ignore this).
 36    *
 37    **/
 38   
 39  0 public void beginRender(
 40    PropertySelection component,
 41    IMarkupWriter writer,
 42    IRequestCycle cycle)
 43    {
 44  0 writer.begin("select");
 45  0 writer.attribute("name", component.getName());
 46   
 47  0 if (component.isDisabled())
 48  0 writer.attribute("disabled", "disabled");
 49   
 50  0 writer.println();
 51    }
 52   
 53    /**
 54    * Closes the &lt;select&gt; element.
 55    *
 56    **/
 57   
 58  0 public void endRender(
 59    PropertySelection component,
 60    IMarkupWriter writer,
 61    IRequestCycle cycle)
 62    {
 63  0 writer.end(); // <select>
 64    }
 65   
 66    /**
 67    * Writes an &lt;option&gt; element.
 68    *
 69    **/
 70   
 71  0 public void renderOption(
 72    PropertySelection component,
 73    IMarkupWriter writer,
 74    IRequestCycle cycle,
 75    IPropertySelectionModel model,
 76    Object option,
 77    int index,
 78    boolean selected)
 79    {
 80  0 writer.beginEmpty("option");
 81  0 writer.attribute("value", model.getValue(index));
 82   
 83  0 if (selected)
 84  0 writer.attribute("selected", "selected");
 85   
 86  0 writer.print(model.getLabel(index));
 87   
 88  0 writer.end();
 89   
 90  0 writer.println();
 91    }
 92    }