private JSONObject generateURLJsonObject(RenderResponse renderResponse) throws WindowStateException { JSONObject urlObject = JSONFactoryUtil.createJSONObject(); PortletURL customerRegistrationsDetail = renderResponse.createRenderURL(); customerRegistrationsDetail.setWindowState(LiferayWindowState.EXCLUSIVE); customerRegistrationsDetail.setParameter( "mvcPath", "/templates/registrations_detail.ftl"); urlObject.put("registrations_detail", customerRegistrationsDetail); PortletURL customerRegistrationsMenu = renderResponse.createRenderURL(); customerRegistrationsMenu.setWindowState(LiferayWindowState.EXCLUSIVE); customerRegistrationsMenu.setParameter( "mvcPath", "/templates/registrations_menu.ftl"); urlObject.put("registrations_menu", customerRegistrationsMenu); return urlObject; }
@ProcessAction(name = "editmodule") public void editmodule(ActionRequest request, ActionResponse response) throws Exception { long key = ParamUtil.getLong(request, "resourcePrimKey"); if (Validator.isNotNull(key)) { response.setRenderParameter("moduleId", Long.toString(key)); try { response.setWindowState(LiferayWindowState.POP_UP); } catch (WindowStateException e) { if(log.isDebugEnabled())e.printStackTrace(); if(log.isErrorEnabled())log.error(e.getMessage()); } response.setRenderParameter("view", "editmodule"); response.setRenderParameter("editType", "edit"); } }
@Override public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException { long tid = Thread.currentThread().getId(); portletReq.setAttribute(THREADID_ATTR, tid); PrintWriter writer = portletResp.getWriter(); JSR286ApiTestCaseDetails tcd = new JSR286ApiTestCaseDetails(); // Create result objects for the tests /* TestCase: V2ExceptionTests_WindowStateException_ApiRender_getState */ /* Details: "Method getState(): Returns the WindowState object */ /* causing this exception" */ TestResult tr0 = tcd.getTestResultFailed(V2EXCEPTIONTESTS_WINDOWSTATEEXCEPTION_APIRENDER_GETSTATE); WindowState ws = new WindowState("teststate"); WindowStateException wse = new WindowStateException("Unsupported State Causing Exception", ws); if (wse.getState().toString().equals("teststate")) { tr0.setTcSuccess(true); } tr0.writeTo(writer); }
@Override public void setWindowState(WindowState windowState) throws WindowStateException { if (!CollectionUtils.contains(this.portalContext.getSupportedWindowStates(), windowState)) { throw new WindowStateException("WindowState not supported", windowState); } this.windowState = windowState; }
@Override public void setWindowState(WindowState windowState) throws WindowStateException { if (!CollectionUtils.contains(getPortalContext().getSupportedWindowStates(), windowState)) { throw new WindowStateException("WindowState not supported", windowState); } this.windowState = windowState; }
@Override public void setWindowState(WindowState windowState) throws WindowStateException { if (this.redirectedUrl != null) { throw new IllegalStateException("Cannot set WindowState after sendRedirect has been called"); } super.setWindowState(windowState); this.redirectAllowed = false; }
private String _getOnclick() { PortletURL portletURL = PortletURLFactoryUtil.create( request, "blade_document_action_portlet_BladeDocumentActionPortlet", _themeDisplay.getPlid(), PortletRequest.RENDER_PHASE); String fileName = fileVersion.getFileName(); String mimeType = fileVersion.getMimeType(); String version = fileVersion.getVersion(); String createdDate = fileVersion.getCreateDate().toString(); String createdUserName = fileVersion.getUserName(); String statusLabel = WorkflowConstants.getStatusLabel( fileVersion.getStatus()); portletURL.setParameter("fileName", fileName); portletURL.setParameter("mimeType", mimeType); portletURL.setParameter("version", version); portletURL.setParameter("statusLabel", statusLabel); portletURL.setParameter("createdDate", createdDate); portletURL.setParameter("createdUserName", createdUserName); try { portletURL.setWindowState(LiferayWindowState.POP_UP); } catch (WindowStateException wse) { _log.error(wse); } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("Liferay.Util.openWindow({"); stringBuilder.append("dialog: {cache: false,width:800,modal: true},"); stringBuilder.append("title: 'basic information',id: "); stringBuilder.append("'testPopupIdUnique',uri: '"); stringBuilder.append(portletURL.toString() + "'});"); return stringBuilder.toString(); }
public static void setWindowStateRenderParameter(ActionResponse actionResponse,WindowState winState) throws WindowStateException { actionResponse.setWindowState(winState); actionResponse.setRenderParameter("p_p_state", winState.toString()); // En teor�a el par�metro windowState del actionURL deber�a ser suficiente, // y el setWindowState deber�a ser una in�til reiteraci�n, pero aun as� // lo �nico que funciona es poner A PELO el p_p_state, o hago algo mal o es penoso en fin... }
public static String setPortletURLBack(ThemeDisplay themeDisplay,String backURL) throws WindowStateException { String jsBackURL; if (backURL != null) jsBackURL = "window.location.href='" + backURL + "'"; else jsBackURL = "window.history.go(-1)"; themeDisplay.getPortletDisplay().setURLBack("javascript:" + jsBackURL); return jsBackURL; // Como JavaScript }
public void deleteActivityBank(ActionRequest actionRequest, ActionResponse actionResponse) throws PortalException, SystemException, IOException, WindowStateException{ long actId = ParamUtil.getLong(actionRequest, "resId", 0); AssetEntry assetEntry = AssetEntryLocalServiceUtil.getEntry("com.liferay.lms.model.LearningActivity", actId); assetEntry.setVisible(false); AssetEntryLocalServiceUtil.updateAssetEntry(assetEntry); }
@ProcessAction(name = "newmodule") public void newmodule(ActionRequest request, ActionResponse response) { response.setRenderParameter("view", "editmodule"); try { response.setWindowState(LiferayWindowState.POP_UP); } catch (WindowStateException e) { if(log.isDebugEnabled())e.printStackTrace(); if(log.isErrorEnabled())log.error(e.getMessage()); } response.setRenderParameter("moduleId", "0"); response.setRenderParameter("editType", "add"); }
public void setWindowState(WindowState windowState) throws WindowStateException { if (this.redirectedUrl != null) { throw new IllegalStateException("Cannot set WindowState after sendRedirect has been called"); } super.setWindowState(windowState); this.redirectAllowed = false; }
@Override public void setWindowState(WindowState windowState) throws WindowStateException { String meth = "setWindowState"; Object[] args = { windowState }; checkArgs(meth, args); return; }
public void setWindowState(WindowState windowState) throws WindowStateException { ArgumentUtility.validateNotNull("windowState", windowState); if (isWindowStateAllowed(windowState)) { checkSetStateChanged(); responseContext.setWindowState(windowState); } else { throw new WindowStateException("Can't set this WindowState", windowState); } }
public void setWindowState(WindowState windowState) throws WindowStateException { ArgumentUtility.validateNotNull("windowState", windowState); if (isWindowStateAllowed(windowState)) { urlProvider.setWindowState(windowState); } else { throw new WindowStateException("Can't set this WindowState", windowState); } }
public String getURL( PortletRequest portletRequest, PortletResponse portletResponse) { HttpServletRequest servletRequest = _portal.getHttpServletRequest( portletRequest); ThemeDisplay themeDisplay = (ThemeDisplay)portletRequest.getAttribute( WebKeys.THEME_DISPLAY); FileEntry fileEntry = _retrieveFile(servletRequest); PortletURL portletURL = PortletURLFactoryUtil.create( servletRequest, "blade_document_action_portlet_BladeDocumentActionPortlet", themeDisplay.getPlid(), PortletRequest.RENDER_PHASE); String fileName = fileEntry.getFileName(); String mimeType = fileEntry.getMimeType(); String version = fileEntry.getVersion(); String createdDate = fileEntry.getCreateDate().toString(); String createdUserName = fileEntry.getUserName(); String statusLabel = null; try { statusLabel = WorkflowConstants.getStatusLabel( fileEntry.getLatestFileVersion().getStatus()); } catch (PortalException pe) { _log.error(pe); } portletURL.setParameter("fileName", fileName); portletURL.setParameter("mimeType", mimeType); portletURL.setParameter("version", version); portletURL.setParameter("statusLabel", statusLabel); portletURL.setParameter("createdDate", createdDate); portletURL.setParameter("createdUserName", createdUserName); try { portletURL.setWindowState(LiferayWindowState.POP_UP); } catch (WindowStateException wse) { _log.error(wse); } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("javascript:Liferay.Util.openWindow("); stringBuilder.append("{dialog: {cache: false,width:800,modal: true},"); stringBuilder.append("title: 'basic information',id: "); stringBuilder.append("'testPopupIdUnique',uri: '"); stringBuilder.append(portletURL.toString() + "'});"); return stringBuilder.toString(); }
public static void copyRequestToRenderParameters(ActionRequest actionRequest,ActionResponse actionResponse) throws WindowStateException { copyRequestToRenderParameters(actionRequest,null,null,actionResponse); }
public void setWindowState(WindowState windowState) throws WindowStateException { if (!CollectionUtils.contains(this.portalContext.getSupportedWindowStates(), windowState)) { throw new WindowStateException("WindowState not supported", windowState); } this.windowState = windowState; }
public void setWindowState(WindowState windowState) throws WindowStateException { if (!CollectionUtils.contains(getPortalContext().getSupportedWindowStates(), windowState)) { throw new WindowStateException("WindowState not supported", windowState); } this.windowState = windowState; }
@Override public void setWindowState(WindowState windowState) throws WindowStateException { ((PortletURL)wrapped).setWindowState(windowState); }
public void setWindowState(WindowState windowState) throws WindowStateException { ((StateAwareResponse)response).setWindowState(windowState); }
@Override public void setWindowState(WindowState windowState) throws WindowStateException { ((MutableRenderState)wrapped).setWindowState(windowState); }
@Override public void setWindowState(WindowState arg0) throws WindowStateException { }