1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.kernel.portlet;
16  
17  import java.util.HashMap;
18  import java.util.Map;
19  
20  import javax.portlet.WindowState;
21  
22  /**
23   * <a href="WindowStateFactory.java.html"><b><i>View Source</i></b></a>
24   *
25   * @author Brian Wing Shun Chan
26   */
27  public class WindowStateFactory {
28  
29      public static WindowState getWindowState(String name) {
30          return _instance._getWindowState(name);
31      }
32  
33      private WindowStateFactory() {
34          _windowStates = new HashMap<String, WindowState>();
35  
36          _windowStates.put(_NORMAL, LiferayWindowState.NORMAL);
37          _windowStates.put(_MAXIMIZED, LiferayWindowState.MAXIMIZED);
38          _windowStates.put(_MINIMIZED, LiferayWindowState.MINIMIZED);
39          _windowStates.put(_EXCLUSIVE, LiferayWindowState.EXCLUSIVE);
40          _windowStates.put(_POP_UP, LiferayWindowState.POP_UP);
41      }
42  
43      private WindowState _getWindowState(String name) {
44          WindowState windowState = _windowStates.get(name);
45  
46          if (windowState == null) {
47              windowState = new WindowState(name);
48          }
49  
50          return windowState;
51      }
52  
53      private static final String _NORMAL = WindowState.NORMAL.toString();
54  
55      private static final String _MAXIMIZED = WindowState.MAXIMIZED.toString();
56  
57      private static final String _MINIMIZED = WindowState.MINIMIZED.toString();
58  
59      private static final String _EXCLUSIVE =
60          LiferayWindowState.EXCLUSIVE.toString();
61  
62      private static final String _POP_UP = LiferayWindowState.POP_UP.toString();
63  
64      private static WindowStateFactory _instance = new WindowStateFactory();
65  
66      private Map<String, WindowState> _windowStates;
67  
68  }