Package org.exoplatform.portal.webui.workspace

Examples of org.exoplatform.portal.webui.workspace.UIPortalApplication


     * It places the form in the portal black mask
     */
    public static class EditPortletActionListener extends EventListener<UIPortlet> {
        public void execute(Event<UIPortlet> event) throws Exception {
            UIPortlet uiPortlet = event.getSource();
            UIPortalApplication uiApp = Util.getUIPortalApplication();
            UIMaskWorkspace uiMaskWS = uiApp.getChildById(UIPortalApplication.UI_MASK_WS_ID);
            UIPortletForm uiPortletForm = uiMaskWS.createUIComponent(UIPortletForm.class, null, null);

            if (uiPortletForm.setValues(uiPortlet) == false) {
                uiMaskWS.setUIComponent(null);
                WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
View Full Code Here


    public void setBindingBean() throws Exception {

        DataStorage dataStorage = this.getApplicationComponent(DataStorage.class);

        UIPortal editPortal = null;
        UIPortalApplication uiPortalApp = Util.getUIPortalApplication();
        UIEditInlineWorkspace uiEditWS = uiPortalApp.<UIWorkingWorkspace> getChildById(UIPortalApplication.UI_WORKING_WS_ID)
                .getChild(UIEditInlineWorkspace.class);
        if (uiPortalApp.getModeState() != UIPortalApplication.NORMAL_MODE && uiEditWS != null
                && uiEditWS.getUIComponent() != null && (uiEditWS.getUIComponent() instanceof UIPortal)) {
            editPortal = (UIPortal) uiEditWS.getUIComponent();
        } else {
            PortalConfig pConfig = dataStorage.getPortalConfig(getPortalOwner());
            editPortal = this.createUIComponent(UIPortal.class, null, null);
View Full Code Here

            // get navigation id
            String ownerId = event.getRequestContext().getRequestParameter(OBJECTID);
            ownerId = URLDecoder.decode(ownerId);

            UIPortalApplication uiPortalApp = Util.getUIPortal().getAncestorOfType(UIPortalApplication.class);

            // ensure this navigation does not exist
            NavigationService navigationService = uicomp.getApplicationComponent(NavigationService.class);
            NavigationContext navigation = navigationService.loadNavigation(SiteKey.group(ownerId));
            if (navigation != null && navigation.getState() != null) {
                uiPortalApp.addMessage(new ApplicationMessage("UIPageNavigationForm.msg.existPageNavigation",
                        new String[] { ownerId }));
            } else {
                // Create portal config of the group when it does not exist
                DataStorage dataService = uicomp.getApplicationComponent(DataStorage.class);
                if (dataService.getPortalConfig("group", ownerId) == null) {
                    UserPortalConfigService configService = uicomp.getApplicationComponent(UserPortalConfigService.class);
                    configService.createGroupSite(ownerId);
                }

                // create navigation for group
                SiteKey key = SiteKey.group(ownerId);
                NavigationContext existing = navigationService.loadNavigation(key);
                if (existing == null) {
                    navigationService.saveNavigation(new NavigationContext(key, new NavigationState(0)));
                }
            }

            // Update group navigation list
            ctx.addUIComponentToUpdateByAjax(uicomp);

            UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChild(UIWorkingWorkspace.class);
            uiWorkingWS.updatePortletsByName("GroupNavigationPortlet");
            uiWorkingWS.updatePortletsByName("UserToolbarGroupPortlet");
        }
View Full Code Here

            UIPortalForm uiForm = event.getSource();

            DataStorage dataService = uiForm.getApplicationComponent(DataStorage.class);
            UserACL acl = uiForm.getApplicationComponent(UserACL.class);
            PortalRequestContext prContext = Util.getPortalRequestContext();
            UIPortalApplication uiPortalApp = (UIPortalApplication) prContext.getUIApplication();

            PortalConfig pConfig = dataService.getPortalConfig(uiForm.getPortalOwner());
            if (pConfig != null && acl.hasPermission(pConfig)) {
                UIPortal uiPortal = uiForm.createUIComponent(UIPortal.class, null, null);
                PortalDataMapper.toUIPortal(uiPortal, pConfig);

                uiForm.invokeSetBindingBean(uiPortal);
                // uiPortal.refreshNavigation(localeConfigService.getLocaleConfig(uiPortal.getLocale()).getLocale()) ;
                if (uiPortalApp.getModeState() == UIPortalApplication.NORMAL_MODE) {
                    PortalConfig portalConfig = (PortalConfig) PortalDataMapper.buildModelObject(uiPortal);
                    dataService.save(portalConfig);
                    UserPortalConfigService service = uiForm.getApplicationComponent(UserPortalConfigService.class);
                    if (prContext.getPortalOwner().equals(uiForm.getPortalOwner())) {
                        prContext.setUserPortalConfig(service.getUserPortalConfig(uiForm.getPortalOwner(),
                                prContext.getRemoteUser(), PortalRequestContext.USER_PORTAL_CONTEXT));
                        uiPortalApp.reloadPortalProperties();
                    }

                    // We should use IPC to update some portlets in the future instead of
                    UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChild(UIWorkingWorkspace.class);

                    // TODO: Raise Portlet Event instead
                    uiWorkingWS.updatePortletsByName("PortalNavigationPortlet");
                    uiWorkingWS.updatePortletsByName("UserToolbarSitePortlet");
                } else {
                    UIWorkingWorkspace uiWorkingWS = uiPortalApp.findFirstComponentOfType(UIWorkingWorkspace.class);
                    UIEditInlineWorkspace uiEditWS = uiWorkingWS.getChild(UIEditInlineWorkspace.class);
                    UIPortal editPortal = (UIPortal) uiEditWS.getUIComponent();
                    uiForm.invokeSetBindingBean(editPortal);
                }
            } else {
                UIApplication uiApp = Util.getPortalRequestContext().getUIApplication();
                uiApp.addMessage(new ApplicationMessage("UIPortalForm.msg.notExistAnymore", null));

                UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
                prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
                prContext.setFullRender(true);
            }

            UIMaskWorkspace uiMaskWorkspace = uiForm.getParent();
            WebuiRequestContext rContext = event.getRequestContext();
            uiMaskWorkspace.createEvent("Close", Phase.DECODE, rContext).broadcast();
            if (!uiForm.getId().equals("CreatePortal") && uiPortalApp.getModeState() != UIPortalApplication.NORMAL_MODE) {
                rContext.getJavascriptManager().require("SHARED/portalComposer", "portalComposer")
                        .addScripts("portalComposer.toggleSaveButton();");
            }
        }
View Full Code Here

    public void setBindingBean() throws Exception {

        DataStorage dataStorage = this.getApplicationComponent(DataStorage.class);

        UIPortal editPortal = null;
        UIPortalApplication uiPortalApp = Util.getUIPortalApplication();
        UIEditInlineWorkspace uiEditWS = uiPortalApp.<UIWorkingWorkspace> getChildById(UIPortalApplication.UI_WORKING_WS_ID)
                .getChild(UIEditInlineWorkspace.class);
        if (uiPortalApp.getModeState() != UIPortalApplication.NORMAL_MODE && uiEditWS != null
                && uiEditWS.getUIComponent() != null && (uiEditWS.getUIComponent() instanceof UIPortal)) {
            editPortal = (UIPortal) uiEditWS.getUIComponent();
        } else {
            PortalConfig pConfig = dataStorage.getPortalConfig(getPortalOwner());
            editPortal = this.createUIComponent(UIPortal.class, null, null);
View Full Code Here

            UIPortalForm uiForm = event.getSource();

            DataStorage dataService = uiForm.getApplicationComponent(DataStorage.class);
            UserACL acl = uiForm.getApplicationComponent(UserACL.class);
            PortalRequestContext prContext = Util.getPortalRequestContext();
            UIPortalApplication uiPortalApp = (UIPortalApplication) prContext.getUIApplication();

            PortalConfig pConfig = dataService.getPortalConfig(uiForm.getPortalOwner());
            if (pConfig != null && acl.hasPermission(pConfig)) {
                UIPortal uiPortal = uiForm.createUIComponent(UIPortal.class, null, null);
                PortalDataMapper.toUIPortal(uiPortal, pConfig);

                uiForm.invokeSetBindingBean(uiPortal);
                // uiPortal.refreshNavigation(localeConfigService.getLocaleConfig(uiPortal.getLocale()).getLocale()) ;
                if (uiPortalApp.getModeState() == UIPortalApplication.NORMAL_MODE) {
                    PortalConfig portalConfig = (PortalConfig) PortalDataMapper.buildModelObject(uiPortal);
                    dataService.save(portalConfig);
                    UserPortalConfigService service = uiForm.getApplicationComponent(UserPortalConfigService.class);
                    if (prContext.getPortalOwner().equals(uiForm.getPortalOwner())) {
                        prContext.setUserPortalConfig(service.getUserPortalConfig(uiForm.getPortalOwner(),
                                prContext.getRemoteUser(), PortalRequestContext.USER_PORTAL_CONTEXT));
                        uiPortalApp.reloadPortalProperties();
                    }

                    // We should use IPC to update some portlets in the future instead of
                    UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChild(UIWorkingWorkspace.class);

                    // TODO: Raise Portlet Event instead
                    uiWorkingWS.updatePortletsByName("PortalNavigationPortlet");
                    uiWorkingWS.updatePortletsByName("UserToolbarSitePortlet");
                } else {
                    UIWorkingWorkspace uiWorkingWS = uiPortalApp.findFirstComponentOfType(UIWorkingWorkspace.class);
                    UIEditInlineWorkspace uiEditWS = uiWorkingWS.getChild(UIEditInlineWorkspace.class);
                    UIPortal editPortal = (UIPortal) uiEditWS.getUIComponent();
                    uiForm.invokeSetBindingBean(editPortal);
                }
            } else {
                UIApplication uiApp = Util.getPortalRequestContext().getUIApplication();
                uiApp.addMessage(new ApplicationMessage("UIPortalForm.msg.notExistAnymore", null));

                UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
                prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
                prContext.setFullRender(true);
            }

            UIMaskWorkspace uiMaskWorkspace = uiForm.getParent();
            WebuiRequestContext rContext = event.getRequestContext();
            uiMaskWorkspace.createEvent("Close", Phase.DECODE, rContext).broadcast();
            if (!uiForm.getId().equals("CreatePortal") && uiPortalApp.getModeState() != UIPortalApplication.NORMAL_MODE) {
                rContext.getJavascriptManager().require("SHARED/portalComposer", "portalComposer")
                        .addScripts("portalComposer.toggleSaveButton();");
            }
        }
View Full Code Here

            service.createUserPortalConfig(SiteType.PORTAL.getName(), portalName, template);

            PortalConfig pconfig = dataService.getPortalConfig(portalName);
            uiForm.invokeSetBindingBean(pconfig);
            dataService.save(pconfig);
            UIPortalApplication uiPortalApp = event.getSource().getAncestorOfType(UIPortalApplication.class);
            UIMaskWorkspace uiMaskWS = uiPortalApp.getChildById(UIPortalApplication.UI_MASK_WS_ID);
            uiMaskWS.createEvent("Close", Phase.DECODE, pcontext).broadcast();

            UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChild(UIWorkingWorkspace.class);
            uiWorkingWS.updatePortletsByName("PortalNavigationPortlet");
            uiWorkingWS.updatePortletsByName("UserToolbarSitePortlet");
        }
View Full Code Here

    public static class ViewStep2ActionListener extends EventListener<UIPageCreationWizard> {
        public void execute(Event<UIPageCreationWizard> event) throws Exception {
            UIPageCreationWizard uiWizard = event.getSource();
            uiWizard.setShowActions(true);
            UIPortalApplication uiPortalApp = uiWizard.getAncestorOfType(UIPortalApplication.class);
            UIWorkingWorkspace uiWorkingWS = uiWizard.getAncestorOfType(UIWorkingWorkspace.class);
            uiWorkingWS.findFirstComponentOfType(UIPortalComposer.class).setRendered(false);
            uiWizard.viewStep(SECOND_STEP);

            if (uiWizard.getSelectedStep() < SECOND_STEP) {
                uiPortalApp.addMessage(new ApplicationMessage("UIPageCreationWizard.msg.StepByStep", null));
                uiWizard.viewStep(FIRST_STEP);
                uiWizard.updateWizardComponent();
                return;
            }

            if (uiWizard.isSelectedNodeExist()) {
                uiPortalApp.addMessage(new ApplicationMessage("UIPageCreationWizard.msg.NameNotSame", null));
                uiWizard.viewStep(FIRST_STEP);
                uiWizard.updateWizardComponent();
                return;
            }

            UIWizardPageSetInfo uiPageSetInfo = uiWizard.getChild(UIWizardPageSetInfo.class);
            UIPageNodeSelector uiNodeSelector = uiPageSetInfo.getChild(UIPageNodeSelector.class);
            uiWizard.updateWizardComponent();
            UserNavigation navigation = uiNodeSelector.getNavigation();
            if (navigation == null) {
                uiPortalApp.addMessage(new ApplicationMessage("UIPageCreationWizard.msg.notSelectedPageNavigation",
                        new String[] {}));
                uiWizard.viewStep(FIRST_STEP);
                return;
            }

            if (uiPageSetInfo.getUICheckBoxInput(UIWizardPageSetInfo.VISIBLE).isChecked()
                    && uiPageSetInfo.getUICheckBoxInput(UIWizardPageSetInfo.SHOW_PUBLICATION_DATE).isChecked()) {

                Calendar currentCalendar = Calendar.getInstance();
                currentCalendar.set(currentCalendar.get(Calendar.YEAR), currentCalendar.get(Calendar.MONTH),
                        currentCalendar.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
                Date currentDate = currentCalendar.getTime();

                Calendar startCalendar = uiPageSetInfo.getUIFormDateTimeInput(UIWizardPageSetInfo.START_PUBLICATION_DATE)
                        .getCalendar();
                Date startDate = (startCalendar != null) ? startCalendar.getTime() : currentDate;
                Calendar endCalendar = uiPageSetInfo.getUIFormDateTimeInput(UIWizardPageSetInfo.END_PUBLICATION_DATE)
                        .getCalendar();
                Date endDate = (endCalendar != null) ? endCalendar.getTime() : null;

                // Case 1: current date after start date
                if (currentDate.after(startDate)) {
                    Object[] args = {};
                    uiPortalApp.addMessage(new ApplicationMessage("UIPageNodeForm.msg.currentDateBeforeStartDate", args,
                            ApplicationMessage.WARNING));
                    uiWizard.viewStep(FIRST_STEP);
                    return;

                    // Case 2: start date after end date
                } else if ((endCalendar != null) && (startCalendar != null) && (startDate.after(endDate))) {
                    Object[] args = {};
                    uiPortalApp.addMessage(new ApplicationMessage("UIPageNodeForm.msg.startDateBeforeEndDate", args,
                            ApplicationMessage.WARNING));
                    uiWizard.viewStep(FIRST_STEP);
                    return;

                    // Case 3: start date is null and current date after end date
                } else if ((endCalendar != null) && (currentDate.after(endDate))) {
                    Object[] args = {};
                    uiPortalApp.addMessage(new ApplicationMessage("UIPageNodeForm.msg.currentDateBeforeEndDate", args,
                            ApplicationMessage.WARNING));
                    uiWizard.viewStep(FIRST_STEP);
                    return;
                }
            }
View Full Code Here

    }

    public static class ShowLoginFormActionListener extends EventListener<UIPortalComponent> {
        public void execute(Event<UIPortalComponent> event) throws Exception {
            UIPortal uiPortal = Util.getUIPortal();
            UIPortalApplication uiApp = uiPortal.getAncestorOfType(UIPortalApplication.class);
            UIMaskWorkspace uiMaskWS = uiApp.getChildById(UIPortalApplication.UI_MASK_WS_ID);
            UILogin uiLogin = uiMaskWS.createUIComponent(UILogin.class, null, null);
            uiMaskWS.setUIComponent(uiLogin);
            uiMaskWS.setWindowSize(630, -1);
            event.getRequestContext().addUIComponentToUpdateByAjax(uiMaskWS);
        }
View Full Code Here

    }

    public static class AccountSettingsActionListener extends EventListener<UIPortal> {
        public void execute(Event<UIPortal> event) throws Exception {
            UIPortal uiPortal = event.getSource();
            UIPortalApplication uiApp = uiPortal.getAncestorOfType(UIPortalApplication.class);
            UIMaskWorkspace uiMaskWS = uiApp.getChildById(UIPortalApplication.UI_MASK_WS_ID);

            // Modified by nguyenanhkien2a@gmail.com
            // We should check account for existing
            String username = Util.getPortalRequestContext().getRemoteUser();
            OrganizationService service = uiPortal.getApplicationComponent(OrganizationService.class);
View Full Code Here

TOP

Related Classes of org.exoplatform.portal.webui.workspace.UIPortalApplication

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.