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: 84   Methods: 0
NCLOC: 8   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
IPropertySelectionModel.java - - - -
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   
 /**
 18   
  *  Used by a {@link PropertySelection} to provide labels for options.
 19   
  *
 20   
  *  <p>The component requires three different representations
 21   
  *  of each option:
 22   
  *  <ul>
 23   
  *  <li>The option value, a Java object that will eventually be assigned to
 24   
  *  a property
 25   
  *  <li>The label, a String which is incorprated into the HTML to identify the
 26   
  *  option to the user
 27   
  *  <li>The value, a String which is used to represent the option as the value
 28   
  *  of the &lt;option&gt; or &lt;input type=radio&gt; generated by the
 29   
  *  {@link PropertySelection}.
 30   
  *  </ul>
 31   
  *
 32   
  *  <p>The option is usually either an {@link org.apache.commons.lang.enum.Enum} 
 33   
  *  (see {@link EnumPropertySelectionModel})
 34   
  *  or some kind of business object.  The label is often a property of the
 35   
  *  option object (for example, for a list of customers, it could be the customer name).
 36   
  *
 37   
  *  <p>It should be easy to convert between the value and the option.  It may simply
 38   
  *  be an index into an array.  For business objects, it is often the primary key
 39   
  *  of the object, expressed as a String.
 40   
  *
 41   
  *  @author Howard Lewis Ship
 42   
  *
 43   
  **/
 44   
 
 45   
 public interface IPropertySelectionModel
 46   
 {
 47   
     /**
 48   
      *  Returns the number of possible options.
 49   
      *
 50   
      **/
 51   
 
 52   
     public int getOptionCount();
 53   
 
 54   
     /**
 55   
      *  Returns one possible option.
 56   
      *
 57   
      **/
 58   
 
 59   
     public Object getOption(int index);
 60   
 
 61   
     /**
 62   
      *  Returns the label for an option.  It is the responsibility of the
 63   
      *  adaptor to make this value localized.
 64   
      *
 65   
      **/
 66   
 
 67   
     public String getLabel(int index);
 68   
 
 69   
     /**
 70   
      *  Returns a String used to represent the option in the HTML (as the
 71   
      *  value of an &lt;option&gt; or &lt;input type=radio&gt;.
 72   
      *
 73   
      **/
 74   
 
 75   
     public String getValue(int index);
 76   
 
 77   
     /**
 78   
      *  Returns the option corresponding to a value.  This is used when
 79   
      *  interpreting submitted form parameters.
 80   
      *
 81   
      **/
 82   
 
 83   
     public Object translateValue(String value);
 84   
 }