public void execute(Event<UIPortlet> event) throws Exception { UIPortlet uiPortlet = event.getSource(); UIPortalApplication uiPortalApp = uiPortlet.getAncestorOfType(UIPortalApplication.class); UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID); PortalRequestContext pcontext = (PortalRequestContext) event.getRequestContext(); pcontext.addUIComponentToUpdateByAjax(uiWorkingWS); pcontext.ignoreAJAXUpdateOnPortlets(true); String windowState = null; Object changeWindowStateAttribute = event.getRequestContext().getAttribute(CHANGE_WINDOW_STATE_EVENT); if (changeWindowStateAttribute != null && changeWindowStateAttribute instanceof String) { windowState = (String) changeWindowStateAttribute; } if (windowState == null) { windowState = event.getRequestContext().getRequestParameter(Constants.PORTAL_WINDOW_STATE); } if (windowState == null) { if (event.getRequestContext().getRequestParameter(UIComponent.OBJECTID) != null) { windowState = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID).trim(); } } if (windowState == null) { windowState = uiPortlet.getCurrentWindowState().toString(); } UIPage uiPage = uiPortlet.getAncestorOfType(UIPage.class); if (windowState.equals(WindowState.MAXIMIZED.toString())) { if (uiPage != null) { uiPage.normalizePortletWindowStates(); uiPage.setMaximizedUIPortlet(uiPortlet); } uiPortlet.setCurrentWindowState(WindowState.MAXIMIZED); return; } else { if (windowState.equals(WindowState.MINIMIZED.toString())) { uiPortlet.setCurrentWindowState(WindowState.MINIMIZED); } else { uiPortlet.setCurrentWindowState(WindowState.NORMAL); } if (uiPage != null) { clearMaximizedUIComponent(uiPage, uiPortlet); } } }
public void execute(final Event<UIPortletForm> event) throws Exception { UIPortletForm uiPortletForm = event.getSource(); UIPortlet uiPortlet = uiPortletForm.getUIPortlet(); UIFormInputIconSelector uiIconSelector = uiPortletForm.getChild(UIFormInputIconSelector.class); uiPortletForm.invokeSetBindingBean(uiPortlet); if (uiIconSelector.getSelectedIcon().equals("Default")) { uiPortlet.setIcon("PortletIcon"); } else { uiPortlet.setIcon(uiIconSelector.getSelectedIcon()); } UIFormInputThemeSelector uiThemeSelector = uiPortletForm.getChild(UIFormInputThemeSelector.class); uiPortlet.putSuitedTheme( null, uiThemeSelector.getChild(UIItemThemeSelector.class).getSelectedTheme()); uiPortletForm.savePreferences(); UIMaskWorkspace uiMaskWorkspace = uiPortletForm.getParent(); PortalRequestContext pcontext = (PortalRequestContext) event.getRequestContext(); uiMaskWorkspace.createEvent("Close", Phase.DECODE, pcontext).broadcast(); if (uiPortletForm.hasEditMode()) { uiPortlet.setCurrentPortletMode(PortletMode.VIEW); } String width = uiPortletForm.getUIStringInput("width").getValue(); if (width == null || width.length() == 0) { uiPortlet.setWidth(null); } else { if (!width.endsWith("px")) { width.concat("px"); } uiPortlet.setWidth(width); } String height = uiPortletForm.getUIStringInput("height").getValue(); if (height == null || height.length() == 0) { uiPortlet.setHeight(null); } else { if (!height.endsWith("px")) { height.concat("px"); } uiPortlet.setHeight(height); } pcontext .getJavascriptManager() .addJavascript("eXo.portal.PortalComposer.toggleSaveButton();"); UIPortalApplication uiPortalApp = uiPortlet.getAncestorOfType(UIPortalApplication.class); UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID); pcontext.addUIComponentToUpdateByAjax(uiWorkingWS); pcontext.ignoreAJAXUpdateOnPortlets(true); }
/** * This method is used to set the next portlet window state if this one needs to be modified * because of the incoming request */ public static void setNextState(UIPortlet uiPortlet, WindowState state) { if (state != null) { UIPage uiPage = uiPortlet.getAncestorOfType(UIPage.class); if (WindowState.MAXIMIZED.equals(state)) { uiPortlet.setCurrentWindowState(WindowState.MAXIMIZED); if (uiPage != null) { uiPage.setMaximizedUIPortlet(uiPortlet); } } else if (WindowState.MINIMIZED.equals(state)) { uiPortlet.setCurrentWindowState(WindowState.MINIMIZED); if (uiPage != null) { uiPage.setMaximizedUIPortlet(null); } } else { uiPortlet.setCurrentWindowState(WindowState.NORMAL); if (uiPage != null) { uiPage.setMaximizedUIPortlet(null); } } } }
public void execute(Event<UIPortlet> event) throws Exception { UIPortlet uiPortlet = event.getSource(); UIPortalApplication uiPortalApp = uiPortlet.getAncestorOfType(UIPortalApplication.class); UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID); PortalRequestContext pcontext = (PortalRequestContext) event.getRequestContext(); pcontext.addUIComponentToUpdateByAjax(uiWorkingWS); pcontext.ignoreAJAXUpdateOnPortlets(true); String windowState = null; Object changeWindowStateAttribute = event.getRequestContext().getAttribute(CHANGE_WINDOW_STATE_EVENT); if (changeWindowStateAttribute != null && changeWindowStateAttribute instanceof String) { windowState = (String) changeWindowStateAttribute; } if (windowState == null) { windowState = event.getRequestContext().getRequestParameter(Constants.PORTAL_WINDOW_STATE); } if (windowState == null) { windowState = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID).trim(); } if (windowState == null) { windowState = uiPortlet.getCurrentWindowState().toString(); } UIPageBody uiPageBody = uiPortlet.getAncestorOfType(UIPageBody.class); UIPage uiPage = uiPortlet.getAncestorOfType(UIPage.class); if (windowState.equals(WindowState.MAXIMIZED.toString())) { if (uiPageBody != null) { uiPortlet.setCurrentWindowState(WindowState.MAXIMIZED); // TODO dang.tung: we have to set maximized portlet for page because in ShowMaxWindow case // the PageBody isn't rendered // reference: UIPortalLifecycle, UIPageLifecycle, renderChildren() in // UIPageBody // --------------------------------------------------------- if (uiPage != null && uiPage.isShowMaxWindow()) { uiPage.setMaximizedUIPortlet(uiPortlet); } // --------------------------------------------------------- uiPageBody.setMaximizedUIComponent(uiPortlet); } else { uiPortlet.setCurrentWindowState(WindowState.NORMAL); } return; } if (uiPageBody != null) { UIPortlet maxPortlet = (UIPortlet) uiPageBody.getMaximizedUIComponent(); if (maxPortlet == uiPortlet) { uiPageBody.setMaximizedUIComponent(null); } } // TODO dang.tung: for ShowMaxWindow situation // ---------------------------------------------------------------- if (uiPage != null) { UIPortlet maxPortlet = (UIPortlet) uiPage.getMaximizedUIPortlet(); if (maxPortlet == uiPortlet) { uiPage.setMaximizedUIPortlet(null); } } // ----------------------------------------------------------------- if (windowState.equals(WindowState.MINIMIZED.toString())) { uiPortlet.setCurrentWindowState(WindowState.MINIMIZED); return; } uiPortlet.setCurrentWindowState(WindowState.NORMAL); }