KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portlet > forums > theme > ForumsTheme


1 /*****************************************
2  * *
3  * JBoss Portal: The OpenSource Portal *
4  * *
5  * Forums JBoss Portlet *
6  * *
7  * Distributable under GPL license. *
8  * See terms of license at gnu.org. *
9  * *
10  *****************************************/

11 package org.jboss.portlet.forums.theme;
12
13 import org.jboss.portlet.forums.ForumsConstants;
14 import org.jboss.portlet.forums.properties.XProperties;
15
16 /**
17  * @author <a HREF="mailto:julien@jboss.org">Julien Viet</a>
18  * @author <a HREF="mailto:julien@jboss.org">Thomas Heute</a>
19  */

20 public class ForumsTheme
21 {
22    /**
23     * DOCUMENT_ME
24     *
25     * @param type DOCUMENT_ME
26     * @param status DOCUMENT_ME
27     * @param hot DOCUMENT_ME
28     *
29     * @return DOCUMENT_ME
30     */

31    public FolderType getFolderType(int type,
32                                    int status,
33                                    boolean hot)
34    {
35       switch (type)
36       {
37          case ForumsConstants.POST_ANNOUNCE:
38             return FOLDER_ANNOUNCE;
39
40          case ForumsConstants.POST_STICKY:
41             return FOLDER_STICKY;
42
43          default:
44             if (status == ForumsConstants.TOPIC_LOCKED)
45             {
46                return FOLDER_LOCKED;
47             }
48             else
49             {
50                if (hot)
51                {
52                   return FOLDER_HOT;
53                }
54                else
55                {
56                   return FOLDER_NORMAL;
57                }
58             }
59       }
60    }
61
62    /** DOCUMENT_ME */
63    public FolderType FOLDER_ANNOUNCE;
64
65    /** DOCUMENT_ME */
66    public FolderType FOLDER_STICKY;
67
68    /** DOCUMENT_ME */
69    public FolderType FOLDER_LOCKED;
70
71    /** DOCUMENT_ME */
72    public FolderType FOLDER_NORMAL;
73
74    /** DOCUMENT_ME */
75    public FolderType FOLDER_HOT;
76
77    /** DOCUMENT_ME */
78    public String JavaDoc resourceForumURL;
79
80    /** DOCUMENT_ME */
81    public String JavaDoc resourceForumNewURL;
82
83    /** DOCUMENT_ME */
84    public String JavaDoc resourceForumNewBigURL;
85
86    /** DOCUMENT_ME */
87    public String JavaDoc resourceForumLockedURL;
88
89    /** DOCUMENT_ME */
90    public String JavaDoc resourceIconLatestReplyURL;
91
92    /** DOCUMENT_ME */
93    public String JavaDoc resourceIconNewestReplyURL;
94
95    /** DOCUMENT_ME */
96    public String JavaDoc resourceIconGotopostURL;
97
98    /** DOCUMENT_ME */
99    public String JavaDoc resourceFolderURL;
100
101    /** DOCUMENT_ME */
102    public String JavaDoc resourceFolderNewURL;
103
104    /** DOCUMENT_ME */
105    public String JavaDoc resourceFolderAnnounceURL;
106
107    /** DOCUMENT_ME */
108    public String JavaDoc resourceFolderAnnounceNewURL;
109
110    /** DOCUMENT_ME */
111    public String JavaDoc resourceFolderStickyURL;
112
113    /** DOCUMENT_ME */
114    public String JavaDoc resourceFolderStickyNewURL;
115
116    /** DOCUMENT_ME */
117    public String JavaDoc resourceFolderLockedURL;
118
119    /** DOCUMENT_ME */
120    public String JavaDoc resourceFolderLockedNewURL;
121
122    /** DOCUMENT_ME */
123    public String JavaDoc resourceFolderHotURL;
124
125    /** DOCUMENT_ME */
126    public String JavaDoc resourceFolderHotNewURL;
127
128    /** DOCUMENT_ME */
129    public String JavaDoc resourcePostLockedURL;
130
131    /** DOCUMENT_ME */
132    public String JavaDoc resourcePostNewURL;
133
134    /** DOCUMENT_ME */
135    public String JavaDoc resourceTopicModeDeleteURL;
136
137    /** DOCUMENT_ME */
138    public String JavaDoc resourceTopicModMoveURL;
139
140    /** DOCUMENT_ME */
141    public String JavaDoc resourceTopicModLockURL;
142
143    /** DOCUMENT_ME */
144    public String JavaDoc resourceTopicModUnlockURL;
145
146    /** DOCUMENT_ME */
147    public String JavaDoc resourceTopicModSplitURL;
148
149    /** DOCUMENT_ME */
150    public String JavaDoc resourceTopicUnWatchURL;
151
152    /** DOCUMENT_ME */
153    public String JavaDoc resourceTopicWatchURL;
154
155    /** DOCUMENT_ME */
156    public String JavaDoc resourceReplyNewURL;
157
158    /** DOCUMENT_ME */
159    public String JavaDoc resourceReplyLockedURL;
160
161    /** DOCUMENT_ME */
162    public String JavaDoc resourceIconProfileURL;
163
164    /** DOCUMENT_ME */
165    public String JavaDoc resourceIconPMURL;
166
167    /** DOCUMENT_ME */
168    public String JavaDoc resourceIconEmailURL;
169
170    /** DOCUMENT_ME */
171    public String JavaDoc resourceIconWWWURL;
172
173    /** DOCUMENT_ME */
174    public String JavaDoc resourceIconICQURL;
175
176    /** DOCUMENT_ME */
177    public String JavaDoc resourceIconAIMURL;
178
179    /** DOCUMENT_ME */
180    public String JavaDoc resourceIconMSNMURL;
181
182    /** DOCUMENT_ME */
183    public String JavaDoc resourceIconYIMURL;
184
185    /** DOCUMENT_ME */
186    public String JavaDoc resourceIconQuoteURL;
187
188    /** DOCUMENT_ME */
189    public String JavaDoc resourceIconSearchURL;
190
191    /** DOCUMENT_ME */
192    public String JavaDoc resourceIconEditURL;
193
194    /** DOCUMENT_ME */
195    public String JavaDoc resourceIconRepostURL;
196
197    /** DOCUMENT_ME */
198    public String JavaDoc resourceIconIPURL;
199
200    /** DOCUMENT_ME */
201    public String JavaDoc resourceIconDelpostURL;
202
203    /** DOCUMENT_ME */
204    public String JavaDoc resourceIconMinipostURL;
205
206    /** DOCUMENT_ME */
207    public String JavaDoc resourceIconMinipostNewURL;
208
209    /** DOCUMENT_ME */
210    public String JavaDoc resourceHeadStylesheetURL;
211    private XProperties xprops;
212
213    /**
214     * DOCUMENT_ME
215     *
216     * @param xprops DOCUMENT_ME
217     */

218    public void setExtendedProperties(XProperties xprops)
219    {
220       this.xprops = xprops;
221    }
222
223    /**
224     * DOCUMENT_ME
225     *
226     * @param name DOCUMENT_ME
227     *
228     * @return DOCUMENT_ME
229     */

230    public String JavaDoc getProperty(String JavaDoc name)
231    {
232       return xprops.getProperty(name);
233    }
234
235    /**
236     * DOCUMENT_ME
237     *
238     * @param name DOCUMENT_ME
239     *
240     * @return DOCUMENT_ME
241     */

242    public String JavaDoc getResourceURL(String JavaDoc name)
243    {
244       return xprops.getResourceURL(name);
245    }
246
247    /**
248     * DOCUMENT_ME
249     *
250     * @throws Exception DOCUMENT_ME
251     */

252    public void start()
253    throws Exception JavaDoc
254    {
255       resourceForumURL = xprops.getResourceURL("forum");
256       resourceForumNewURL = xprops.getResourceURL("forum_new");
257       resourceForumNewBigURL = xprops.getResourceURL("forum_new_big");
258       resourceForumLockedURL = xprops.getResourceURL("forum_locked");
259       resourceIconLatestReplyURL = xprops.getResourceURL("icon_latest_reply");
260       resourceIconNewestReplyURL = xprops.getResourceURL("icon_newest_reply");
261       resourceIconGotopostURL = xprops.getResourceURL("icon_gotopost");
262       resourceFolderURL = xprops.getResourceURL("folder");
263       resourceFolderNewURL = xprops.getResourceURL("folder_new");
264       resourceFolderAnnounceURL = xprops.getResourceURL("folder_announce");
265       resourceFolderAnnounceNewURL = xprops.getResourceURL("folder_announce_new");
266       resourceFolderStickyURL = xprops.getResourceURL("folder_sticky");
267       resourceFolderStickyNewURL = xprops.getResourceURL("folder_sticky_new");
268       resourceFolderLockedURL = xprops.getResourceURL("folder_locked");
269       resourceFolderLockedNewURL = xprops.getResourceURL("folder_locked_new");
270       resourceFolderHotURL = xprops.getResourceURL("folder_hot");
271       resourceFolderHotNewURL = xprops.getResourceURL("folder_hot_new");
272       resourcePostLockedURL = xprops.getResourceURL("post_locked");
273       resourcePostNewURL = xprops.getResourceURL("post_new");
274       resourceTopicModeDeleteURL = xprops.getResourceURL("topic_mod_delete");
275       resourceTopicModMoveURL = xprops.getResourceURL("topic_mod_move");
276       resourceTopicModLockURL = xprops.getResourceURL("topic_mod_lock");
277       resourceTopicModUnlockURL = xprops.getResourceURL("topic_mod_unlock");
278       resourceTopicModSplitURL = xprops.getResourceURL("topic_mod_split");
279       resourceTopicUnWatchURL = xprops.getResourceURL("topic_un_watch");
280       resourceTopicWatchURL = xprops.getResourceURL("topic_watch");
281       resourceReplyNewURL = xprops.getResourceURL("reply_new");
282       resourceReplyLockedURL = xprops.getResourceURL("reply_locked");
283       resourceIconProfileURL = xprops.getResourceURL("icon_profile");
284       resourceIconPMURL = xprops.getResourceURL("icon_pm");
285       resourceIconEmailURL = xprops.getResourceURL("icon_email");
286       resourceIconWWWURL = xprops.getResourceURL("icon_www");
287       resourceIconICQURL = xprops.getResourceURL("icon_icq");
288       resourceIconAIMURL = xprops.getResourceURL("icon_aim");
289       resourceIconMSNMURL = xprops.getResourceURL("icon_msnm");
290       resourceIconYIMURL = xprops.getResourceURL("icon_yim");
291       resourceIconQuoteURL = xprops.getResourceURL("icon_quote");
292       resourceIconSearchURL = xprops.getResourceURL("icon_search");
293       resourceIconEditURL = xprops.getResourceURL("icon_edit");
294       resourceIconRepostURL = xprops.getResourceURL("icon_repost");
295       resourceIconIPURL = xprops.getResourceURL("icon_ip");
296       resourceIconDelpostURL = xprops.getResourceURL("icon_delpost");
297       resourceIconMinipostURL = xprops.getResourceURL("icon_minipost");
298       resourceIconMinipostNewURL = xprops.getResourceURL("icon_minipost_new");
299       resourceHeadStylesheetURL = xprops.getResourceURL("head_stylesheet");
300
301       //
302
FOLDER_ANNOUNCE =
303          new FolderType(resourceFolderAnnounceURL, resourceFolderAnnounceNewURL, "Topic_Announcement");
304       FOLDER_STICKY = new FolderType(resourceFolderStickyURL, resourceFolderStickyNewURL, "Topic_Sticky");
305       FOLDER_LOCKED = new FolderType(resourceFolderLockedURL, resourceFolderLockedNewURL, "");
306       FOLDER_HOT = new FolderType(resourceFolderHotURL, resourceFolderHotNewURL, "");
307       FOLDER_NORMAL = new FolderType(resourceFolderURL, resourceForumNewURL, "");
308    }
309 }
Popular Tags