View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    * 
9    *      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  {
27      private String characterEncoding;
28      private Map pwnStates = new HashMap();
29      private PortletWindow maximizedWindow;
30      private PortletWindow actionWindow;
31      private PortletWindow resourceWindow;
32      
33      public PortletWindowRequestNavigationalStates(String characterEncoding)
34      {
35          this.characterEncoding = characterEncoding;
36      }
37      
38      public String getCharacterEncoding()
39      {
40          return characterEncoding;
41      }
42      
43      public Iterator getWindowIdIterator()
44      {
45          return pwnStates.keySet().iterator();
46      }
47      
48      public void removePortletWindowNavigationalState(String windowId)
49      {        
50          boolean removed = pwnStates.remove(windowId) != null;
51          if (removed)
52          {
53              if (maximizedWindow != null && windowId.equals(maximizedWindow.getId().toString()))
54              {
55                  maximizedWindow = null;
56              }
57              if (actionWindow != null && windowId.equals(actionWindow.getId().toString()))
58              {
59                  actionWindow = null;
60              }
61              if (resourceWindow != null && windowId.equals(actionWindow.getId().toString()))
62              {
63                  resourceWindow = null;
64              }
65          }
66      }
67      
68      public PortletWindowRequestNavigationalState getPortletWindowNavigationalState(String windowId)
69      {
70          return (PortletWindowRequestNavigationalState)pwnStates.get(windowId);
71      }
72      
73      public void addPortletWindowNavigationalState(String windowId, PortletWindowRequestNavigationalState pwnState)
74      {
75          pwnStates.put(windowId, pwnState);
76      }
77      
78      public PortletWindow getMaximizedWindow()
79      {
80          return maximizedWindow;
81      }
82      
83      public void setMaximizedWindow(PortletWindow maximizedWindow)
84      {
85          this.maximizedWindow = maximizedWindow;
86      }
87  
88      public PortletWindow getActionWindow()
89      {
90          return actionWindow;
91      }
92      public void setActionWindow(PortletWindow actionWindow)
93      {
94          this.actionWindow = actionWindow;
95      }
96      public void setResourceWindow(PortletWindow resourceWindow)
97      {
98          this.resourceWindow = resourceWindow;
99      }
100     public PortletWindow getResourceWindow()
101     {
102         return resourceWindow;
103     }
104 }