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.configured.ConfiguredTemplateDefinition;
46  
47  import java.util.ArrayList;
48  import java.util.List;
49  
50  /**
51   * Define the base template definition (Areas settings, base template renderer,....)
52   * configured in the configuration workspace.
53   * @author pbracher
54   * @version $Id: MainTemplate.java 19956 2008-11-17 16:11:06Z pbracher $
55   *
56   */
57  public class STKPage extends ConfiguredTemplateDefinition {
58  
59      private SiteNavigation navigation;
60  
61      private String bodyID;
62  
63      private String category = "content";
64  
65      private String subcategory;
66  
67      private String bodyClass;
68  
69      private List<Resource> jsFiles = new ArrayList<Resource>();
70  
71      private List<CssFile> cssFiles = new ArrayList<CssFile>();
72  
73      public STKPage() {
74          setTemplateAvailability(new STKTemplateAvailability());
75      }
76  
77      /**
78       * Get the specified Area.
79       * @param key: Area name.
80       * @return Specified area. Null if not defined.
81       */
82      public AreaDefinition getArea(String key) {
83          return this.getAreas().get(key);
84      }
85  
86      /**
87       * Get Extra Area.
88       * Needed for the PoxyBeanMerger. In BodyClassResolver if we uses a (ExtrasArea)getArea("extras"),
89       * the proxy ExtraArea is cast and lost all his properties.
90       * @return
91       */
92      public ExtrasArea getExtrasArea() {
93          return (ExtrasArea) this.getAreas().get("extras");
94      }
95  
96      public String getBodyID() {
97          return bodyID;
98      }
99  
100     public void setBodyID(String bodyID) {
101         this.bodyID = bodyID;
102     }
103 
104     public String getBodyClass() {
105         return this.bodyClass;
106     }
107 
108     public void setBodyClass(String bodyClass) {
109         this.bodyClass = bodyClass;
110     }
111 
112     public SiteNavigation getNavigation() {
113         return this.navigation;
114     }
115 
116     public void setNavigation(SiteNavigation navigation) {
117         this.navigation = navigation;
118     }
119 
120     public String getCategory() {
121         return this.category;
122     }
123 
124     public void setCategory(String category) {
125         this.category = category;
126     }
127 
128     public String getSubcategory() {
129         return this.subcategory;
130     }
131 
132     public void setSubcategory(String subcategory) {
133         this.subcategory = subcategory;
134     }
135 
136     public List<Resource> getJsFiles() {
137         return this.jsFiles;
138     }
139 
140     public void setJsFiles(List<Resource> jsFiles) {
141         this.jsFiles = jsFiles;
142     }
143 
144     public void addJsFile(Resource jsFile) {
145         this.jsFiles.add(jsFile);
146     }
147 
148     public List<CssFile> getCssFiles() {
149         return this.cssFiles;
150     }
151 
152     public void setCssFiles(List<CssFile> cssFiles) {
153         this.cssFiles = cssFiles;
154     }
155 
156     public void addCssFile(CssFile cssFile) {
157         this.cssFiles.add(cssFile);
158     }
159 
160 
161     /**
162      * @deprecated since 2.0
163      */
164     public void setHeader(Header header) {
165         this.getAreas().put("header", header);
166     }
167 
168     /**
169      * @deprecated since 2.0
170      */
171     public FooterArea getFooter() {
172         return (FooterArea) this.getAreas().get("footer");
173     }
174 
175     /**
176      * @deprecated since 2.0
177      */
178     public void setFooter(FooterArea footer) {
179         this.getAreas().put("footer", footer);
180     }
181 
182     /**
183      * @deprecated since 2.0
184      */
185     public Header getHeader() {
186         return (Header) this.getAreas().get("header");
187     }
188     /**
189      * @deprecated since 2.0
190      */
191     public void setExtrasArea(ExtrasArea extras) {
192         this.getAreas().put("extras", extras);
193     }
194 
195     /**
196      * @deprecated since 2.0
197      */
198     public MainArea getMainArea() {
199         return (MainArea) this.getAreas().get("main");
200     }
201 
202     /**
203      * @deprecated since 2.0
204      */
205     public void setMainArea(MainArea main) {
206         this.getAreas().put("main", main);
207     }
208 
209     /**
210      * @deprecated since 2.0
211      */
212     public AreaDefinition getPromosArea() {
213         return this.getAreas().get("promos");
214     }
215 
216     /**
217      * @deprecated since 2.0
218      */
219     public void setPromosArea(AreaDefinition promos) {
220         this.getAreas().put("promos", promos);
221     }
222 
223     /**
224      * @deprecated since 2.0
225      */
226     public AreaDefinition getBaseArea() {
227         return this.getAreas().get("base");
228     }
229 
230     /**
231      * @deprecated since 2.0
232      */
233     public void setBaseArea(AreaDefinition base) {
234         this.getAreas().put("base", base);
235     }
236 
237     /**
238      * @deprecated since 2.0
239      */
240     public AreaDefinition getHtmlHeader() {
241         return this.getAreas().get("htmlHeader");
242     }
243 
244     /**
245      * @deprecated since 2.0
246      */
247     public void setHtmlHeader(AreaDefinition htmlHeader) {
248         this.getAreas().put("htmlHeader", htmlHeader);
249     }
250 
251     /**
252      * @deprecated since 2.0
253      */
254     public AreaDefinition getBreadcrumb() {
255         return this.getAreas().get("breadcrumb");
256     }
257 
258     /**
259      * @deprecated since 2.0
260      */
261     public void setBreadcrumb(AreaDefinition breadcrumb) {
262         this.getAreas().put("breadcrumb", breadcrumb);
263     }
264 
265     /**
266      * @deprecated since 2.0
267      */
268     public AreaDefinition getPlatformArea() {
269         return this.getAreas().get("platform");
270     }
271 
272     /**
273      * @deprecated since 2.0
274      */
275     public void setPlatformArea(AreaDefinition platform) {
276         this.getAreas().put("platform", platform);
277     }
278 }