Package org.exoplatform.portal.application

Examples of org.exoplatform.portal.application.PortalRequestContext


        }
    }

    public static class CreatePortalActionListener extends EventListener<UIWorkingWorkspace> {
        public void execute(Event<UIWorkingWorkspace> event) throws Exception {
            PortalRequestContext prContext = Util.getPortalRequestContext();
            UIPortalApplication uiApp = event.getSource().getAncestorOfType(UIPortalApplication.class);
            UserACL userACL = uiApp.getApplicationComponent(UserACL.class);
            if (!userACL.hasCreatePortalPermission()) {
                uiApp.addMessage(new ApplicationMessage("UIPortalBrowser.msg.Invalid-createPermission", null));
                return;
            }
            UIMaskWorkspace uiMaskWS = uiApp.getChildById(UIPortalApplication.UI_MASK_WS_ID);
            UIPortalForm uiNewPortal = uiMaskWS.createUIComponent(UIPortalForm.class, "CreatePortal", "UIPortalForm");
            uiNewPortal.initPortalTemplateTab();
            uiMaskWS.setUIComponent(uiNewPortal);
            uiMaskWS.setShow(true);
            prContext.addUIComponentToUpdateByAjax(uiMaskWS);
        }
View Full Code Here


        }
    }

    public abstract static class MoveActionListener extends EventListener<UITabContainer> {
        public void doMove(Event<UITabContainer> event, boolean isToLeft) {
            PortalRequestContext context = (PortalRequestContext) event.getRequestContext();
            UITabContainer container = event.getSource();
            String objectId = event.getRequestContext().getRequestParameter(OBJECTID);
            if (container == null || objectId == null) {
                return;
            }
            container.moveTab(container, objectId, isToLeft);
            context.addUIComponentToUpdateByAjax(container);
            context.ignoreAJAXUpdateOnPortlets(true);
            context.getJavascriptManager().require("SHARED/portalComposer", "portalComposer")
                    .addScripts("portalComposer.toggleSaveButton();");
        }
View Full Code Here

    public static class AddTabActionListener extends EventListener<UITabContainer> {
        @Override
        public void execute(Event<UITabContainer> event) throws Exception {
            UITabContainer container = event.getSource();
            PortalRequestContext pcontext = (PortalRequestContext) event.getRequestContext();
            if (container == null) {
                return;
            }

            List<UIComponent> children = container.getChildren();
            for (UIComponent child : children) {
                if (child.isRendered() && child instanceof UIContainer) {
                    UIContainer newTabContainer = container.addChild(UIContainer.class, null, null);
                    newTabContainer.setTemplate(child.getTemplate());
                    child.setRendered(false);
                    newTabContainer.setRendered(true);
                    newTabContainer.setId(String.valueOf(Math.abs(newTabContainer.hashCode())));
                    pcontext.addUIComponentToUpdateByAjax(container);
                    pcontext.ignoreAJAXUpdateOnPortlets(true);
                    pcontext.getJavascriptManager().require("SHARED/portalComposer", "portalComposer")
                            .addScripts("portalComposer.toggleSaveButton();");
                    return;
                }
            }
        }
View Full Code Here

         * to a separate writer first, then render the UIPortalApplication page as normal, outputting the contents of the
         * separate writer where the child elements should be rendered. Its messy but required for portlet markup header
         * setting.
         */

        PortalRequestContext prc = (PortalRequestContext) context;
        OutputStream responseOutputStream = prc.getResponse().getOutputStream();

        PortalPrinter parentWriter = new PortalPrinter(responseOutputStream, true, 5000);
        PortalPrinter childWriter = new PortalPrinter(responseOutputStream, true, 25000, true);

        context.setWriter(childWriter);
View Full Code Here

     *
     * @param context the context
     */
    public static void updatePortal(PortletRequestContext context) {
        UIPortalApplication portalApplication = Util.getUIPortalApplication();
        PortalRequestContext portalRequestContext = (PortalRequestContext) context.getParentAppRequestContext();
        UIWorkingWorkspace uiWorkingWS = portalApplication.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
        portalRequestContext.addUIComponentToUpdateByAjax(uiWorkingWS);
        portalRequestContext.ignoreAJAXUpdateOnPortlets(true);
    }
View Full Code Here

        UIFormInputThemeSelector uiThemeSelector = new UIFormInputThemeSelector(FIELD_THEME, null);
        SkinService skinService = getApplicationComponent(SkinService.class);
        uiThemeSelector.getChild(UIItemThemeSelector.class).setValues(skinService.getPortletThemes());
        addUIFormInput(uiThemeSelector);

        PortalRequestContext prc = Util.getPortalRequestContext();
        if (prc.getSiteType() != SiteType.USER) {
            UIListPermissionSelector uiListPermissionSelector = createUIComponent(UIListPermissionSelector.class, null, null);
            uiListPermissionSelector.configure(WebuiRequestContext.generateUUID("UIListPermissionSelector"), "accessPermissions");
            uiListPermissionSelector.addValidator(EmptyIteratorValidator.class);
            UIFormInputSet uiPermissionSet = createUIComponent(UIFormInputSet.class, "PortletPermission", null);
            uiPermissionSet.addChild(uiListPermissionSelector);
View Full Code Here

                        dataService.save(page);
                    }
                    break;
                }
            }
            PortalRequestContext pcontext = (PortalRequestContext) event.getRequestContext();
            pcontext.ignoreAJAXUpdateOnPortlets(false);
            pcontext.setResponseComplete(true);
            pcontext.getWriter().write(EventListener.RESULT_OK);
        }
