1 package uk.ac.ebi.intenz.webapp.controller;
2
3 import java.io.IOException;
4
5 import javax.servlet.ServletException;
6
7 import uk.ac.ebi.xchars.SpecialCharacters;
8
9
10
11
12
13
14
15
16 public class ChangeCharacterRepresentationCommand extends NonDatabaseCommand {
17
18
19
20
21
22
23
24
25
26
27
28 public void process() throws ServletException, IOException {
29 boolean unicodeOnly = request.getParameter("uo").equals("true");
30
31
32
33
34
35
36
37
38
39
40
41
42
43 request.setAttribute("info", getInfo(unicodeOnly));
44 forward("/info.jsp");
45 }
46
47
48
49
50
51
52
53 private String getInfo(boolean unicodeOnly) {
54 StringBuffer info = new StringBuffer();
55
56 info.append("<form action=\"query?cmd=ChangeCharacterRepresentation\" method=\"post\">");
57 info.append("<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n");
58 info.append(" <tr>\n");
59
60 if (!unicodeOnly) {
61 info.append(" <td>You have switched to individual encoding (browser-dependent and font-independent) of " +
62 "special characters. Some characters may now be displayed as images, depending on the browser version " +
63 "you use. If you want to use the default encoding again, press the button below this text.</td></tr>\n");
64 info.append("<tr><td> </td></tr>\n");
65 info.append(" <tr><td align=\"center\"><input type=\"submit\" value=\"Switch to default encoding\">\n" +
66 " <input type=\"hidden\" name=\"uo\" value=\"true\"></td>\n");
67 } else {
68 info.append(" <td>You have switched to the default encoding for special characters. The default encoding uses " +
69 "Unicode to display special characters and works best with current browser versions. Please check if you " +
70 "have a Unicode font installed and if you can see all " +
71 "<a href=\"javascript:windowOpenWithSize('encoding.html', 280, 400)\">special characters</a> used within " +
72 "IntEnz. If you cannot see all characters or if you are not happy with the representation then press the " +
73 "button below to enable individual encoding (browser-dependent and font-independent).</td></tr>\n");
74 info.append("<tr><td> </td></tr>\n");
75 info.append(" <tr><td align=\"center\"><input type=\"submit\" value=\"Switch to individual encoding\">\n" +
76 " <input type=\"hidden\" name=\"uo\" value=\"false\"></td>\n");
77 }
78
79 info.append(" </tr>");
80 info.append("</table>");
81 info.append("</form>");
82 return info.toString();
83 }
84
85 }