01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.jetspeed.container.state.impl;
18:
19: import java.util.HashMap;
20: import java.util.Iterator;
21: import java.util.Map;
22:
23: import org.apache.pluto.om.window.PortletWindow;
24:
25: public class PortletWindowRequestNavigationalStates {
26: private String characterEncoding;
27: private Map pwnStates = new HashMap();
28: private PortletWindow maximizedWindow;
29: private PortletWindow actionWindow;
30: private PortletWindow resourceWindow;
31:
32: public PortletWindowRequestNavigationalStates(
33: String characterEncoding) {
34: this .characterEncoding = characterEncoding;
35: }
36:
37: public String getCharacterEncoding() {
38: return characterEncoding;
39: }
40:
41: public Iterator getWindowIdIterator() {
42: return pwnStates.keySet().iterator();
43: }
44:
45: public void removePortletWindowNavigationalState(String windowId) {
46: boolean removed = pwnStates.remove(windowId) != null;
47: if (removed) {
48: if (maximizedWindow != null
49: && windowId.equals(maximizedWindow.getId()
50: .toString())) {
51: maximizedWindow = null;
52: }
53: if (actionWindow != null
54: && windowId.equals(actionWindow.getId().toString())) {
55: actionWindow = null;
56: }
57: if (resourceWindow != null
58: && windowId.equals(actionWindow.getId().toString())) {
59: resourceWindow = null;
60: }
61: }
62: }
63:
64: public PortletWindowRequestNavigationalState getPortletWindowNavigationalState(
65: String windowId) {
66: return (PortletWindowRequestNavigationalState) pwnStates
67: .get(windowId);
68: }
69:
70: public void addPortletWindowNavigationalState(String windowId,
71: PortletWindowRequestNavigationalState pwnState) {
72: pwnStates.put(windowId, pwnState);
73: }
74:
75: public PortletWindow getMaximizedWindow() {
76: return maximizedWindow;
77: }
78:
79: public void setMaximizedWindow(PortletWindow maximizedWindow) {
80: this .maximizedWindow = maximizedWindow;
81: }
82:
83: public PortletWindow getActionWindow() {
84: return actionWindow;
85: }
86:
87: public void setActionWindow(PortletWindow actionWindow) {
88: this .actionWindow = actionWindow;
89: }
90:
91: public void setResourceWindow(PortletWindow resourceWindow) {
92: this .resourceWindow = resourceWindow;
93: }
94:
95: public PortletWindow getResourceWindow() {
96: return resourceWindow;
97: }
98: }
|