KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > jsp > decorator > CmsDecorationBundle


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src/org/opencms/jsp/decorator/CmsDecorationBundle.java,v $
3  * Date : $Date: 2006/03/27 14:52:31 $
4  * Version: $Revision: 1.2 $
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.jsp.decorator;
33
34 import java.util.HashMap JavaDoc;
35 import java.util.Locale JavaDoc;
36 import java.util.Map JavaDoc;
37 import java.util.Set JavaDoc;
38
39 /**
40  * CmsDecorationBundle, contains a map of merged CmsDEcorationMaps.<p>
41  *
42  * The map inside the decoration bundle uses the decoration as keys and CmsDecorationObjects as values.<p>
43  *
44  * A decoration bundle contains either all decoarions for one locale (similar to a resource bundle), or
45  * is locale independend. If its a locale independend bundle, the included locale is set to null.
46  *
47  *
48  * @author Michael Emmerich
49  *
50  * @version $Revision: 1.2 $
51  *
52  * @since 6.1.3
53  */

54 public class CmsDecorationBundle {
55
56     /** The bundle map. */
57     private Map JavaDoc m_bundle;
58
59     /** The locale of this bundle. */
60     private Locale JavaDoc m_locale;
61
62     /**
63      * Constructor, creates a new, empty CmsDecorationBundle.<p>
64      */

65     public CmsDecorationBundle() {
66
67         m_bundle = new HashMap JavaDoc();
68         m_locale = null;
69     }
70
71     /**
72      * Constructor, creates a new CmsDecorationBundle for a given locale.<p>
73      *
74      * @param locale the locale of this bundle or null
75      */

76     public CmsDecorationBundle(Locale JavaDoc locale) {
77
78         m_bundle = new HashMap JavaDoc();
79         m_locale = locale;
80
81     }
82
83     /**
84      * Gets an object from the decoration bundle.<p>
85      * @param key the key of the object ot get
86      * @return the value matching the key or null.
87      */

88     public Object JavaDoc get(Object JavaDoc key) {
89
90         return m_bundle.get(key);
91     }
92
93     /**
94      * Gets the map of all decoarion bundle entries.<p>
95      * @return map of all decoarion bundle entries
96      */

97     public Map JavaDoc getAll() {
98
99         return m_bundle;
100     }
101
102     /**
103      * Gets the locale of this decoration bundle.<p>
104      * @return locale of the decoration bundle
105      */

106     public Locale JavaDoc getLocale() {
107
108         return m_locale;
109     }
110
111     /**
112      * Gets the keyset of the decoration bundle map.<p>
113      * @return keyset of the decoration bundle map
114      */

115     public Set JavaDoc keySet() {
116
117         return m_bundle.keySet();
118     }
119
120     /**
121      * Stores an obiect in the decoration bundle.<p>
122      * @param key the key of the object to store
123      * @param value the value of the object to store
124      */

125     public void put(Object JavaDoc key, Object JavaDoc value) {
126
127         m_bundle.put(key, value);
128     }
129
130     /**
131      * Puts a complete map of objects into bundle.<p>
132      * @param map the map to put into the bundle
133      */

134     public void putAll(Map JavaDoc map) {
135
136         m_bundle.putAll(map);
137     }
138
139     /**
140      * Sets the locale of the decoration bundle.<p>
141      * @param locale the locale to set
142      */

143     public void setLocale(Locale JavaDoc locale) {
144
145         m_locale = locale;
146     }
147 }
148
Popular Tags