KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > wings > template > TemplateParseContext


1 /*
2  * $Id: TemplateParseContext.java,v 1.3 2004/12/01 07:54:28 hengels Exp $
3  * Copyright 2000,2005 wingS development team.
4  *
5  * This file is part of wingS (http://www.j-wings.org).
6  *
7  * wingS is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License
9  * as published by the Free Software Foundation; either version 2.1
10  * of the License, or (at your option) any later version.
11  *
12  * Please see COPYING for the complete licence.
13  */

14 package org.wings.template;
15
16 import org.wings.SComponent;
17 import org.wings.STemplateLayout;
18 import org.wings.io.Device;
19 import org.wings.io.DeviceOutputStream;
20 import org.wings.template.parser.ParseContext;
21
22 import java.io.OutputStream JavaDoc;
23
24 /**
25  * @author <a HREF="mailto:H.Zeller@acm.org">Henner Zeller</a>
26  * @version $Revision: 1.3 $
27  */

28 public final class TemplateParseContext implements ParseContext {
29     private final OutputStream myOut;
30     private final Device sink;
31     private final STemplateLayout layout;
32
33     public TemplateParseContext(final Device sink, STemplateLayout layout) {
34         this.sink = sink;
35         this.layout = layout;
36         myOut = new DeviceOutputStream(sink);
37     }
38
39     public OutputStream getOutputStream() {
40         return myOut;
41     }
42
43     public void startTag(int number) {
44     }
45
46     public void doneTag(int number) {
47     }
48
49     /*
50      * important for the template: the components write to this sink
51      */

52     public Device getDevice() {
53         return sink;
54     }
55
56     public SComponent getComponent(String JavaDoc name) {
57         return layout.getComponent(name);
58     }
59 }
60
61
62
Popular Tags