1
14
15 package com.liferay.portlet.language.action;
16
17 import com.liferay.portal.kernel.portlet.BaseConfigurationAction;
18 import com.liferay.portal.kernel.servlet.SessionMessages;
19 import com.liferay.portal.kernel.util.Constants;
20 import com.liferay.portal.kernel.util.ParamUtil;
21 import com.liferay.portlet.PortletPreferencesFactoryUtil;
22
23 import javax.portlet.ActionRequest;
24 import javax.portlet.ActionResponse;
25 import javax.portlet.PortletConfig;
26 import javax.portlet.PortletPreferences;
27 import javax.portlet.RenderRequest;
28 import javax.portlet.RenderResponse;
29
30
35 public class ConfigurationActionImpl extends BaseConfigurationAction {
36
37 public void processAction(
38 PortletConfig portletConfig, ActionRequest actionRequest,
39 ActionResponse actionResponse)
40 throws Exception {
41
42 String cmd = ParamUtil.getString(actionRequest, Constants.CMD);
43
44 if (!cmd.equals(Constants.UPDATE)) {
45 return;
46 }
47
48 String languageIds = ParamUtil.getString(actionRequest, "languageIds");
49 String displayStyle = ParamUtil.getString(
50 actionRequest, "displayStyle");
51
52 String portletResource = ParamUtil.getString(
53 actionRequest, "portletResource");
54
55 PortletPreferences preferences =
56 PortletPreferencesFactoryUtil.getPortletSetup(
57 actionRequest, portletResource);
58
59 preferences.setValue("language-ids", languageIds);
60 preferences.setValue("display-style", displayStyle);
61
62 preferences.store();
63
64 SessionMessages.add(
65 actionRequest, portletConfig.getPortletName() + ".doConfigure");
66 }
67
68 public String render(
69 PortletConfig portletConfig, RenderRequest renderRequest,
70 RenderResponse renderResponse)
71 throws Exception {
72
73 return "/html/portlet/language/configuration.jsp";
74 }
75
76 }