%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.turbine.modules.layouts.DefaultLayout |
|
|
1 | package org.apache.turbine.modules.layouts; |
|
2 | ||
3 | /* |
|
4 | * Copyright 2001-2005 The Apache Software Foundation. |
|
5 | * |
|
6 | * Licensed under the Apache License, Version 2.0 (the "License") |
|
7 | * you may not use this file except in compliance with the License. |
|
8 | * You may obtain a copy of the License at |
|
9 | * |
|
10 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
11 | * |
|
12 | * Unless required by applicable law or agreed to in writing, software |
|
13 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
15 | * See the License for the specific language governing permissions and |
|
16 | * limitations under the License. |
|
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 | 0 | 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 | // Execute the Top Navigation portion for this Layout. |
|
53 | 0 | ConcreteElement topNav = NavigationLoader.getInstance() |
54 | .eval(data, "DefaultTopNavigation"); |
|
55 | ||
56 | 0 | if (topNav != null) |
57 | { |
|
58 | 0 | data.getPage().getBody().addElement(topNav); |
59 | } |
|
60 | ||
61 | // If an Action has defined a message, attempt to display it here. |
|
62 | 0 | if (data.getMessage() != null) |
63 | { |
|
64 | 0 | data.getPage().getBody().addElement(new P()) |
65 | .addElement(new Font().setColor(HtmlColor.red) |
|
66 | .addElement(data.getMessageAsHTML())); |
|
67 | } |
|
68 | ||
69 | // Now execute the Screen portion of the page. |
|
70 | 0 | ConcreteElement screen = ScreenLoader.getInstance() |
71 | .eval(data, data.getScreen()); |
|
72 | ||
73 | 0 | if (screen != null) |
74 | { |
|
75 | 0 | data.getPage().getBody().addElement(screen); |
76 | } |
|
77 | ||
78 | // The screen should have attempted to set a Title for itself, |
|
79 | // otherwise, a default title is set. |
|
80 | 0 | data.getPage().getTitle().addElement(data.getTitle()); |
81 | ||
82 | // The screen should have attempted to set a Body bgcolor for |
|
83 | // itself, otherwise, a default body bgcolor is set. |
|
84 | 0 | data.getPage().getBody().setBgColor(HtmlColor.white); |
85 | ||
86 | // Execute the Bottom Navigation portion for this Layout. |
|
87 | 0 | ConcreteElement bottomNav = NavigationLoader.getInstance().eval(data, |
88 | "DefaultBottomNavigation"); |
|
89 | ||
90 | 0 | if (bottomNav != null) |
91 | { |
|
92 | 0 | data.getPage().getBody().addElement(bottomNav); |
93 | } |
|
94 | 0 | } |
95 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |