Clover coverage report - Code Coverage for tapestry-contrib release 4.0-beta-12
Coverage timestamp: Sun Oct 30 2005 16:28:27 EST
file stats: LOC: 102   Methods: 3
NCLOC: 51   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
CheckBoxMultiplePropertySelectionRenderer.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.contrib.form;
 16   
 17    import org.apache.tapestry.IMarkupWriter;
 18    import org.apache.tapestry.IRequestCycle;
 19    import org.apache.tapestry.form.IPropertySelectionModel;
 20   
 21    /**
 22    * Implementation of {@link IMultiplePropertySelectionRenderer} that
 23    * produces a table of checkbox (<input type=checkbox>) elements.
 24    *
 25    * @author Sanjay Munjal
 26    *
 27    */
 28   
 29    public class CheckBoxMultiplePropertySelectionRenderer
 30    implements IMultiplePropertySelectionRenderer
 31    {
 32   
 33    /**
 34    * Writes the <table> element.
 35    *
 36    **/
 37   
 38  0 public void beginRender(
 39    MultiplePropertySelection component,
 40    IMarkupWriter writer,
 41    IRequestCycle cycle)
 42    {
 43  0 writer.begin("table");
 44  0 writer.attribute("border", 0);
 45  0 writer.attribute("cellpadding", 0);
 46  0 writer.attribute("cellspacing", 2);
 47    }
 48   
 49    /**
 50    * Closes the <table> element.
 51    *
 52    **/
 53   
 54  0 public void endRender(
 55    MultiplePropertySelection component,
 56    IMarkupWriter writer,
 57    IRequestCycle cycle)
 58    {
 59  0 writer.end(); // <table>
 60    }
 61   
 62    /**
 63    * Writes a row of the table. The table contains two cells; the first is the checkbox,
 64    * the second is the label for the checkbox.
 65    *
 66    **/
 67   
 68  0 public void renderOption(
 69    MultiplePropertySelection component,
 70    IMarkupWriter writer,
 71    IRequestCycle cycle,
 72    IPropertySelectionModel model,
 73    Object option,
 74    int index,
 75    boolean selected)
 76    {
 77  0 writer.begin("tr");
 78  0 writer.begin("td");
 79   
 80  0 writer.beginEmpty("input");
 81  0 writer.attribute("type", "checkbox");
 82  0 writer.attribute("name", component.getName());
 83  0 writer.attribute("value", model.getValue(index));
 84   
 85  0 if (component.isDisabled())
 86  0 writer.attribute("disabled", "disabled");
 87   
 88  0 if (selected)
 89  0 writer.attribute("checked", "checked");
 90   
 91  0 writer.end(); // <td>
 92   
 93  0 writer.println();
 94   
 95  0 writer.begin("td");
 96  0 writer.print(model.getLabel(index));
 97  0 writer.end(); // <td>
 98  0 writer.end(); // <tr>
 99   
 100  0 writer.println();
 101    }
 102    }