KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jac > aspects > gui > web > AbstractPage


1 /*
2   Copyright (C) 2002 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 org.objectweb.jac.aspects.gui.web;
19
20 import java.io.IOException JavaDoc;
21 import java.io.PrintWriter JavaDoc;
22 import org.apache.log4j.Logger;
23 import org.objectweb.jac.aspects.gui.*;
24
25 /**
26  * An HTML page containing a View
27  */

28 public abstract class AbstractPage extends AbstractView
29     implements WindowView, HTMLViewer
30 {
31     static Logger logger = Logger.getLogger("web");
32
33     /* the view embedded in the page */
34     protected View view;
35     /* tells if the page is in a new window (popup) */
36     boolean newWindow = false;
37
38     public AbstractPage(ViewFactory factory, DisplayContext context,
39                         View view, boolean newWindow)
40     {
41         super(factory,context);
42         view.setParentView(this);
43         this.view = view;
44         this.newWindow = newWindow;
45     }
46
47     public AbstractPage(View view, boolean newWindow) {
48         super();
49         view.setParentView(this);
50         this.view = view;
51         this.newWindow = newWindow;
52     }
53
54     public void close(boolean validate) {
55         if (!newWindow) {
56             logger.debug("closing "+this);
57             super.close(validate);
58             view.close(validate);
59         } else {
60             logger.debug("NOT closing "+this);
61         }
62     }
63
64     // WindowView interface
65
public View getContentView() {
66         return view;
67     }
68
69     // HTMLViewer interface
70

71     public void genHTML(PrintWriter JavaDoc out) throws IOException JavaDoc {
72         genPage(out);
73     }
74
75 }
76
Popular Tags