blob: ad7f9190ea682491e9ef53df7f77962a33f16e8f (
plain) (
blame)
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
|
package templates;
import java.util.*;
import org.eclipse.emf.cdo.examples.server.*;
public class ConfigOverview
{
protected static String nl;
public static synchronized ConfigOverview create(String lineSeparator)
{
nl = lineSeparator;
ConfigOverview result = new ConfigOverview();
nl = null;
return result;
}
public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
protected final String TEXT_1 = "";
protected final String TEXT_2 = NL + NL + "<html>" + NL + " <header>" + NL + "\t <title>" + NL + "\t\t\tDemo Configuration ";
protected final String TEXT_3 = NL + "\t </title>" + NL + "\t\t<link media=\"screen\" href=\"demo-server.css\" type=\"text/css\" rel=\"stylesheet\">" + NL + "\t<header>" + NL + "<body>" + NL + "" + NL + "<h1>Demo Configuration</h1>" + NL + "<hr>" + NL + "" + NL + "<table border=\"0\" width=\"400\">" + NL + "\t<tr><td>Server:</td><td><b>tcp://cdo.eclipse.org:";
protected final String TEXT_4 = "</b></td></tr>" + NL + "\t<tr><td>Repository:</td><td><b>";
protected final String TEXT_5 = "</b></td></tr>" + NL + "\t<tr><td>Mode:</td><td>";
protected final String TEXT_6 = "</td></tr>" + NL + "\t<tr><td>User IDs:</td><td>" + NL + "\t";
protected final String TEXT_7 = NL + "\t\t\t";
protected final String TEXT_8 = ": ";
protected final String TEXT_9 = "<br>";
protected final String TEXT_10 = NL + "\t\t</td></tr>" + NL + "\t</td></tr>" + NL + "\t<tr><td>Idle Time:</td><td>";
protected final String TEXT_11 = "</td></tr>" + NL + "\t<tr><td> </td><td><a href=\"?name=";
protected final String TEXT_12 = "\">Refresh Page</a></td></tr>" + NL + "</table>" + NL + "" + NL + "</body>" + NL + "</html>";
protected final String TEXT_13 = NL;
public String generate(Object argument)
{
final StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(TEXT_1);
DemoConfiguration config = (DemoConfiguration)argument;
String name = config.getName();
stringBuffer.append(TEXT_2);
stringBuffer.append(name);
stringBuffer.append(TEXT_3);
stringBuffer.append(DemoServer.PORT);
stringBuffer.append(TEXT_4);
stringBuffer.append(name);
stringBuffer.append(TEXT_5);
stringBuffer.append(AbstractTemplateServlet.html(config.getMode().toString()));
stringBuffer.append(TEXT_6);
Map<String, char[]> users = config.getUsers();
List<String> userIDs = new ArrayList<String>(users.keySet());
Collections.sort(userIDs);
for (String userID : userIDs)
{
stringBuffer.append(TEXT_7);
stringBuffer.append(userID);
stringBuffer.append(TEXT_8);
stringBuffer.append(users.get(userID));
stringBuffer.append(TEXT_9);
}
stringBuffer.append(TEXT_10);
stringBuffer.append(AbstractTemplateServlet.html(config.formatIdleTime()));
stringBuffer.append(TEXT_11);
stringBuffer.append(name);
stringBuffer.append(TEXT_12);
stringBuffer.append(TEXT_13);
return stringBuffer.toString();
}
}
|