KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > pluto > portalImpl > om > common > impl > DisplayNameImpl


1 /*
2  * Copyright 2003,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 /*
17
18  */

19
20 package org.apache.pluto.portalImpl.om.common.impl;
21
22 import java.util.Locale JavaDoc;
23
24 import org.apache.pluto.om.common.DisplayName;
25 import org.apache.pluto.portalImpl.om.common.Support;
26 import org.apache.pluto.util.StringUtils;
27
28 public class DisplayNameImpl implements DisplayName, java.io.Serializable JavaDoc, Support {
29
30     private String JavaDoc displayName;
31     private Locale JavaDoc locale; // default locale
32
private String JavaDoc castorLocale;
33
34     public DisplayNameImpl()
35     {
36     }
37
38     // DisplayName implementation.
39
public String JavaDoc getDisplayName()
40     {
41         return displayName;
42     }
43
44     public Locale JavaDoc getLocale()
45     {
46         return locale;
47     }
48
49     // Support implementation.
50

51     public void postLoad(Object JavaDoc parameter) throws Exception JavaDoc
52     {
53         if (castorLocale == null) {
54             locale = Locale.ENGLISH;
55         } else {
56             locale = new Locale JavaDoc(castorLocale, "");
57         }
58     }
59     public void postStore(Object JavaDoc parameter) throws Exception JavaDoc
60     {
61     }
62
63     public void preBuild(Object JavaDoc parameter) throws Exception JavaDoc
64     {
65     }
66
67     public void preStore(Object JavaDoc parameter) throws Exception JavaDoc
68     {
69     }
70
71     /* (non-Javadoc)
72      * @see org.apache.pluto.portalImpl.om.common.Support#postBuild(Object)
73      */

74     public void postBuild(Object JavaDoc parameter) throws Exception JavaDoc {
75     }
76
77     // additional methods.
78
public String JavaDoc toString()
79     {
80         return toString(0);
81     }
82
83     public String JavaDoc toString(int indent)
84     {
85         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc(50);
86         StringUtils.newLine(buffer,indent);
87         buffer.append(getClass().toString());
88         buffer.append(": displayName='");
89         buffer.append(displayName);
90         buffer.append("', locale='");
91         buffer.append(locale);
92         buffer.append("'");
93         return buffer.toString();
94     }
95
96     public void setDisplayName(String JavaDoc displayName)
97     {
98         this.displayName = displayName;
99     }
100
101     public void setLocale(Locale JavaDoc locale)
102     {
103         this.locale = locale;
104     }
105
106     /**
107      * Returns the castorLocale.
108      * @return String
109      */

110     public String JavaDoc getCastorLocale() {
111         return castorLocale;
112     }
113
114     /**
115      * Sets the castorLocale.
116      * @param castorLocale The castorLocale to set
117      */

118     public void setCastorLocale(String JavaDoc castorLocale) {
119         this.castorLocale = castorLocale;
120     }
121 }
122
Popular Tags