1 package info.mikethomas.fahweb.action;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 import info.mikethomas.jfold.Connection;
26 import info.mikethomas.jfold.unit.Unit;
27 import com.opensymphony.xwork2.ActionSupport;
28
29
30
31
32
33
34
35 public class ClientAction extends ActionSupport {
36
37 private Unit unit;
38 private String control;
39 private Connection connection;
40
41
42 @Override
43 public String execute() throws Exception {
44 this.unit = connection.queueInfo().get(0);
45 System.out.println(control);
46 return SUCCESS;
47 }
48
49
50
51
52
53
54 public String getPageTitle() {
55 return "Folding@home Client Control";
56 }
57
58
59
60
61
62
63 public String getPpd() {
64 return String.valueOf(unit.getPpd());
65 }
66
67
68
69
70
71
72 public String getId() {
73 return unit.getId();
74 }
75
76
77
78
79
80
81 public String getStatus() {
82 String status = unit.getState().toLowerCase();
83 return status.substring(0, 1).toUpperCase() + status.substring(1, status.length());
84 }
85
86
87
88
89
90
91 public String getProgress() {
92 return unit.getPercentDone();
93 }
94
95
96
97
98
99
100 public String getEta() {
101 return unit.getEta();
102 }
103
104
105
106
107
108
109 public String getCredit() {
110 return String.valueOf(unit.getCreditEstimate());
111 }
112
113
114
115
116
117
118 public String getPrcg() {
119 return unit.getProject() + " (" + unit.getRun() + ", " + unit.getClone() + ", " + unit.getGen() + ")";
120 }
121
122
123
124
125
126
127 public String getDescription() {
128 return unit.getDescription().replace("\n", "<br/>");
129 }
130
131
132
133
134
135
136 public String getControl() {
137 return control;
138 }
139
140
141
142
143
144
145 public void setControl(String control) {
146 this.control = control;
147 }
148
149 public void setConnection(Connection connection) {
150 this.connection = connection;
151 }
152 }