001
014
015 package com.liferay.portlet;
016
017 import com.liferay.portal.kernel.portlet.LiferayPortletMode;
018 import com.liferay.portal.kernel.portlet.LiferayWindowState;
019 import com.liferay.portal.kernel.util.ReleaseInfo;
020
021 import java.util.ArrayList;
022 import java.util.Collections;
023 import java.util.Enumeration;
024 import java.util.List;
025 import java.util.Properties;
026
027 import javax.portlet.PortalContext;
028 import javax.portlet.PortletMode;
029 import javax.portlet.WindowState;
030
031
034 public class PortalContextImpl implements PortalContext {
035
036 static Properties properties = new Properties();
037 static List<PortletMode> portletModes = new ArrayList<PortletMode>();
038 static List<WindowState> windowStates = new ArrayList<WindowState>();
039
040 static {
041 properties.setProperty(
042 MARKUP_HEAD_ELEMENT_SUPPORT, Boolean.TRUE.toString());
043
044 portletModes.add(PortletMode.EDIT);
045 portletModes.add(PortletMode.HELP);
046 portletModes.add(PortletMode.VIEW);
047 portletModes.add(LiferayPortletMode.ABOUT);
048 portletModes.add(LiferayPortletMode.CONFIG);
049 portletModes.add(LiferayPortletMode.EDIT_DEFAULTS);
050 portletModes.add(LiferayPortletMode.PREVIEW);
051 portletModes.add(LiferayPortletMode.PRINT);
052
053 windowStates.add(WindowState.MAXIMIZED);
054 windowStates.add(WindowState.MINIMIZED);
055 windowStates.add(WindowState.NORMAL);
056 windowStates.add(LiferayWindowState.EXCLUSIVE);
057 windowStates.add(LiferayWindowState.POP_UP);
058 }
059
060 public static boolean isSupportedPortletMode(PortletMode portletMode) {
061 return portletModes.contains(portletMode);
062 }
063
064 public static boolean isSupportedWindowState(WindowState windowState) {
065 return windowStates.contains(windowState);
066 }
067
068 public String getPortalInfo() {
069 return ReleaseInfo.getReleaseInfo();
070 }
071
072 public String getProperty(String name) {
073 return properties.getProperty(name);
074 }
075
076 public Enumeration<String> getPropertyNames() {
077 return (Enumeration<String>)properties.propertyNames();
078 }
079
080 public Enumeration<PortletMode> getSupportedPortletModes() {
081 return Collections.enumeration(portletModes);
082 }
083
084 public Enumeration<WindowState> getSupportedWindowStates() {
085 return Collections.enumeration(windowStates);
086 }
087
088 }