KickJava   Java API By Example, From Geeks To Geeks.

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


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.Iterator JavaDoc;
23 import java.util.Locale JavaDoc;
24
25 import org.apache.pluto.om.common.DisplayName;
26 import org.apache.pluto.om.common.DisplayNameSet;
27 import org.apache.pluto.portalImpl.om.common.AbstractSupportSet;
28 import org.apache.pluto.portalImpl.om.common.Support;
29 import org.apache.pluto.util.StringUtils;
30
31 public class DisplayNameSetImpl extends AbstractSupportSet implements DisplayNameSet, java.io.Serializable JavaDoc, Support {
32
33     // DisplayNameSet implementation.
34

35     public DisplayName get(Locale JavaDoc locale)
36     {
37         Iterator JavaDoc iterator = this.iterator();
38         while (iterator.hasNext()) {
39             DisplayName displayName = (DisplayName)iterator.next();
40             if (displayName.getLocale().equals(locale)) {
41                 return displayName;
42             }
43         }
44         return null;
45     }
46
47
48     // Support implementation.
49

50     /* (non-Javadoc)
51      * @see org.apache.pluto.portalImpl.om.common.Support#postBuild(Object)
52      */

53     public void postBuild(Object JavaDoc parameter) throws Exception JavaDoc {
54     }
55
56     /* (non-Javadoc)
57      * @see org.apache.pluto.portalImpl.om.common.Support#postLoad(Object)
58      */

59     public void postLoad(Object JavaDoc parameter) throws Exception JavaDoc {
60         Iterator JavaDoc iterator = this.iterator();
61         while (iterator.hasNext()) {
62             ((DisplayNameImpl) iterator.next()).postLoad(parameter);
63         }
64     }
65
66     /* (non-Javadoc)
67      * @see org.apache.pluto.portalImpl.om.common.Support#postStore(Object)
68      */

69     public void postStore(Object JavaDoc parameter) throws Exception JavaDoc {
70     }
71
72     /* (non-Javadoc)
73      * @see org.apache.pluto.portalImpl.om.common.Support#preBuild(Object)
74      */

75     public void preBuild(Object JavaDoc parameter) throws Exception JavaDoc {
76     }
77
78     /* (non-Javadoc)
79      * @see org.apache.pluto.portalImpl.om.common.Support#preStore(Object)
80      */

81     public void preStore(Object JavaDoc parameter) throws Exception JavaDoc {
82     }
83
84     // additional methods.
85

86     public String JavaDoc toString()
87     {
88         return toString(0);
89     }
90
91     public String JavaDoc toString(int indent)
92     {
93         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc(50);
94         StringUtils.newLine(buffer,indent);
95         buffer.append(getClass().toString());
96         buffer.append(": ");
97         Iterator JavaDoc iterator = this.iterator();
98         while (iterator.hasNext()) {
99             buffer.append(((DisplayNameImpl)iterator.next()).toString(indent+2));
100         }
101         return buffer.toString();
102     }
103
104
105 }
106
Popular Tags