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