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: 86   Methods: 1
NCLOC: 34   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
TextArea.java 91.7% 95% 100% 93.9%
coverage 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.IForm;
 18   
 import org.apache.tapestry.IMarkupWriter;
 19   
 import org.apache.tapestry.IRequestCycle;
 20   
 
 21   
 /**
 22   
  * Implements a component that manages an HTML &lt;textarea&gt; form element. [ <a
 23   
  * href="../../../../../ComponentReference/TextArea.html">Component Reference </a>]
 24   
  * 
 25   
  * @author Howard Lewis Ship
 26   
  */
 27   
 
 28   
 public abstract class TextArea extends AbstractFormComponent
 29   
 {
 30   
 
 31   
     /**
 32   
      * Renders the form element, or responds when the form containing the element is submitted (by
 33   
      * checking {@link Form#isRewinding()}.
 34   
      */
 35   
 
 36  10
     protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
 37   
     {
 38  10
         IForm form = getForm(cycle);
 39   
 
 40  10
         if (form.wasPrerendered(writer, this))
 41  0
             return;
 42   
 
 43   
         // It isn't enough to know whether the cycle in general is rewinding, need to know
 44   
         // specifically if the form which contains this component is rewinding.
 45   
 
 46  10
         boolean rewinding = form.isRewinding();
 47   
 
 48   
         // Used whether rewinding or not.
 49   
 
 50  10
         String name = form.getElementId(this);
 51   
 
 52  10
         if (rewinding)
 53   
         {
 54  5
             if (!isDisabled())
 55  4
                 setValue(cycle.getParameter(name));
 56   
 
 57  5
             return;
 58   
         }
 59   
 
 60  5
         if (cycle.isRewinding())
 61  1
             return;
 62   
 
 63  4
         writer.begin("textarea");
 64   
 
 65  4
         writer.attribute("name", name);
 66   
 
 67  4
         if (isDisabled())
 68  1
             writer.attribute("disabled", "disabled");
 69   
 
 70  4
         renderInformalParameters(writer, cycle);
 71   
 
 72  4
         String value = getValue();
 73   
 
 74  4
         if (value != null)
 75  1
             writer.print(value);
 76   
 
 77  4
         writer.end();
 78   
 
 79   
     }
 80   
 
 81   
     public abstract boolean isDisabled();
 82   
 
 83   
     public abstract String getValue();
 84   
 
 85   
     public abstract void setValue(String value);
 86   
 }