1 package org.apache.turbine.modules.layouts;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 import org.apache.ecs.ConcreteElement;
20 import org.apache.ecs.HtmlColor;
21
22 import org.apache.ecs.html.Font;
23 import org.apache.ecs.html.P;
24
25 import org.apache.turbine.modules.Layout;
26 import org.apache.turbine.modules.NavigationLoader;
27 import org.apache.turbine.modules.ScreenLoader;
28
29 import org.apache.turbine.util.RunData;
30
31 /***
32 * This is an example Layout module that is executed by default.
33 *
34 * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
35 * @version $Id: DefaultLayout.java 264148 2005-08-29 14:21:04Z henning $
36 * @deprecated The use of ECS for the view is deprecated.
37 * Use a templating solution.
38 */
39 public class DefaultLayout extends Layout
40 {
41 /***
42 * Build the layout.
43 *
44 * <p><em>NOTE: Unless otherwise specified, the page background
45 * defaults to 'white'</em></p>
46 *
47 * @param data Turbine information.
48 * @exception Exception a generic exception.
49 */
50 public void doBuild(RunData data) throws Exception
51 {
52
53 ConcreteElement topNav = NavigationLoader.getInstance()
54 .eval(data, "DefaultTopNavigation");
55
56 if (topNav != null)
57 {
58 data.getPage().getBody().addElement(topNav);
59 }
60
61
62 if (data.getMessage() != null)
63 {
64 data.getPage().getBody().addElement(new P())
65 .addElement(new Font().setColor(HtmlColor.red)
66 .addElement(data.getMessageAsHTML()));
67 }
68
69
70 ConcreteElement screen = ScreenLoader.getInstance()
71 .eval(data, data.getScreen());
72
73 if (screen != null)
74 {
75 data.getPage().getBody().addElement(screen);
76 }
77
78
79
80 data.getPage().getTitle().addElement(data.getTitle());
81
82
83
84 data.getPage().getBody().setBgColor(HtmlColor.white);
85
86
87 ConcreteElement bottomNav = NavigationLoader.getInstance().eval(data,
88 "DefaultBottomNavigation");
89
90 if (bottomNav != null)
91 {
92 data.getPage().getBody().addElement(bottomNav);
93 }
94 }
95 }