1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package olr.presentation;
18
19 import olr.viewer.CourseViewer;
20 import olr.viewer.CourseViewers;
21
22 import org.w3c.dom.Node;
23 import org.w3c.dom.html.HTMLAnchorElement;
24 import org.w3c.dom.html.HTMLTableCellElement;
25
26 import com.lutris.appserver.server.httpPresentation.HttpPresentationException;
27
28 /***
29 * @version $Id: StructureHeader.java,v 1.6 2004/08/02 18:55:06 roku Exp $
30 */
31 public class StructureHeader extends ExtendedHttpPresentation {
32 /***
33 * Initializes an instance of this class.
34 */
35 public StructureHeader() {
36 }
37
38 public boolean loggedInUserRequired() {
39 return true;
40 }
41
42 public String handleDefault() throws HttpPresentationException {
43 return showPage();
44 }
45
46 public String showPage() {
47 StructureHeaderHTML page = new StructureHeaderHTML();
48 try {
49 HTMLTableCellElement schema = page.getElementSchema();
50 HTMLTableCellElement schemaNoLink = page.getElementSchemaNoLink();
51 HTMLTableCellElement space = page.getElementSpace();
52 HTMLAnchorElement schemaLink = page.getElementSchemaLink();
53 Node parent = schema.getParentNode();
54 CourseViewers viewers = getSessionData().getCourseViewers();
55 for (int i = 0; i < viewers.getCount(); i++) {
56 CourseViewer courseViewer = viewers.getViewerAt(i);
57 if (courseViewer.equals(viewers.getActiveViewer())) {
58 page.setTextSchemaTitle(courseViewer.getTitle());
59 parent.appendChild(schemaNoLink.cloneNode(true));
60 } else {
61 page.setTextSchemaLink(courseViewer.getTitle());
62 schemaLink.setHref("StructureFrame.po?event=chooseSchema&nr=".concat(String
63 .valueOf(String.valueOf(i))));
64 parent.appendChild(schema.cloneNode(true));
65 }
66 parent.appendChild(space.cloneNode(true));
67 }
68
69 parent.removeChild(schema);
70 parent.removeChild(schemaNoLink);
71 parent.removeChild(space);
72 } catch (Exception e) {
73 e.printStackTrace();
74 }
75 return page.toDocument();
76 }
77 }