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