1 | /**
|
---|
2 | * StatsFrame.java
|
---|
3 | * Copyright (C) 2010 New Zealand Digital Library, http://expeditee.org
|
---|
4 | *
|
---|
5 | * This program is free software: you can redistribute it and/or modify
|
---|
6 | * it under the terms of the GNU General Public License as published by
|
---|
7 | * the Free Software Foundation, either version 3 of the License, or
|
---|
8 | * (at your option) any later version.
|
---|
9 | *
|
---|
10 | * This program is distributed in the hope that it will be useful,
|
---|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
13 | * GNU General Public License for more details.
|
---|
14 | *
|
---|
15 | * You should have received a copy of the GNU General Public License
|
---|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
17 | */
|
---|
18 |
|
---|
19 | package org.expeditee.stats;
|
---|
20 |
|
---|
21 | import java.awt.event.MouseEvent;
|
---|
22 | import java.lang.reflect.Method;
|
---|
23 | import java.util.HashMap;
|
---|
24 | import java.util.Map;
|
---|
25 |
|
---|
26 | public class StatsFrame extends SessionStats {
|
---|
27 |
|
---|
28 | private static Map<String, Method> _getMethods = null;
|
---|
29 |
|
---|
30 | public static Method getMethod(String name) {
|
---|
31 | if(_getMethods == null){
|
---|
32 | init();
|
---|
33 | }
|
---|
34 |
|
---|
35 | return _getMethods.get(name.trim().toLowerCase());
|
---|
36 | }
|
---|
37 |
|
---|
38 | private static void init() {
|
---|
39 | _getMethods = new HashMap<String, Method>();
|
---|
40 | for (Method m : StatsFrame.class.getMethods()) {
|
---|
41 | if (m.getReturnType().equals(String.class)) {
|
---|
42 | _getMethods.put(m.getName().substring(3).toLowerCase(), m);
|
---|
43 | }
|
---|
44 | }
|
---|
45 | }
|
---|
46 |
|
---|
47 | public static String getTextCreated() {
|
---|
48 | return _ItemStats[ItemType.Text.ordinal()][StatType.Created.ordinal()]
|
---|
49 | + "";
|
---|
50 | }
|
---|
51 |
|
---|
52 | public static String getTextMoved() {
|
---|
53 | return _ItemStats[ItemType.Text.ordinal()][StatType.Moved.ordinal()]
|
---|
54 | + "";
|
---|
55 | }
|
---|
56 |
|
---|
57 | public static String getTextDeleted() {
|
---|
58 | return _ItemStats[ItemType.Text.ordinal()][StatType.Deleted.ordinal()]
|
---|
59 | + "";
|
---|
60 | }
|
---|
61 |
|
---|
62 | public static String getTextCopied() {
|
---|
63 | return _ItemStats[ItemType.Text.ordinal()][StatType.Copied.ordinal()]
|
---|
64 | + "";
|
---|
65 | }
|
---|
66 |
|
---|
67 | public static String getItemsCreated() {
|
---|
68 | return _ItemStats[ItemType.Total.ordinal()][StatType.Created.ordinal()]
|
---|
69 | + "";
|
---|
70 | }
|
---|
71 |
|
---|
72 | public static String getItemsMoved() {
|
---|
73 | return _ItemStats[ItemType.Total.ordinal()][StatType.Moved.ordinal()]
|
---|
74 | + "";
|
---|
75 | }
|
---|
76 |
|
---|
77 | public static String getItemsDeleted() {
|
---|
78 | return _ItemStats[ItemType.Total.ordinal()][StatType.Deleted.ordinal()]
|
---|
79 | + "";
|
---|
80 | }
|
---|
81 |
|
---|
82 | public static String getItemsCopied() {
|
---|
83 | return _ItemStats[ItemType.Total.ordinal()][StatType.Copied.ordinal()]
|
---|
84 | + "";
|
---|
85 | }
|
---|
86 |
|
---|
87 | public static String getPicturesCreated() {
|
---|
88 | return _ItemStats[ItemType.Picture.ordinal()][StatType.Created.ordinal()]
|
---|
89 | + "";
|
---|
90 | }
|
---|
91 |
|
---|
92 | public static String getPicturesMoved() {
|
---|
93 | return _ItemStats[ItemType.Picture.ordinal()][StatType.Moved.ordinal()]
|
---|
94 | + "";
|
---|
95 | }
|
---|
96 |
|
---|
97 | public static String getPicturesDeleted() {
|
---|
98 | return _ItemStats[ItemType.Picture.ordinal()][StatType.Deleted.ordinal()]
|
---|
99 | + "";
|
---|
100 | }
|
---|
101 |
|
---|
102 | public static String getPicturesCopied() {
|
---|
103 | return _ItemStats[ItemType.Picture.ordinal()][StatType.Copied.ordinal()]
|
---|
104 | + "";
|
---|
105 | }
|
---|
106 |
|
---|
107 | public static String getDotsCreated() {
|
---|
108 | return _ItemStats[ItemType.Dot.ordinal()][StatType.Created.ordinal()]
|
---|
109 | + "";
|
---|
110 | }
|
---|
111 |
|
---|
112 | public static String getDotsMoved() {
|
---|
113 | return _ItemStats[ItemType.Dot.ordinal()][StatType.Moved.ordinal()]
|
---|
114 | + "";
|
---|
115 | }
|
---|
116 |
|
---|
117 | public static String getDotsDeleted() {
|
---|
118 | return _ItemStats[ItemType.Dot.ordinal()][StatType.Deleted.ordinal()]
|
---|
119 | + "";
|
---|
120 | }
|
---|
121 |
|
---|
122 | public static String getDotsCopied() {
|
---|
123 | return _ItemStats[ItemType.Dot.ordinal()][StatType.Copied.ordinal()]
|
---|
124 | + "";
|
---|
125 | }
|
---|
126 |
|
---|
127 | public static String getLinesCreated() {
|
---|
128 | return _ItemStats[ItemType.Line.ordinal()][StatType.Created.ordinal()]
|
---|
129 | + "";
|
---|
130 | }
|
---|
131 |
|
---|
132 | public static String getLinesMoved() {
|
---|
133 | return _ItemStats[ItemType.Line.ordinal()][StatType.Moved.ordinal()]
|
---|
134 | + "";
|
---|
135 | }
|
---|
136 |
|
---|
137 | public static String getLinesDeleted() {
|
---|
138 | return _ItemStats[ItemType.Line.ordinal()][StatType.Deleted.ordinal()]
|
---|
139 | + "";
|
---|
140 | }
|
---|
141 |
|
---|
142 | public static String getLinesCopied() {
|
---|
143 | return _ItemStats[ItemType.Line.ordinal()][StatType.Copied.ordinal()]
|
---|
144 | + "";
|
---|
145 | }
|
---|
146 |
|
---|
147 | public static String getFrames() {
|
---|
148 | return _CreatedFrames + "";
|
---|
149 | }
|
---|
150 |
|
---|
151 | public static String getFramesCreated() {
|
---|
152 | return getFrames();
|
---|
153 | }
|
---|
154 |
|
---|
155 | public static String getEscapeCount() {
|
---|
156 | return _EscapeCount + "";
|
---|
157 | }
|
---|
158 |
|
---|
159 | public static String getBackspaceCount() {
|
---|
160 | return _BackspaceCount + "";
|
---|
161 | }
|
---|
162 |
|
---|
163 | public static String getLeftButtonCount() {
|
---|
164 | return _MouseCounters[MouseEvent.BUTTON1] + "";
|
---|
165 | }
|
---|
166 |
|
---|
167 | public static String getMiddleButtonCount() {
|
---|
168 | return _MouseCounters[MouseEvent.BUTTON2] + "";
|
---|
169 | }
|
---|
170 |
|
---|
171 | public static String getRightButtonCount() {
|
---|
172 | return _MouseCounters[MouseEvent.BUTTON3] + "";
|
---|
173 | }
|
---|
174 | }
|
---|