Coverage Report - org.apache.tapestry.valid.FieldTracking
 
Classes in this File Line Coverage Branch Coverage Complexity
FieldTracking
0%
0/24
0%
0/2
1
 
 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.valid;
 16  
 
 17  
 import org.apache.hivemind.util.Defense;
 18  
 import org.apache.tapestry.IRender;
 19  
 import org.apache.tapestry.form.IFormComponent;
 20  
 
 21  
 import java.io.Serializable;
 22  
 
 23  
 /**
 24  
  * Default implementation of {@link IFieldTracking}.
 25  
  * 
 26  
  * @author Howard Lewis Ship
 27  
  * @since 1.0.8
 28  
  */
 29  
 
 30  
 public class FieldTracking implements IFieldTracking, Serializable
 31  
 {
 32  
 
 33  
     private static final long serialVersionUID = -5397563163968532716L;
 34  
 
 35  
     private transient IFormComponent _component;
 36  
 
 37  
     private String _input;
 38  
 
 39  
     private IRender _renderer;
 40  
 
 41  
     private String _fieldName;
 42  
 
 43  
     private ValidationConstraint _constraint;
 44  
 
 45  0
     private boolean _renderErrors = true;
 46  
 
 47  
     /**
 48  
      * Constructor used for unassociated errors; errors that are not about any
 49  
      * particular field within the form.
 50  
      */
 51  
 
 52  
     FieldTracking()
 53  0
     {
 54  0
     }
 55  
 
 56  
     /**
 57  
      * Standard constructor for a field (with the given name), rendered by the
 58  
      * specified component.
 59  
      */
 60  
 
 61  
     FieldTracking(String fieldName, IFormComponent component)
 62  0
     {
 63  0
         Defense.notNull(fieldName, "fieldName");
 64  0
         Defense.notNull(component, "component");
 65  
 
 66  0
         _fieldName = fieldName;
 67  0
         _component = component;
 68  0
     }
 69  
 
 70  
     public IFormComponent getComponent()
 71  
     {
 72  0
         return _component;
 73  
     }
 74  
 
 75  
     public IRender getErrorRenderer()
 76  
     {
 77  0
         return _renderer;
 78  
     }
 79  
 
 80  
     public void setErrorRenderer(IRender value)
 81  
     {
 82  0
         _renderer = value;
 83  0
     }
 84  
 
 85  
     public String getInput()
 86  
     {
 87  0
         return _input;
 88  
     }
 89  
 
 90  
     public void setInput(String value)
 91  
     {
 92  0
         _input = value;
 93  0
     }
 94  
 
 95  
     public String getFieldName()
 96  
     {
 97  0
         return _fieldName;
 98  
     }
 99  
 
 100  
     public ValidationConstraint getConstraint()
 101  
     {
 102  0
         return _constraint;
 103  
     }
 104  
 
 105  
     public void setConstraint(ValidationConstraint constraint)
 106  
     {
 107  0
         _constraint = constraint;
 108  0
     }
 109  
 
 110  
     /** @since 3.0 * */
 111  
 
 112  
     public boolean isInError()
 113  
     {
 114  0
         return _renderer != null;
 115  
     }
 116  
 
 117  
     public boolean getRenderError()
 118  
     {
 119  0
         return _renderErrors;
 120  
     }
 121  
 
 122  
     public void setRenderError(boolean value)
 123  
     {
 124  0
         _renderErrors = value;
 125  0
     }
 126  
 }