001
014
015 package com.liferay.portlet.language.action;
016
017 import com.liferay.portal.kernel.portlet.BaseConfigurationAction;
018 import com.liferay.portal.kernel.servlet.SessionMessages;
019 import com.liferay.portal.kernel.util.Constants;
020 import com.liferay.portal.kernel.util.ParamUtil;
021 import com.liferay.portlet.PortletPreferencesFactoryUtil;
022
023 import javax.portlet.ActionRequest;
024 import javax.portlet.ActionResponse;
025 import javax.portlet.PortletConfig;
026 import javax.portlet.PortletPreferences;
027 import javax.portlet.RenderRequest;
028 import javax.portlet.RenderResponse;
029
030
033 public class ConfigurationActionImpl extends BaseConfigurationAction {
034
035 public void processAction(
036 PortletConfig portletConfig, ActionRequest actionRequest,
037 ActionResponse actionResponse)
038 throws Exception {
039
040 String cmd = ParamUtil.getString(actionRequest, Constants.CMD);
041
042 if (!cmd.equals(Constants.UPDATE)) {
043 return;
044 }
045
046 String languageIds = ParamUtil.getString(actionRequest, "languageIds");
047 String displayStyle = ParamUtil.getString(
048 actionRequest, "displayStyle");
049
050 String portletResource = ParamUtil.getString(
051 actionRequest, "portletResource");
052
053 PortletPreferences preferences =
054 PortletPreferencesFactoryUtil.getPortletSetup(
055 actionRequest, portletResource);
056
057 preferences.setValue("language-ids", languageIds);
058 preferences.setValue("display-style", displayStyle);
059
060 preferences.store();
061
062 SessionMessages.add(
063 actionRequest, portletConfig.getPortletName() + ".doConfigure");
064 }
065
066 public String render(
067 PortletConfig portletConfig, RenderRequest renderRequest,
068 RenderResponse renderResponse)
069 throws Exception {
070
071 return "/html/portlet/language/configuration.jsp";
072 }
073
074 }