KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > portal > pluto > om > PortletWindowListImpl


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;
17
18 import java.util.HashMap JavaDoc;
19
20 import org.apache.pluto.om.common.ObjectID;
21 import org.apache.pluto.om.window.PortletWindow;
22 import org.apache.pluto.om.window.PortletWindowList;
23 import org.apache.pluto.om.window.PortletWindowListCtrl;
24
25 /**
26  *
27  *
28  * @author <a HREF="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
29  *
30  * @version CVS $Id: PortletWindowListImpl.java 123407 2004-12-27 13:51:59Z cziegeler $
31  */

32 public class PortletWindowListImpl implements PortletWindowList, PortletWindowListCtrl {
33
34     
35     private final HashMap JavaDoc windows;
36
37     public PortletWindowListImpl() {
38         windows = new HashMap JavaDoc();
39     }
40
41     // PortletWindowList implementation.
42

43     /**
44      * Returns the elements of this set
45      *
46      * @return An iterator containg all elements
47      */

48     public java.util.Iterator JavaDoc iterator() {
49
50         return windows.values().iterator();
51     }
52
53
54     /**
55      * Returns the portlet window object of the given id
56      *
57      * @param id id of the portlet window object
58      *
59      * @return the portlet window object or null if the list does not
60      * contain a portlet window with the given id
61      **/

62     public PortletWindow get(ObjectID id) {
63         return (PortletWindow)windows.get(id.toString());
64     }
65
66     // PortletWindowListCtrl implementation.
67

68     /**
69      * Add a portlet window to the list
70      *
71      * @param window the porlet window to add
72      **/

73     public void add(PortletWindow window) {
74         if(window != null) {
75             windows.put(window.getId().toString(), window);
76         }
77     }
78
79     /**
80      * Remove the portlet window with the given Id from the list
81      *
82      * @param id the Id of the portlet window which should be removed
83      **/

84     public void remove(ObjectID id){
85         if(id != null) {
86             windows.remove(id.toString());
87         }
88     }
89 }
90
Popular Tags