1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.om.window.impl;
18
19 import java.io.Serializable;
20 import java.util.HashMap;
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 import org.apache.pluto.om.common.ObjectID;
25
26 /***
27 * Portlet Window List implementation
28 *
29 * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
30 * @version $Id: PortletWindowListImpl.java 516448 2007-03-09 16:25:47Z ate $
31 */
32 public class PortletWindowListImpl implements PortletWindowList, PortletWindowListCtrl, Serializable
33 {
34
35 HashMap windows = null;
36
37 public PortletWindowListImpl()
38 {
39 windows = new HashMap();
40 }
41
42 /***
43 * Returns the elements of this set
44 *
45 * @return An iterator containg all elements
46 */
47 public java.util.Iterator iterator()
48 {
49 return windows.values().iterator();
50 }
51
52 /***
53 * Returns the portlet window object of the given id
54 *
55 * @param
56 *
57 * @return the portlet window object or null if the list does not
58 * contain a portlet window with the given id
59 **/
60 public PortletWindow get(ObjectID id)
61 {
62 return (PortletWindow) windows.get(id.toString());
63 }
64
65 /***
66 * Add a portlet window to the list
67 *
68 * @param window the porlet window to add
69 **/
70 public void add(PortletWindow window)
71 {
72 if (window != null)
73 {
74 windows.put(window.getId().toString(), window);
75 }
76 }
77
78 /***
79 * Remove the portlet window with the given Id from the list
80 *
81 * @param id the Id of the portlet window which should be removed
82 **/
83 public void remove(ObjectID id)
84 {
85 if (id != null)
86 {
87 windows.remove(id.toString());
88 }
89 }
90 }