View Javadoc

1   /**
2    * This file Copyright (c) 2008-2012 Magnolia International
3    * Ltd.  (http://www.magnolia-cms.com). All rights reserved.
4    *
5    *
6    * This file is dual-licensed under both the Magnolia
7    * Network Agreement and the GNU General Public License.
8    * You may elect to use one or the other of these licenses.
9    *
10   * This file is distributed in the hope that it will be
11   * useful, but AS-IS and WITHOUT ANY WARRANTY; without even the
12   * implied warranty of MERCHANTABILITY or FITNESS FOR A
13   * PARTICULAR PURPOSE, TITLE, or NONINFRINGEMENT.
14   * Redistribution, except as permitted by whichever of the GPL
15   * or MNA you select, is prohibited.
16   *
17   * 1. For the GPL license (GPL), you can redistribute and/or
18   * modify this file under the terms of the GNU General
19   * Public License, Version 3, as published by the Free Software
20   * Foundation.  You should have received a copy of the GNU
21   * General Public License, Version 3 along with this program;
22   * if not, write to the Free Software Foundation, Inc., 51
23   * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
24   *
25   * 2. For the Magnolia Network Agreement (MNA), this file
26   * and the accompanying materials are made available under the
27   * terms of the MNA which accompanies this distribution, and
28   * is available at http://www.magnolia-cms.com/mna.html
29   *
30   * Any modifications to this file must keep this entire header
31   * intact.
32   *
33   */
34  package info.magnolia.module.templatingkit.templates.pages;
35  
36  import info.magnolia.module.templatingkit.resources.Resource;
37  import info.magnolia.module.templatingkit.style.CssFile;
38  import info.magnolia.module.templatingkit.templates.ExtrasArea;
39  import info.magnolia.module.templatingkit.templates.FooterArea;
40  import info.magnolia.module.templatingkit.templates.Header;
41  import info.magnolia.module.templatingkit.templates.MainArea;
42  import info.magnolia.module.templatingkit.templates.STKTemplateAvailability;
43  import info.magnolia.module.templatingkit.templates.SiteNavigation;
44  import info.magnolia.rendering.template.AreaDefinition;
45  import info.magnolia.rendering.template.TemplateAvailability;
46  import info.magnolia.rendering.template.configured.ConfiguredTemplateDefinition;
47  
48  import java.util.ArrayList;
49  import java.util.List;
50  
51  /**
52   * Define the base template definition (Areas settings, base template renderer,....)
53   * configured in the configuration workspace.
54   * @author pbracher
55   * @version $Id: MainTemplate.java 19956 2008-11-17 16:11:06Z pbracher $
56   *
57   */
58  public class STKPage extends ConfiguredTemplateDefinition {
59  
60      private SiteNavigation navigation;
61  
62      private String bodyID;
63  
64      private String category = "content";
65  
66      private String subcategory;
67  
68      private String bodyClass;
69  
70      private List<Resource> jsFiles = new ArrayList<Resource>();
71  
72      private List<CssFile> cssFiles = new ArrayList<CssFile>();
73  
74  
75      public STKPage() {
76          super(new STKTemplateAvailability());
77      }
78  
79      /**
80       * @deprecated use {@link #STKPage()}
81       */
82      public STKPage(TemplateAvailability templateAvailability) {
83          super(new STKTemplateAvailability());
84      }
85  
86      /**
87       * Get the specified Area.
88       * @param key: Area name.
89       * @return Specified area. Null if not defined.
90       */
91      public AreaDefinition getArea(String key) {
92          return this.getAreas().get(key);
93      }
94  
95      /**
96       * Get Extra Area.
97       * Needed for the PoxyBeanMerger. In BodyClassResolver if we uses a (ExtrasArea)getArea("extras"),
98       * the proxy ExtraArea is cast and lost all his properties.
99       * @return
100      */
101     public ExtrasArea getExtrasArea() {
102         return (ExtrasArea) this.getAreas().get("extras");
103     }
104 
105     public String getBodyID() {
106         return bodyID;
107     }
108 
109     public void setBodyID(String bodyID) {
110         this.bodyID = bodyID;
111     }
112 
113     public String getBodyClass() {
114         return this.bodyClass;
115     }
116 
117     public void setBodyClass(String bodyClass) {
118         this.bodyClass = bodyClass;
119     }
120 
121     public SiteNavigation getNavigation() {
122         return this.navigation;
123     }
124 
125     public void setNavigation(SiteNavigation navigation) {
126         this.navigation = navigation;
127     }
128 
129     public String getCategory() {
130         return this.category;
131     }
132 
133     public void setCategory(String category) {
134         this.category = category;
135     }
136 
137     public String getSubcategory() {
138         return this.subcategory;
139     }
140 
141     public void setSubcategory(String subcategory) {
142         this.subcategory = subcategory;
143     }
144 
145     public List<Resource> getJsFiles() {
146         return this.jsFiles;
147     }
148 
149     public void setJsFiles(List<Resource> jsFiles) {
150         this.jsFiles = jsFiles;
151     }
152 
153     public void addJsFile(Resource jsFile) {
154         this.jsFiles.add(jsFile);
155     }
156 
157     public List<CssFile> getCssFiles() {
158         return this.cssFiles;
159     }
160 
161     public void setCssFiles(List<CssFile> cssFiles) {
162         this.cssFiles = cssFiles;
163     }
164 
165     public void addCssFile(CssFile cssFile) {
166         this.cssFiles.add(cssFile);
167     }
168 
169 
170     /**
171      * @deprecated since 2.0
172      */
173     public void setHeader(Header header) {
174         this.getAreas().put("header", header);
175     }
176 
177     /**
178      * @deprecated since 2.0
179      */
180     public FooterArea getFooter() {
181         return (FooterArea) this.getAreas().get("footer");
182     }
183 
184     /**
185      * @deprecated since 2.0
186      */
187     public void setFooter(FooterArea footer) {
188         this.getAreas().put("footer", footer);
189     }
190 
191     /**
192      * @deprecated since 2.0
193      */
194     public Header getHeader() {
195         return (Header) this.getAreas().get("header");
196     }
197     /**
198      * @deprecated since 2.0
199      */
200     public void setExtrasArea(ExtrasArea extras) {
201         this.getAreas().put("extras", extras);
202     }
203 
204     /**
205      * @deprecated since 2.0
206      */
207     public MainArea getMainArea() {
208         return (MainArea) this.getAreas().get("main");
209     }
210 
211     /**
212      * @deprecated since 2.0
213      */
214     public void setMainArea(MainArea main) {
215         this.getAreas().put("main", main);
216     }
217 
218     /**
219      * @deprecated since 2.0
220      */
221     public AreaDefinition getPromosArea() {
222         return this.getAreas().get("promos");
223     }
224 
225     /**
226      * @deprecated since 2.0
227      */
228     public void setPromosArea(AreaDefinition promos) {
229         this.getAreas().put("promos", promos);
230     }
231 
232     /**
233      * @deprecated since 2.0
234      */
235     public AreaDefinition getBaseArea() {
236         return this.getAreas().get("base");
237     }
238 
239     /**
240      * @deprecated since 2.0
241      */
242     public void setBaseArea(AreaDefinition base) {
243         this.getAreas().put("base", base);
244     }
245 
246     /**
247      * @deprecated since 2.0
248      */
249     public AreaDefinition getHtmlHeader() {
250         return this.getAreas().get("htmlHeader");
251     }
252 
253     /**
254      * @deprecated since 2.0
255      */
256     public void setHtmlHeader(AreaDefinition htmlHeader) {
257         this.getAreas().put("htmlHeader", htmlHeader);
258     }
259 
260     /**
261      * @deprecated since 2.0
262      */
263     public AreaDefinition getBreadcrumb() {
264         return this.getAreas().get("breadcrumb");
265     }
266 
267     /**
268      * @deprecated since 2.0
269      */
270     public void setBreadcrumb(AreaDefinition breadcrumb) {
271         this.getAreas().put("breadcrumb", breadcrumb);
272     }
273 
274     /**
275      * @deprecated since 2.0
276      */
277     public AreaDefinition getPlatformArea() {
278         return this.getAreas().get("platform");
279     }
280 
281     /**
282      * @deprecated since 2.0
283      */
284     public void setPlatformArea(AreaDefinition platform) {
285         this.getAreas().put("platform", platform);
286     }
287 }