-
Notifications
You must be signed in to change notification settings - Fork 16
/
EnvironmentView.java
156 lines (136 loc) · 5.04 KB
/
EnvironmentView.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
import java.util.Map;
import java.sql.*;
public class EnvironmentView
{
public static String action = "environment";
private static String getHead()
{
String myScript = "function formSubmit(offset)\n";
myScript += "{\n";
myScript += " document.getElementById(\"offset\").value = offset;\n";
myScript += " document.getElementById(\"myForm\").submit();\n";
myScript += "}\n";
myScript += "function sortRS(sortBy, sort)\n";
myScript += "{\n";
myScript += " document.getElementById(\"offset\").value = 0;\n";
myScript += " document.getElementById(\"sort_by\").value = sortBy;\n";
myScript += " document.getElementById(\"sort\").value = sort;\n";
myScript += " document.getElementById(\"myForm\").submit();\n";
myScript += "}\n";
return myScript;
}
public static String viewList(String search, ResultSet rs, String limit, String offset, String sortBy, String sort)
{
String myScript = getHead();
String msg = OutsourcerView.viewSearch(action, search, limit, offset, sortBy, sort, myScript);
msg += getHeader(sortBy, sort);
try
{
msg += OutsourcerView.viewResults(limit, offset, rs);
}
catch (SQLException ex)
{
msg += ex.getMessage();
}
return msg;
}
private static String getHeader(String sortBy, String sort)
{
String downArrow = "↓";
String upArrow = "↑";
String defaultSort = "asc";
String nameHeader = "<th><b>Name</b><button ";
String nameFocus = "";
String nameArrow = downArrow;
String nameSort = defaultSort;
String valueHeader = "<th><b>Value</b><button ";
String valueFocus = "";
String valueArrow = downArrow;
String valueSort = defaultSort;
if (sortBy.equals("name"))
{
nameFocus = OutsourcerView.focus;
if (sort.equals("asc"))
nameSort = "desc";
else
{
nameSort = "asc";
nameArrow = upArrow;
}
}
else if (sortBy.equals("value"))
{
valueFocus = OutsourcerView.focus;
if (sort.equals("asc"))
valueSort = "desc";
else
{
valueSort = "asc";
valueArrow = upArrow;
}
}
nameHeader += nameFocus + "onclick=\"sortRS('name', '" + nameSort + "')\">" + nameArrow + "</button></th>\n";
valueHeader += valueFocus + "onclick=\"sortRS('value', '" + valueSort + "')\">" + valueArrow + "</button></th>\n";
String msg = "<table class=\"tftable\" border=\"1\">\n";
msg += "<tr>\n";
msg += nameHeader + valueHeader;
msg += "</tr>\n";
return msg;
}
public static String viewStartStop(String status)
{
String msg = OutsourcerView.viewHeader("", "", action);
msg += "<form action=\"environment\" method=\"post\">\n";
msg += "<table class=\"tftable\" border=\"1\">\n";
msg += "<tr>\n";
msg += "<td width=\"30%\"><b>Queue Daemon Status</td><td><b>" + status + "</b></td>\n";
msg += "</tr>\n";
msg += "<tr>\n";
msg += "<td><b>Start/Stop</b></td><td><input type=\"hidden\" name=\"submit_form\" value=\"1\"><input type=\"hidden\" name=\"action_type\" value=\"Daemon\"><input type=\"submit\" value=\"Submit\"></td>\n";
msg += "</tr>\n";
msg += "</table>\n";
msg += "</form>\n";
return msg;
}
public static String viewAgentStartStop(String status)
{
String msg = OutsourcerView.viewHeader("", "", action);
msg += "<form action=\"environment\" method=\"post\">\n";
msg += "<table class=\"tftable\" border=\"1\">\n";
msg += "<tr>\n";
msg += "<td width=\"30%\"><b>Scheduler Daemon Status</td><td><b>" + status + "</b></td>\n";
msg += "</tr>\n";
msg += "<tr>\n";
msg += "<td><b>Start/Stop</b></td><td><input type=\"hidden\" name=\"submit_form\" value=\"1\"><input type=\"hidden\" name=\"action_type\" value=\"Agent\"><input type=\"submit\" value=\"Submit\"></td>\n";
msg += "</tr>\n";
msg += "</table>\n";
msg += "</form>\n";
return msg;
}
public static String viewMaxJobs(String maxJobs)
{
String msg = OutsourcerView.viewHeader("", "", action);
msg += "<form action=\"environment\" method=\"post\">\n";
msg += "<table class=\"tftable\" border=\"1\">\n";
msg += "<tr>\n";
msg += "<td width=\"33%\"><b>Max Jobs</b></td><td width=\"33%\"><input type=\"text\" id=\"max_jobs\" name=\"max_jobs\" value=" + maxJobs + "></td>\n";
msg += "<td width=\"33%\"><input type=\"hidden\" name=\"submit_form\" value=\"1\"><input type=\"hidden\" name=\"action_type\" value=\"max_jobs\"><input type=\"submit\" value=\"Submit\"></td>\n";
msg += "</tr>\n";
msg += "</table>\n";
msg += "</form>\n";
return msg;
}
public static String viewFetchSize(String oFetchSize)
{
String msg = OutsourcerView.viewHeader("", "", action);
msg += "<form action=\"environment\" method=\"post\">\n";
msg += "<table class=\"tftable\" border=\"1\">\n";
msg += "<tr>\n";
msg += "<td width=\"33%\"><b>Oracle Fetch Size</b></td><td width=\"33%\"><input type=\"text\" id=\"oFetchSize\" name=\"oFetchSize\" value=" + oFetchSize + "></td>\n";
msg += "<td width=\"33%\"><input type=\"hidden\" name=\"submit_form\" value=\"1\"><input type=\"hidden\" name=\"action_type\" value=\"oFetchSize\"><input type=\"submit\" value=\"Submit\"></td>\n";
msg += "</tr>\n";
msg += "</table>\n";
msg += "</form>\n";
return msg;
}
}