01: /* PortletModes.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: Tue Jan 11 17:41:30 2005, Created by tomyeh
10: }}IS_NOTE
11:
12: Copyright (C) 2004 Potix Corporation. All Rights Reserved.
13:
14: {{IS_RIGHT
15: This program is distributed under GPL Version 2.0 in the hope that
16: it will be useful, but WITHOUT ANY WARRANTY.
17: }}IS_RIGHT
18: */
19: package org.zkoss.web.portlet;
20:
21: import java.util.Map;
22: import java.util.HashMap;
23:
24: import javax.portlet.PortletMode;
25:
26: /**
27: * Utilities to handles {@link PortletMode}.
28: *
29: * @author tomyeh
30: */
31: public class PortletModes {
32: /** Returns the portlet mode of the specified name.
33: */
34: synchronized public static final PortletMode toPortletMode(
35: String modeName) {
36: PortletMode mode = (PortletMode) _modes.get(modeName);
37: if (mode == null)
38: _modes.put(modeName, mode = new PortletMode(modeName));
39: return mode;
40: }
41:
42: private static final Map _modes = new HashMap(5);
43: static {
44: _modes.put("EDIT", PortletMode.EDIT);
45: _modes.put("HELP", PortletMode.HELP);
46: _modes.put("VIEW", PortletMode.VIEW);
47: }
48: }
|