1
2 package com.pnpconsult.zeiterfassung.table;
3
4 import java.util.Collections;
5 import java.util.Iterator;
6
7 import com.pnpconsult.zeiterfassung.model.BillEntry;
8 import com.pnpconsult.zeiterfassung.util.DateUtils;
9 import com.pnpconsult.zeiterfassung.util.NumberUtils;
10
11 /***
12 * @author <a href="mailto:powerpete@users.sf.net">Moritz Petersen</a>
13 * @version $Id: BillEntryRow.java,v 1.3 2004/06/09 19:26:37 powerpete Exp $
14 */
15 public class BillEntryRow implements Row
16 {
17 private BillEntry entry;
18
19 public BillEntryRow(BillEntry entry)
20 {
21 this.entry = entry;
22 }
23
24 public BillEntry getEntry()
25 {
26 return entry;
27 }
28
29 public String getDescription()
30 {
31 return entry.getBillDescription();
32 }
33
34 public String getTargetDate()
35 {
36 return DateUtils.format(entry.getTargetDate());
37 }
38
39 public String getTotal()
40 {
41 return NumberUtils.formatLong(computeTotal());
42 }
43
44 public float computeTotal()
45 {
46 return entry.getHours() * entry.getRate();
47 }
48
49 public RateRow getRateRowsHead()
50 {
51 RateRow rateRow = new RateRow();
52 rateRow.add(entry);
53 return rateRow;
54 }
55
56 public Iterator getRateRowsTail()
57 {
58 return Collections.EMPTY_LIST.iterator();
59 }
60
61 public int getRateRowsSize()
62 {
63 return entry != null ? 1 : 0;
64 }
65 }