KickJava   Java API By Example, From Geeks To Geeks.

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


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.Iterator JavaDoc;
19 import java.util.Locale JavaDoc;
20
21 import org.apache.pluto.om.common.DisplayName;
22 import org.apache.pluto.om.common.DisplayNameSet;
23 import org.apache.pluto.util.StringUtils;
24
25 /**
26  *
27  *
28  * @author <a HREF="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
29  *
30  * @version CVS $Id: DisplayNameSetImpl.java 123407 2004-12-27 13:51:59Z cziegeler $
31  */

32 public class DisplayNameSetImpl extends AbstractSupportSet implements DisplayNameSet, java.io.Serializable JavaDoc, Support {
33
34     /* (non-Javadoc)
35      * @see org.apache.pluto.om.common.DisplayNameSet#get(java.util.Locale)
36      */

37     public DisplayName get(Locale JavaDoc locale) {
38         Iterator JavaDoc iterator = this.iterator();
39         while (iterator.hasNext()) {
40             DisplayName displayName = (DisplayName)iterator.next();
41             if (displayName.getLocale().equals(locale)) {
42                 return displayName;
43             }
44         }
45         return null;
46     }
47
48
49     /* (non-Javadoc)
50      * @see org.apache.cocoon.portal.pluto.om.common.Support#postBuild(java.lang.Object)
51      */

52     public void postBuild(Object JavaDoc parameter) throws Exception JavaDoc {
53         // nothing to do
54
}
55
56     public void postLoad(Object JavaDoc parameter) throws Exception JavaDoc {
57         Iterator JavaDoc iterator = this.iterator();
58         while (iterator.hasNext()) {
59             ((DisplayNameImpl) iterator.next()).postLoad(parameter);
60         }
61     }
62
63     /* (non-Javadoc)
64      * @see org.apache.cocoon.portal.pluto.om.common.Support#postStore(java.lang.Object)
65      */

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

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

80     public void preStore(Object JavaDoc parameter) throws Exception JavaDoc {
81         // nothing to do
82
}
83
84     /* (non-Javadoc)
85      * @see java.lang.Object#toString()
86      */

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