EMMA Coverage Report (generated Tue Feb 12 22:23:49 ICT 2008)
[all classes][net.sourceforge.hivegui.table]

COVERAGE SUMMARY FOR SOURCE FILE [BeanDataModel.java]

nameclass, %method, %block, %line, %
BeanDataModel.java0%   (0/1)0%   (0/7)0%   (0/45)0%   (0/10)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class BeanDataModel0%   (0/1)0%   (0/7)0%   (0/45)0%   (0/10)
BeanDataModel (ColumnContribution []): void 0%   (0/1)0%   (0/6)0%   (0/3)
getColumnClass (int): Class 0%   (0/1)0%   (0/6)0%   (0/1)
getColumnCount (): int 0%   (0/1)0%   (0/4)0%   (0/1)
getColumnName (int): String 0%   (0/1)0%   (0/6)0%   (0/1)
getColumnValue (Object, int): Object 0%   (0/1)0%   (0/8)0%   (0/1)
isColumnEditable (Object, int): boolean 0%   (0/1)0%   (0/6)0%   (0/1)
setColumnValue (Object, int, Object): void 0%   (0/1)0%   (0/9)0%   (0/2)

1//  Copyright 2004-2007 Jean-Francois Poilpret
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 
15package net.sourceforge.hivegui.table;
16 
17import org.apache.hivemind.util.PropertyUtils;
18 
19/**
20 * @author Jean-Francois Poilpret
21 */
22public class BeanDataModel<T> implements DataModel<T>
23{
24        public BeanDataModel(ColumnContribution[] columns)
25        {
26                _columns = columns;
27        }
28        
29        public int                getColumnCount()
30        {
31                return _columns.length;
32        }
33        
34        public String        getColumnName(int column)
35        {
36                return _columns[column].getProperty();
37        }
38        
39        public Class        getColumnClass(int column)
40        {
41                return _columns[column].getType();
42        }
43        
44        public Object        getColumnValue(Object item, int column)
45        {
46                return PropertyUtils.read(item, _columns[column].getProperty());
47        }
48        
49        public void                setColumnValue(Object item, int column, Object value)
50        {
51                PropertyUtils.write(item, _columns[column].getProperty(), value);
52        }
53        
54        // Can be overridden if more complex behavior is needed
55        public boolean        isColumnEditable(Object item, int column)
56        {
57                return _columns[column].isEditable();
58        }
59 
60        final private ColumnContribution[]        _columns;
61}

[all classes][net.sourceforge.hivegui.table]
EMMA 2.0.5312 (C) Vladimir Roubtsov