KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > i18n > A_CmsMessageBundle


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src/org/opencms/i18n/A_CmsMessageBundle.java,v $
3  * Date : $Date: 2006/04/28 15:20:52 $
4  * Version: $Revision: 1.52 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * For further information about Alkacon Software GmbH, please see the
22  * company website: http://www.alkacon.com
23  *
24  * For further information about OpenCms, please see the
25  * project website: http://www.opencms.org
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */

31
32 package org.opencms.i18n;
33
34 import java.util.Locale JavaDoc;
35
36 /**
37  * Convenience base class to access the localized messages of an OpenCms package.<p>
38  *
39  * @author Alexander Kandzior
40  *
41  * @version $Revision: 1.52 $
42  *
43  * @since 6.0.0
44  */

45 public abstract class A_CmsMessageBundle implements I_CmsMessageBundle {
46
47     /**
48      * Returns an array of all messages bundles used by the OpenCms core.<p>
49      *
50      * @return an array of all messages bundles used by the OpenCms core
51      */

52     public static I_CmsMessageBundle[] getOpenCmsMessageBundles() {
53
54         return new I_CmsMessageBundle[] {
55             org.opencms.cache.Messages.get(),
56             org.opencms.configuration.Messages.get(),
57             org.opencms.db.Messages.get(),
58             org.opencms.db.generic.Messages.get(),
59             org.opencms.file.Messages.get(),
60             org.opencms.file.collectors.Messages.get(),
61             org.opencms.file.types.Messages.get(),
62             org.opencms.flex.Messages.get(),
63             org.opencms.i18n.Messages.get(),
64             org.opencms.importexport.Messages.get(),
65             org.opencms.jsp.Messages.get(),
66             org.opencms.jsp.util.Messages.get(),
67             org.opencms.loader.Messages.get(),
68             org.opencms.lock.Messages.get(),
69             org.opencms.mail.Messages.get(),
70             org.opencms.main.Messages.get(),
71             org.opencms.module.Messages.get(),
72             org.opencms.monitor.Messages.get(),
73             org.opencms.report.Messages.get(),
74             org.opencms.scheduler.Messages.get(),
75             org.opencms.scheduler.jobs.Messages.get(),
76             org.opencms.search.Messages.get(),
77             org.opencms.search.documents.Messages.get(),
78             org.opencms.security.Messages.get(),
79             org.opencms.setup.Messages.get(),
80             org.opencms.setup.xml.Messages.get(),
81             org.opencms.site.Messages.get(),
82             org.opencms.staticexport.Messages.get(),
83             org.opencms.synchronize.Messages.get(),
84             org.opencms.util.Messages.get(),
85             org.opencms.validation.Messages.get(),
86             org.opencms.widgets.Messages.get(),
87             org.opencms.workflow.Messages.get(),
88             org.opencms.workplace.Messages.get(),
89             org.opencms.workplace.commons.Messages.get(),
90             org.opencms.workplace.comparison.Messages.get(),
91             org.opencms.workplace.editors.Messages.get(),
92             org.opencms.workplace.explorer.Messages.get(),
93             org.opencms.workplace.galleries.Messages.get(),
94             org.opencms.workplace.list.Messages.get(),
95             org.opencms.workplace.threads.Messages.get(),
96             org.opencms.workplace.tools.Messages.get(),
97             org.opencms.xml.Messages.get(),
98             org.opencms.xml.content.Messages.get(),
99             org.opencms.xml.page.Messages.get(),
100             org.opencms.xml.types.Messages.get()};
101     }
102
103     /**
104      * @see org.opencms.i18n.I_CmsMessageBundle#container(java.lang.String)
105      */

106     public CmsMessageContainer container(String JavaDoc key) {
107
108         return container(key, null);
109     }
110
111     /**
112      * @see org.opencms.i18n.I_CmsMessageBundle#container(java.lang.String, java.lang.Object)
113      */

114     public CmsMessageContainer container(String JavaDoc key, Object JavaDoc arg0) {
115
116         return container(key, new Object JavaDoc[] {arg0});
117     }
118
119     /**
120      * @see org.opencms.i18n.I_CmsMessageBundle#container(java.lang.String, java.lang.Object, java.lang.Object)
121      */

122     public CmsMessageContainer container(String JavaDoc key, Object JavaDoc arg0, Object JavaDoc arg1) {
123
124         return container(key, new Object JavaDoc[] {arg0, arg1});
125     }
126
127     /**
128      * @see org.opencms.i18n.I_CmsMessageBundle#container(java.lang.String, java.lang.Object, java.lang.Object, java.lang.Object)
129      */

130     public CmsMessageContainer container(String JavaDoc key, Object JavaDoc arg0, Object JavaDoc arg1, Object JavaDoc arg2) {
131
132         return container(key, new Object JavaDoc[] {arg0, arg1, arg2});
133     }
134
135     /**
136      * @see org.opencms.i18n.I_CmsMessageBundle#container(java.lang.String, java.lang.Object[])
137      */

138     public CmsMessageContainer container(String JavaDoc message, Object JavaDoc[] args) {
139
140         return new CmsMessageContainer(this, message, args);
141     }
142
143     /**
144      * @see org.opencms.i18n.I_CmsMessageBundle#getBundle()
145      */

146     public CmsMessages getBundle() {
147
148         Locale JavaDoc locale = CmsLocaleManager.getDefaultLocale();
149         if (locale == null) {
150             locale = Locale.getDefault();
151         }
152         return getBundle(locale);
153     }
154
155     /**
156      * @see org.opencms.i18n.I_CmsMessageBundle#getBundle(java.util.Locale)
157      */

158     public CmsMessages getBundle(Locale JavaDoc locale) {
159
160         return new CmsMessages(getBundleName(), locale);
161     }
162
163     /**
164      * @see java.lang.Object#toString()
165      */

166     public String JavaDoc toString() {
167
168         StringBuffer JavaDoc result = new StringBuffer JavaDoc();
169
170         result.append('[');
171         result.append(this.getClass().getName());
172         result.append(", bundle: ");
173         result.append(getBundle());
174         result.append(']');
175
176         return result.toString();
177     }
178 }
Popular Tags