01: /*
02: * Copyright 2000,2005 wingS development team.
03: *
04: * This file is part of wingS (http://wingsframework.org).
05: *
06: * wingS is free software; you can redistribute it and/or modify
07: * it under the terms of the GNU Lesser General Public License
08: * as published by the Free Software Foundation; either version 2.1
09: * of the License, or (at your option) any later version.
10: *
11: * Please see COPYING for the complete licence.
12: */
13: package org.wings.template;
14:
15: import org.wings.SComponent;
16: import org.wings.STemplateLayout;
17: import org.wings.io.Device;
18: import org.wings.io.DeviceOutputStream;
19: import org.wings.template.parser.ParseContext;
20:
21: import java.io.OutputStream;
22:
23: /**
24: * @author <a href="mailto:H.Zeller@acm.org">Henner Zeller</a>
25: */
26: public final class TemplateParseContext implements ParseContext {
27: private final OutputStream myOut;
28: private final Device sink;
29: private final STemplateLayout layout;
30:
31: public TemplateParseContext(final Device sink,
32: STemplateLayout layout) {
33: this .sink = sink;
34: this .layout = layout;
35: myOut = new DeviceOutputStream(sink);
36: }
37:
38: public OutputStream getOutputStream() {
39: return myOut;
40: }
41:
42: public void startTag(int number) {
43: }
44:
45: public void doneTag(int number) {
46: }
47:
48: /*
49: * important for the template: the components write to this sink
50: */
51: public Device getDevice() {
52: return sink;
53: }
54:
55: public SComponent getComponent(String name) {
56: return layout.getComponent(name);
57: }
58: }
|