EMMA Coverage Report (generated Wed Feb 13 07:49:24 ICT 2008)
[all classes][net.sourceforge.hiveboard.view]

COVERAGE SUMMARY FOR SOURCE FILE [AbstractAccountRenderer.java]

nameclass, %method, %block, %line, %
AbstractAccountRenderer.java100% (1/1)100% (4/4)95%  (41/43)93%  (14/15)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AbstractAccountRenderer100% (1/1)100% (4/4)95%  (41/43)93%  (14/15)
convert (Object): Account 100% (1/1)89%  (16/18)80%  (4/5)
AbstractAccountRenderer (AccountRepository): void 100% (1/1)100% (6/6)100% (3/3)
nullValue (): String 100% (1/1)100% (2/2)100% (1/1)
setValue (Object): void 100% (1/1)100% (17/17)100% (6/6)

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.hiveboard.view;
16 
17import org.jvnet.substance.SubstanceDefaultTableCellRenderer;
18 
19import net.sourceforge.hiveboard.Account;
20import net.sourceforge.hiveboard.model.AccountRepository;
21 
22public abstract class AbstractAccountRenderer extends SubstanceDefaultTableCellRenderer
23{
24        protected AbstractAccountRenderer(AccountRepository repository)
25        {
26                _repository = repository;
27        }
28        
29        @Override protected void setValue(Object value)
30        {
31                Account account = convert(value);
32                String text = nullValue();
33                if (account != null)
34                {
35                        text = renderAccount(account);
36                }
37                setText(text);
38        }
39 
40        protected Account        convert(Object value)
41        {
42                if (value instanceof Account)
43                {
44                        return (Account) value;
45                }
46                else if (value instanceof Integer)
47                {
48                        return _repository.getAccount((Integer) value);
49                }
50                else
51                {
52                        return null;
53                }
54        }
55 
56        protected String        nullValue()
57        {
58                return "?";
59        }        
60 
61        protected abstract String        renderAccount(Account account);
62 
63        private final AccountRepository        _repository;
64}

[all classes][net.sourceforge.hiveboard.view]
EMMA 2.0.5312 (C) Vladimir Roubtsov