Clover coverage report - brownies library - 1.0-beta-1 Coverage timestamp: 月 8 16 2004 17:14:42 GMT+09:00 FRAMES NO FRAMES |
file stats: | LOC: | 72 |  | Methods: | 6
| 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
SimpleObjectPropertySelectModel.java | - | 0% | 0% | 0% |

1 |  |
     /*
2 |  |
      * Joey and its relative products are published under the terms
3 |  |
      * of the Apache Software License.
4 |  |
      */
5 |  |
     /*
6 |  |
      * Created on 2004/01/16
7 |  |
      */
8 |  |
     package org.asyrinx.brownie.tapestry.components.form;
9 |  |
10 |  |
     import org.apache.commons.beanutils.PropertyUtils;
11 |  |
     import org.apache.tapestry.form.IPropertySelectionModel;
12 |  |
13 |  |
     /**
14 |  |
      * @author akima
15 |  |
      */
16 |  |
     public class SimpleObjectPropertySelectModel implements IPropertySelectionModel {
17 |  |
18 |  |
         /**
19 |  |
          *
20 |  |
          */
21 | 0 |
         public SimpleObjectPropertySelectModel(Object[] objects, String propertyName) {
22 | 0 |
             super();
23 | 0 |
             this.objects = objects;
24 | 0 |
             this.propertyName = propertyName;
25 |  |
         }
26 |  |
27 |  |
         private final Object[] objects;
28 |  |
29 |  |
         private final String propertyName;
30 |  |
31 |  |
         /**
32 |  |
          * @see org.apache.tapestry.form.IPropertySelectionModel#getOptionCount()
33 |  |
          */
34 | 0 |
         public int getOptionCount() {
35 | 0 |
             return objects.length;
36 |  |
         }
37 |  |
38 |  |
         /**
39 |  |
          * @see org.apache.tapestry.form.IPropertySelectionModel#getOption(int)
40 |  |
          */
41 | 0 |
         public Object getOption(int index) {
42 | 0 |
             return objects[index];
43 |  |
         }
44 |  |
45 |  |
         /**
46 |  |
          * @see org.apache.tapestry.form.IPropertySelectionModel#getLabel(int)
47 |  |
          */
48 | 0 |
         public String getLabel(int index) {
49 | 0 |
             try {
50 | 0 |
                 return String.valueOf(PropertyUtils.getProperty(objects[index],
51 |  |
                         propertyName));
52 |  |
             } catch (Exception e) {
53 | 0 |
                 return "failed to get label";
54 |  |
             }
55 |  |
         }
56 |  |
57 |  |
         /**
58 |  |
          * @see org.apache.tapestry.form.IPropertySelectionModel#getValue(int)
59 |  |
          */
60 | 0 |
         public String getValue(int index) {
61 | 0 |
             return Integer.toString(index);
62 |  |
         }
63 |  |
64 |  |
         /**
65 |  |
          * @see org.apache.tapestry.form.IPropertySelectionModel#translateValue(java.lang.String)
66 |  |
          */
67 | 0 |
         public Object translateValue(String value) {
68 | 0 |
             int index = Integer.parseInt(value);
69 | 0 |
             return objects[index];
70 |  |
         }
71 |  |
72 |  |
     }