01: package org.wings.template;
02:
03: import org.wings.STemplateLayout;
04: import org.wings.SComponent;
05: import org.wings.io.Device;
06: import org.wings.io.DeviceOutputStream;
07: import org.wings.template.parser.ParseContext;
08:
09: import java.io.OutputStream;
10:
11: /**
12: * <code>CmsTemplateParseContext<code>.
13: * <p/>
14: * User: raedler
15: * Date: 03.12.2007
16: * Time: 13:23:45
17: *
18: * @author raedler
19: * @version $Id
20: */
21: public class CmsTemplateParseContext implements ParseContext {
22:
23: private final OutputStream myOut;
24: private final Device sink;
25: private final STemplateLayout layout;
26:
27: public CmsTemplateParseContext(final Device sink,
28: STemplateLayout layout) {
29: this .sink = sink;
30: this .layout = layout;
31: myOut = new DeviceOutputStream(sink);
32: }
33:
34: public OutputStream getOutputStream() {
35: return myOut;
36: }
37:
38: public void startTag(int number) {
39: }
40:
41: public void doneTag(int number) {
42: }
43:
44: /*
45: * important for the template: the components write to this sink
46: */
47: public Device getDevice() {
48: return sink;
49: }
50:
51: public SComponent getComponent(String name) {
52: return layout.getComponent(name);
53: }
54:
55: public SComponent[] getComponents() {
56: return layout.getContainer().getComponents();
57: }
58: }
|