Clover coverage report - Code Coverage for tapestry release 4.0-alpha-3
Coverage timestamp: Mon May 16 2005 09:05:49 EDT
file stats: LOC: 94   Methods: 3
NCLOC: 43   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
RadioPropertySelectionRenderer.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 table of radio (<input type=radio>) elements.
 23   
  *
 24   
  *  @author Howard Lewis Ship
 25   
  *
 26   
  **/
 27   
 
 28   
 public class RadioPropertySelectionRenderer implements IPropertySelectionRenderer
 29   
 {
 30   
 
 31   
     /**
 32   
      *  Writes the <table> element.
 33   
      *
 34   
      **/
 35   
 
 36  0
     public void beginRender(PropertySelection component, IMarkupWriter writer, IRequestCycle cycle)
 37   
     {
 38  0
         writer.begin("table");
 39  0
         writer.attribute("border", 0);
 40  0
         writer.attribute("cellpadding", 0);
 41  0
         writer.attribute("cellspacing", 2);
 42   
     }
 43   
 
 44   
     /**
 45   
      *  Closes the <table> element.
 46   
      *
 47   
      **/
 48   
 
 49  0
     public void endRender(PropertySelection component, IMarkupWriter writer, IRequestCycle cycle)
 50   
     {
 51  0
         writer.end(); // <table>
 52   
     }
 53   
 
 54   
     /**
 55   
      *  Writes a row of the table.  The table contains two cells; the first is the radio
 56   
      *  button, the second is the label for the radio button.
 57   
      *
 58   
      **/
 59   
 
 60  0
     public void renderOption(
 61   
         PropertySelection component,
 62   
         IMarkupWriter writer,
 63   
         IRequestCycle cycle,
 64   
         IPropertySelectionModel model,
 65   
         Object option,
 66   
         int index,
 67   
         boolean selected)
 68   
     {
 69  0
         writer.begin("tr");
 70  0
         writer.begin("td");
 71   
 
 72  0
         writer.beginEmpty("input");
 73  0
         writer.attribute("type", "radio");
 74  0
         writer.attribute("name", component.getName());
 75  0
         writer.attribute("value", model.getValue(index));
 76   
 
 77  0
         if (component.isDisabled())
 78  0
             writer.attribute("disabled", "disabled");
 79   
 
 80  0
         if (selected)
 81  0
             writer.attribute("checked", "checked");
 82   
 
 83  0
         writer.end(); // <td>
 84   
 
 85  0
         writer.println();
 86   
 
 87  0
         writer.begin("td");
 88  0
         writer.print(model.getLabel(index));
 89  0
         writer.end(); // <td>
 90  0
         writer.end(); // <tr>    
 91   
 
 92  0
         writer.println();
 93   
     }
 94   
 }