Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: jac/aspects/gui/web/Page.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  
24  /**
25   * An HTML page containing a View and a close button.
26   */
27  public class Page extends AbstractPage implements WindowListener
28  {
29  
30     public Page(View view,boolean newWindow) {
31        super(view,newWindow);
32     }
33  
34     // HTMLViewer interface
35     public void genBody(PrintWriter out) throws IOException {
36        ((HTMLViewer)view).genHTML(out);
37        out.println("  <div class=\"actions\">");
38        if(newWindow) {
39           out.println("    <a class=\"button\" onClick=\"javascript:window.close();\">"+GuiAC.getLabelClose()+"</a>");
40        } else {
41           out.println("    <a class=\"button\" href=\""+eventURL("onClose")+"\">"+GuiAC.getLabelClose()+"</a>");
42        }
43        out.println("  </div>");
44     }
45  
46     // WindowListener interface
47  
48     public void onClose() {
49        ((WebDisplay)context.getDisplay()).closeWindow(this);
50        ((WebDisplay)context.getDisplay()).refresh();
51     }
52  }