Clover coverage report - Code Coverage for tapestry release 4.0-beta-2
Coverage timestamp: Sat Jul 9 2005 22:02:17 EDT
file stats: LOC: 87   Methods: 3
NCLOC: 34   Classes: 1
30 day Evaluation License registered to hlship@comcast.net Your 30 day evaluation period has expired. Please visit http://www.cenqua.com to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
TextField.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.form;
 16   
 17    import org.apache.tapestry.IBinding;
 18    import org.apache.tapestry.IMarkupWriter;
 19    import org.apache.tapestry.IRequestCycle;
 20   
 21    /**
 22    * Implements a component that manages an HTML <input type=text> or <input
 23    * type=password> form element.
 24    * [ <a href="../../../../../ComponentReference/TextField.html">Component Reference </a>]
 25    *
 26    * As of 4.0, TextField can indicate that it is required, use a custom translator
 27    * (e.g. for numbers, dates, etc), and perform validation on the submitted value.
 28    *
 29    * @author Howard Lewis Ship
 30    * @author Paul Ferraro
 31    */
 32    public abstract class TextField extends AbstractValidatableField
 33    {
 34    public abstract boolean isHidden();
 35   
 36    public abstract Object getValue();
 37   
 38    public abstract void setValue(Object value);
 39   
 40    /**
 41    * @see org.apache.tapestry.form.validator.AbstractValidatableField#render(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle, java.lang.String)
 42    */
 43  5 public void render(IMarkupWriter writer, IRequestCycle cycle, String value)
 44    {
 45  5 renderDelegatePrefix(writer, cycle);
 46   
 47  5 writer.beginEmpty("input");
 48   
 49  5 writer.attribute("type", isHidden() ? "password" : "text");
 50   
 51  5 writer.attribute("name", getName());
 52   
 53  5 if (isDisabled())
 54  1 writer.attribute("disabled", "disabled");
 55   
 56  5 if (value != null)
 57  4 writer.attribute("value", value);
 58   
 59  5 renderIdAttribute(writer, cycle);
 60   
 61  5 renderDelegateAttributes(writer, cycle);
 62   
 63  5 renderContributions(writer, cycle);
 64   
 65  5 renderInformalParameters(writer, cycle);
 66   
 67  5 writer.closeTag();
 68   
 69  5 renderDelegateSuffix(writer, cycle);
 70    }
 71   
 72    /**
 73    * @see org.apache.tapestry.form.ValidatableField#writeValue(java.lang.Object)
 74    */
 75  1 public void writeValue(Object value)
 76    {
 77  1 setValue(value);
 78    }
 79   
 80    /**
 81    * @see org.apache.tapestry.form.ValidatableField#readValue()
 82    */
 83  1 public Object readValue()
 84    {
 85  1 return getValue();
 86    }
 87    }