1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package com.ebay.carad.os.vitalsigns;
23
24 import java.util.ArrayList;
25 import java.util.Collections;
26 import java.util.List;
27
28 /***
29 * Basic implementation of IDashboardReportContainer for grouping arbitrary reports.
30 * @author Jeremy Thomerson
31 * @version $Id$
32 */
33 public class DashboardReportContainer implements Comparable, IDashboardReportContainer {
34
35 private List mReports;
36 private int mSortOrder;
37 private String mGroupName;
38
39 public List getReports() {
40 Collections.sort(mReports);
41 return Collections.unmodifiableList(mReports);
42 }
43
44 public int getSortOrder() {
45 return mSortOrder;
46 }
47
48 public String getGroupName() {
49 return mGroupName;
50 }
51
52 public int compareTo(Object obj) {
53 IDashboardReportContainer rc = (IDashboardReportContainer) obj;
54 return getSortOrder() - rc.getSortOrder();
55 }
56
57 /***
58 * @param groupName The groupName to set.
59 */
60 public void setGroupName(String groupName) {
61 mGroupName = groupName;
62 }
63
64 /***
65 * @param reports The reports to set.
66 */
67 public void setReports(List reports) {
68 mReports = reports;
69 }
70
71 public void addReport(IDashboardReport report) {
72 if (mReports == null) {
73 mReports = new ArrayList();
74 }
75 mReports.add(report);
76 }
77
78 /***
79 * @param sortOrder The sortOrder to set.
80 */
81 public void setSortOrder(int sortOrder) {
82 mSortOrder = sortOrder;
83 }
84
85 }