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