View Full Code Here

        return uiPortlet_.getSupportModes().contains("edit");
    }

    public String getEditModeContent() {
        try {
            PortalRequestContext prcontext = (PortalRequestContext) WebuiRequestContext.getCurrentInstance();
            prcontext.ignoreAJAXUpdateOnPortlets(true);

            PortletInvocation portletInvocation = uiPortlet_.create(RenderInvocation.class, prcontext);
            RenderInvocation renderInvocation = (RenderInvocation) portletInvocation;
            // make sure we are in the EDIT mode, and not whatever the current portlet mode is for the Portlet
            renderInvocation.setMode(Mode.create(PortletMode.EDIT.toString()));
View Full Code Here

    public static class RemoveChildActionListener extends EventListener<UIPage> {
        public void execute(Event<UIPage> event) throws Exception {
            UIPage uiPage = event.getSource();
            String id = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
            PortalRequestContext pcontext = (PortalRequestContext) event.getRequestContext();
            if (uiPage.isModifiable()) {
                uiPage.removeChildById(id);
                Page page = (Page) PortalDataMapper.buildModelObject(uiPage);
                if (page.getChildren() == null) {
                    page.setChildren(new ArrayList<ModelObject>());
                }

                //
                PageService pageService = uiPage.getApplicationComponent(PageService.class);
                PageState pageState = new PageState(page.getTitle(), page.getDescription(), page.isShowMaxWindow(),
                        page.getFactoryId(), page.getAccessPermissions() != null ? Arrays.asList(page.getAccessPermissions())
                                : null, page.getEditPermission());
                pageService.savePage(new PageContext(page.getPageKey(), pageState));

                //
                DataStorage dataService = uiPage.getApplicationComponent(DataStorage.class);
                dataService.save(page);

                //
                pcontext.ignoreAJAXUpdateOnPortlets(false);
                pcontext.setResponseComplete(true);
                pcontext.getWriter().write(EventListener.RESULT_OK);
            } else {
                org.exoplatform.webui.core.UIApplication uiApp = pcontext.getUIApplication();
                uiApp.addMessage(new ApplicationMessage("UIPage.msg.EditPermission.null", null));
            }
        }
View Full Code Here

        publicParameters_ = publicParams;
    }

    public UserNode getNavPath() {
        if (navPath == null) {
            PortalRequestContext prc = Util.getPortalRequestContext();
            navPath = prc.getUserPortalConfig().getUserPortal().getDefaultPath(null);
        }
        return navPath;
    }
View Full Code Here

TOP

Related Classes of org.exoplatform.portal.application.PortalRequestContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.