Source code: jac/aspects/gui/web/Container.java
1 /*
2 Copyright (C) 2002-2003 Laurent Martelli <laurent@aopsys.com>
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
17
18 package jac.aspects.gui.web;
19
20 import jac.aspects.gui.*;
21 import java.io.IOException;
22 import java.io.PrintWriter;
23 import java.util.Iterator;
24
25 public class Container extends AbstractCompositeView
26 implements HTMLViewer
27 {
28 int layout;
29
30 public Container(int layout) {
31 super();
32 this.layout = layout;
33 }
34
35 public void genHTML(PrintWriter out) throws IOException {
36 genDescription(out);
37 genMessage(out);
38 //String myStyle = ((View) component).getStyle();
39 if ((style != null) && (style != "")) {
40 out.println("<div class=\"" + style + "\">");
41 }
42 Iterator i = components.iterator();
43 while (i.hasNext()) {
44 HTMLViewer component = (HTMLViewer)i.next();
45 if (layout==Constants.VERTICAL) {
46 out.println("<div class=\""+getClass().getName()+
47 "\" id=\""+((View)component).getLabel()+"\">");
48 }
49 out.println(((AbstractView)component).getOpenBorder());
50 component.genHTML(out);
51 out.println(((AbstractView)component).getCloseBorder());
52 if (layout==Constants.VERTICAL)
53 out.println("</div>");
54 }
55 if ((style != null) && (style != "")) {
56 out.println("</div>");
57 }
58 }
59 }