KickJava   Java API By Example, From Geeks To Geeks.

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


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.Description;
26 import org.apache.pluto.om.common.DescriptionSet;
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 DescriptionSetImpl extends AbstractSupportSet implements DescriptionSet, java.io.Serializable JavaDoc, Support {
32
33     // DescriptionSet implemenation.
34
public Description get(Locale JavaDoc locale)
35     {
36         Iterator JavaDoc iterator = this.iterator();
37         while (iterator.hasNext()) {
38             Description desc = (Description)iterator.next();
39             if (desc.getLocale().equals(locale)) {
40                 return desc;
41             }
42         }
43         return null;
44     }
45
46     // Support implementation.
47

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

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

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

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

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

79     public void preStore(Object JavaDoc parameter) throws Exception JavaDoc {
80     }
81
82     // additional methods
83

84
85     public String JavaDoc toString()
86     {
87         return toString(0);
88     }
89
90     public String JavaDoc toString(int indent)
91     {
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(((DescriptionImpl)iterator.next()).toString(indent+2));
99         }
100         return buffer.toString();
101     }
102
103 }
104
Popular Tags