KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > roller > pojos > ThemeTemplate


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. The ASF licenses this file to You
4  * under the Apache License, Version 2.0 (the "License"); you may not
5  * use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License. For additional information regarding
15  * copyright in this work, please see the NOTICE file in the top level
16  * directory of this distribution.
17  */

18
19 package org.apache.roller.pojos;
20
21 import java.io.Serializable JavaDoc;
22 import java.util.Date JavaDoc;
23 import org.apache.roller.pojos.Template;
24
25
26 /**
27  * A Theme based implementation of a Template. A ThemeTemplate represents a
28  * template which is part of a shared Theme.
29  */

30 public class ThemeTemplate implements Template, Serializable JavaDoc {
31     
32     private String JavaDoc id = null;
33     private String JavaDoc name = null;
34     private String JavaDoc description = null;
35     private String JavaDoc contents = null;
36     private String JavaDoc link = null;
37     private Date JavaDoc lastModified = null;
38     private String JavaDoc templateLanguage = null;
39     private boolean hidden = false;
40     private boolean navbar = false;
41     private String JavaDoc decoratorName = null;
42     
43     private Theme myTheme = null;
44     
45     
46     public ThemeTemplate() {}
47     
48     public ThemeTemplate(Theme theme, String JavaDoc id, String JavaDoc name, String JavaDoc desc,
49             String JavaDoc contents, String JavaDoc link, Date JavaDoc date, String JavaDoc tempLang,
50             boolean hid, boolean navbar, String JavaDoc decor) {
51         
52         this.myTheme = theme;
53         this.id = id;
54         this.name = name;
55         this.description = desc;
56         this.contents = contents;
57         this.link = link;
58         this.lastModified = date;
59         this.templateLanguage = tempLang;
60         this.hidden = hid;
61         this.navbar = navbar;
62         this.decoratorName = decor;
63     }
64     
65     
66     public Template getDecorator() {
67         if(decoratorName != null && !id.equals(decoratorName)) {
68             return myTheme.getTemplate(decoratorName);
69         }
70         return null;
71     }
72     
73     public String JavaDoc getId() {
74         return id;
75     }
76
77     public void setId(String JavaDoc id) {
78         this.id = id;
79     }
80
81     public String JavaDoc getName() {
82         return name;
83     }
84
85     public void setName(String JavaDoc name) {
86         this.name = name;
87     }
88
89     public String JavaDoc getDescription() {
90         return description;
91     }
92
93     public void setDescription(String JavaDoc description) {
94         this.description = description;
95     }
96
97     public String JavaDoc getContents() {
98         return contents;
99     }
100
101     public void setContents(String JavaDoc contents) {
102         this.contents = contents;
103     }
104
105     public Date JavaDoc getLastModified() {
106         return lastModified;
107     }
108
109     public void setLastModified(Date JavaDoc lastModified) {
110         this.lastModified = lastModified;
111     }
112
113     public String JavaDoc getLink() {
114         return link;
115     }
116
117     public void setLink(String JavaDoc link) {
118         this.link = link;
119     }
120
121     public String JavaDoc getTemplateLanguage() {
122         return templateLanguage;
123     }
124
125     public void setTemplateLanguage(String JavaDoc templateLanguage) {
126         this.templateLanguage = templateLanguage;
127     }
128
129     public boolean isHidden() {
130         return hidden;
131     }
132
133     public void setHidden(boolean isHidden) {
134         this.hidden = isHidden;
135     }
136
137     public boolean isNavbar() {
138         return navbar;
139     }
140
141     public void setNavbar(boolean navbar) {
142         this.navbar = navbar;
143     }
144
145     public String JavaDoc getDecoratorName() {
146         return decoratorName;
147     }
148
149     public void setDecoratorName(String JavaDoc decorator) {
150         this.decoratorName = decorator;
151     }
152     
153     public String JavaDoc toString() {
154         return (id + "," + name + "," + description + "," + link + "," +
155                 lastModified + "\n\n" + contents + "\n");
156     }
157     
158 }
159
Popular Tags