Clover coverage report - Code Coverage for tapestry release 4.0-beta-4
Coverage timestamp: Wed Aug 10 2005 21:19:31 EDT
file stats: LOC: 68   Methods: 5
NCLOC: 37   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
TranslatedFieldSupportImpl.java 100% 90% 80% 89.5%
coverage coverage
 1    // Copyright 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.hivemind.service.ThreadLocale;
 18    import org.apache.tapestry.IMarkupWriter;
 19    import org.apache.tapestry.IRequestCycle;
 20    import org.apache.tapestry.valid.IValidationDelegate;
 21    import org.apache.tapestry.valid.ValidatorException;
 22   
 23    public class TranslatedFieldSupportImpl implements TranslatedFieldSupport
 24    {
 25    private ThreadLocale _threadLocale;
 26   
 27    /**
 28    * @return Returns the threadLocale.
 29    */
 30  0 public ThreadLocale getThreadLocale()
 31    {
 32  0 return _threadLocale;
 33    }
 34   
 35    /**
 36    * @param threadLocale The threadLocale to set.
 37    */
 38  1 public void setThreadLocale(ThreadLocale threadLocale)
 39    {
 40  1 _threadLocale = threadLocale;
 41    }
 42   
 43  2 public String format(TranslatedField field, Object object)
 44    {
 45  2 IValidationDelegate delegate = field.getForm().getDelegate();
 46   
 47  2 return delegate.isInError() ? delegate.getFieldInputValue() : field.getTranslator().format(field, object);
 48    }
 49   
 50  2 public Object parse(TranslatedField field, String text) throws ValidatorException
 51    {
 52  2 IValidationDelegate delegate = field.getForm().getDelegate();
 53   
 54  2 delegate.recordFieldInputValue(text);
 55   
 56  2 return field.getTranslator().parse(field, text);
 57    }
 58   
 59  2 public void renderContributions(TranslatedField field, IMarkupWriter writer, IRequestCycle cycle)
 60    {
 61  2 if (field.getForm().isClientValidationEnabled())
 62    {
 63  1 FormComponentContributorContext context = new FormComponentContributorContextImpl(_threadLocale.getLocale(), cycle, field);
 64   
 65  1 field.getTranslator().renderContribution(writer, cycle, context, field);
 66    }
 67    }
 68    }