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