KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > portal > pluto > om > common > DisplayNameImpl


1 /*
2  * Copyright 2004,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not 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.
15  */

16 package org.apache.cocoon.portal.pluto.om.common;
17
18 import java.util.Locale JavaDoc;
19
20 import org.apache.pluto.om.common.DisplayName;
21 import org.apache.pluto.util.StringUtils;
22
23 /**
24  *
25  *
26  * @author <a HREF="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
27  *
28  * @version CVS $Id: DisplayNameImpl.java 123407 2004-12-27 13:51:59Z cziegeler $
29  */

30 public class DisplayNameImpl implements DisplayName, java.io.Serializable JavaDoc, Support {
31
32     private String JavaDoc displayName;
33     private Locale JavaDoc locale; // default locale
34
private String JavaDoc castorLocale;
35
36     public DisplayNameImpl() {
37         // nothing to do
38
}
39
40     /* (non-Javadoc)
41      * @see org.apache.pluto.om.common.DisplayName#getDisplayName()
42      */

43     public String JavaDoc getDisplayName() {
44         return displayName;
45     }
46
47     /* (non-Javadoc)
48      * @see org.apache.pluto.om.common.DisplayName#getLocale()
49      */

50     public Locale JavaDoc getLocale() {
51         return locale;
52     }
53
54     /* (non-Javadoc)
55      * @see org.apache.cocoon.portal.pluto.om.common.Support#postLoad(java.lang.Object)
56      */

57     public void postLoad(Object JavaDoc parameter) throws Exception JavaDoc {
58         if (castorLocale == null) {
59             locale = Locale.ENGLISH;
60         } else {
61             locale = new Locale JavaDoc(castorLocale, "");
62         }
63     }
64     /* (non-Javadoc)
65      * @see org.apache.cocoon.portal.pluto.om.common.Support#postStore(java.lang.Object)
66      */

67     public void postStore(Object JavaDoc parameter) throws Exception JavaDoc {
68         // nothing to do
69
}
70
71     /* (non-Javadoc)
72      * @see org.apache.cocoon.portal.pluto.om.common.Support#preBuild(java.lang.Object)
73      */

74     public void preBuild(Object JavaDoc parameter) throws Exception JavaDoc {
75         // nothing to do
76
}
77
78     /* (non-Javadoc)
79      * @see org.apache.cocoon.portal.pluto.om.common.Support#preStore(java.lang.Object)
80      */

81     public void preStore(Object JavaDoc parameter) throws Exception JavaDoc {
82         // nothing to do
83
}
84
85     /* (non-Javadoc)
86      * @see org.apache.cocoon.portal.pluto.om.common.Support#postBuild(java.lang.Object)
87      */

88     public void postBuild(Object JavaDoc parameter) throws Exception JavaDoc {
89         // nothing to do
90
}
91
92     /* (non-Javadoc)
93      * @see java.lang.Object#toString()
94      */

95     public String JavaDoc toString() {
96         return toString(0);
97     }
98
99     public String JavaDoc toString(int indent) {
100         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc(50);
101         StringUtils.newLine(buffer,indent);
102         buffer.append(getClass().toString());
103         buffer.append(": displayName='");
104         buffer.append(displayName);
105         buffer.append("', locale='");
106         buffer.append(locale);
107         buffer.append("'");
108         return buffer.toString();
109     }
110
111     public void setDisplayName(String JavaDoc displayName) {
112         this.displayName = displayName;
113     }
114
115     public void setLocale(Locale JavaDoc locale) {
116         this.locale = locale;
117     }
118
119     /**
120      * Returns the castorLocale.
121      * @return String
122      */

123     public String JavaDoc getCastorLocale() {
124         return castorLocale;
125     }
126
127     /**
128      * Sets the castorLocale.
129      * @param castorLocale The castorLocale to set
130      */

131     public void setCastorLocale(String JavaDoc castorLocale) {
132         this.castorLocale = castorLocale;
133     }
134 }
135
Popular Tags