List of usage examples for com.liferay.portal.kernel.servlet SessionMessages KEY_SUFFIX_UPDATED_PREFERENCES
String KEY_SUFFIX_UPDATED_PREFERENCES
To view the source code for com.liferay.portal.kernel.servlet SessionMessages KEY_SUFFIX_UPDATED_PREFERENCES.
Click Source Link
From source file:com.liferay.portlet.currencyconverter.action.EditPreferencesAction.java
License:Open Source License
@Override public void processAction(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { String cmd = ParamUtil.getString(actionRequest, Constants.CMD); if (!cmd.equals(Constants.UPDATE)) { return;/* ww w . ja va 2 s . co m*/ } PortletPreferences preferences = actionRequest.getPreferences(); String[] symbols = StringUtil.split(ParamUtil.getString(actionRequest, "symbols").toUpperCase()); preferences.setValues("symbols", symbols); try { preferences.store(); } catch (ValidatorException ve) { SessionErrors.add(actionRequest, ValidatorException.class.getName(), ve); return; } SessionMessages.add(actionRequest, portletConfig.getPortletName() + SessionMessages.KEY_SUFFIX_UPDATED_PREFERENCES); }
From source file:com.liferay.randombibleverse.portlet.RBVPortlet.java
License:Open Source License
@Override public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException, PortletException { PortletMode portletMode = actionRequest.getPortletMode(); if (!portletMode.equals(PortletMode.EDIT)) { return;/*from w w w . j a va 2 s . c o m*/ } String cmd = ParamUtil.getString(actionRequest, Constants.CMD); if (!cmd.equals(Constants.UPDATE)) { return; } String language = ParamUtil.getString(actionRequest, "language"); PortletPreferences preferences = actionRequest.getPreferences(); preferences.setValue("language", language); preferences.store(); LiferayPortletConfig liferayPortletConfig = (LiferayPortletConfig) getPortletConfig(); SessionMessages.add(actionRequest, PortalUtil.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_UPDATED_PREFERENCES); }
From source file:com.liferay.stocks.portlet.StocksPortlet.java
License:Open Source License
protected void updatePreferences(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException, PortletException { String cmd = ParamUtil.getString(actionRequest, Constants.CMD); if (!cmd.equals(Constants.UPDATE)) { return;// www.ja v a 2s . co m } PortletPreferences portletPreferences = null; try { portletPreferences = PortletPreferencesFactoryUtil .getPortletPreferences(PortalUtil.getHttpServletRequest(actionRequest), PortletKeys.STOCKS); } catch (Exception e) { throw new PortletException(e); } String[] symbols = StringUtil.split(StringUtil.toUpperCase(ParamUtil.getString(actionRequest, "symbols")), StringPool.SPACE); Arrays.sort(symbols); portletPreferences.setValues("symbols", symbols); try { portletPreferences.store(); } catch (ValidatorException ve) { SessionErrors.add(actionRequest, ValidatorException.class.getName(), ve); return; } SessionMessages.add(actionRequest, PortalUtil.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_UPDATED_PREFERENCES); }
From source file:com.liferay.weather.portlet.WeatherPortlet.java
License:Open Source License
protected void updatePreferences(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException, PortletException { String cmd = ParamUtil.getString(actionRequest, Constants.CMD); if (!cmd.equals(Constants.UPDATE)) { return;/*from w w w.j a va 2 s .c o m*/ } PortletPreferences preferences = actionRequest.getPreferences(); String[] zips = StringUtil.split(ParamUtil.getString(actionRequest, "zips"), "\n"); boolean fahrenheit = ParamUtil.get(actionRequest, "fahrenheit", true); preferences.setValues("zips", zips); preferences.setValue("fahrenheit", String.valueOf(fahrenheit)); try { preferences.store(); } catch (ValidatorException ve) { SessionErrors.add(actionRequest, ValidatorException.class.getName(), ve); return; } PortletConfig portletConfig = getPortletConfig(); SessionMessages.add(actionRequest, portletConfig.getPortletName() + SessionMessages.KEY_SUFFIX_UPDATED_PREFERENCES); }
From source file:com.rivetlogic.hangouts.portlet.HangoutsPortlet.java
License:Open Source License
public void savePreferences(ActionRequest request, ActionResponse response) throws ReadOnlyException, ValidatorException, IOException { PreferencesBean prefBean = new PreferencesBean(); prefBean.save(request);/*from ww w. j a v a 2 s. c om*/ SessionMessages.add(request, PortalUtil.getPortletId(request) + SessionMessages.KEY_SUFFIX_UPDATED_PREFERENCES); String redirect = getRedirect(request, response); if (Validator.isNotNull(redirect)) { response.sendRedirect(redirect); } }