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.plaf.css;
14:
15: import org.wings.CmsLayout;
16: import org.wings.DebugTagHandler;
17: import org.wings.MacroTagHandler;
18: import org.wings.SLayoutManager;
19: import org.wings.io.Device;
20: import org.wings.template.CmsTemplateParseContext;
21: import org.wings.template.TemplateSource;
22: import org.wings.template.RangeTagHandler;
23: import org.wings.template.parser.PageParser;
24:
25: import java.io.IOException;
26:
27: /**
28: * <code>CmsLayoutCG<code>.
29: * <p/>
30: * User: raedler
31: * Date: 08.08.2007
32: * Time: 13:00:00
33: *
34: * @author raedler
35: * @version $Id
36: */
37: public class CmsLayoutCG implements org.wings.plaf.CmsLayoutCG {
38:
39: /**
40: *
41: */
42: private static final long serialVersionUID = 1L;
43:
44: private static final PageParser parser = new PageParser();
45:
46: /**
47: * The parser looks for the '<OBJECT></OBJECT>' - tags.
48: */
49: static {
50: parser.addTagHandler("OBJECT", MacroTagHandler.class);
51: parser.addTagHandler("DEBUG", DebugTagHandler.class);
52: }
53:
54: private void write(Device device, CmsLayout layout)
55: throws IOException {
56: final TemplateSource source = layout.getTemplateSource();
57:
58: if (source == null) {
59: device
60: .print("The cms server is not reachable at the moment or the connection data is wrong. Please check your <em>wings-2-cms.xml</em>");
61: } else {
62: parser.process(source, new CmsTemplateParseContext(device,
63: layout));
64: }
65: }
66:
67: /**
68: * @param device the device to write the code to
69: * @param manager the layout manager
70: * @throws IOException
71: */
72: public void write(Device device, SLayoutManager manager)
73: throws IOException {
74: write(device, (CmsLayout) manager);
75: }
76: }
|