Package org.exoplatform.portal.config.model

Examples of org.exoplatform.portal.config.model.Page


                  // widgetDataService.delete(userName,
                  // uiWidget.getApplicationName(), uiWidget.getId()) ;
               }
               if (uiPage.isModifiable())
               {
                  Page page = (Page)PortalDataMapper.buildModelObject(uiPage);
                  if (page.getChildren() == null)
                  {
                     page.setChildren(new ArrayList<ModelObject>());
                  }
                  DataStorage dataService = uiPage.getApplicationComponent(DataStorage.class);
                  dataService.save(page);
               }
               break;
View Full Code Here


         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>());
            }
            DataStorage dataService = uiPage.getApplicationComponent(DataStorage.class);
            dataService.save(page);
            pcontext.setFullRender(false);
            pcontext.setResponseComplete(true);
View Full Code Here

         {
            uiPortalApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.PageNotExist", new String[]{id}, 1));
            pcontext.addUIComponentToUpdateByAjax(uiPortalApp.getUIPopupMessages());
            return;
         }
         Page page = service.getPage(id, pcontext.getRemoteUser());
         if (page == null || !page.isModifiable())
         {
            uiPortalApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.delete.NotDelete", new String[]{id}, 1));
            pcontext.addUIComponentToUpdateByAjax(uiPortalApp.getUIPopupMessages());
            return;
         }

         UIVirtualList virtualList = uiPageBrowser.getChild(UIVirtualList.class);
         UIRepeater repeater = (UIRepeater)virtualList.getDataFeed();
         PageListAccess datasource = (PageListAccess)repeater.getDataSource();
         int currentPage = datasource.getCurrentPage();

         dataService.remove(page);
         //Minh Hoang TO: The cached UIPage objects corresponding to removed Page should be removed here.
         //As we have multiple UIPortal, which means multiple caches of UIPage. It 's unwise to garbage
         // all UIPage caches at once. Better solution is to clear UIPage on browsing to PageNode having Page
         //removed
        
         UIPortal uiPortal = Util.getUIPortal();
         if (uiPortal.getSelectedNode().getPageReference().equals(page.getPageId()))
         {
            PageNodeEvent<UIPortal> pnevent =
               new PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE, uiPortal.getSelectedNode()
                  .getUri());
            uiPortal.broadcast(pnevent, Phase.PROCESS);
         }
         else
         {
            boolean dataAvailable = uiPageBrowser.feedDataWithQuery(uiPageBrowser.getLastQuery());
            if (!dataAvailable)
            {
               showNoResultMessagePopup();
            }
            if (currentPage > datasource.getAvailablePage())
               currentPage = datasource.getAvailablePage();
            datasource.getPage(currentPage);
            event.getRequestContext().addUIComponentToUpdateByAjax(uiPageBrowser);
         }
        
         //Update navigation and UserToolbarGroupPortlet if deleted page is dashboard page
         if(page.getOwnerType().equals(PortalConfig.USER_TYPE)){
            removePageNode(page, event);
         }
      }
View Full Code Here

         UIPortalApplication uiPortalApp = (UIPortalApplication)pcontext.getUIApplication();
         String id = pcontext.getRequestParameter(OBJECTID);
         UserPortalConfigService service = uiPageBrowser.getApplicationComponent(UserPortalConfigService.class);

         //Check existence of the page
         Page page = service.getPage(id);
         if (page == null)
         {
            uiPortalApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.PageNotExist", new String[]{id}, 1));
            pcontext.addUIComponentToUpdateByAjax(uiPortalApp.getUIPopupMessages());
            return;
         }

         //Check current user 's permissions on the page
         UserACL userACL = uiPageBrowser.getApplicationComponent(UserACL.class);
         if (!userACL.hasEditPermission(page))
         {
            uiPortalApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.edit.NotEditPage", new String[]{id}, 1));
            pcontext.addUIComponentToUpdateByAjax(uiPortalApp.getUIPopupMessages());
            return;
         }

         //Switch portal application to edit mode
         uiPortalApp.setModeState(UIPortalApplication.APP_BLOCK_EDIT_MODE);
         UIWorkingWorkspace uiWorkingWS = uiPortalApp.findFirstComponentOfType(UIWorkingWorkspace.class);
         UIEditInlineWorkspace editInlineWS = uiWorkingWS.getChild(UIEditInlineWorkspace.class);
        
         //Clone a UIPage object, that is required for Abort action
         UIPage uiPage = editInlineWS.createUIComponent(UIPage.class, null, null);
         PortalDataMapper.toUIPage(uiPage, page);
        
         UIPageBody uiPageBody = uiPortalApp.findFirstComponentOfType(UIPageBody.class);
         if (uiPageBody.getUIComponent() != null)
            uiPageBody.setUIComponent(null);

         if (Page.DESKTOP_PAGE.equals(page.getFactoryId()))
         {
            UIMaskWorkspace uiMaskWS = uiPortalApp.getChildById(UIPortalApplication.UI_MASK_WS_ID);
            UIPageForm uiPageForm = uiMaskWS.createUIComponent(UIPageForm.class, "UIBrowserPageForm", "UIPageForm");
            uiPageForm.setValues(uiPage);
            uiMaskWS.setUIComponent(uiPageForm);
View Full Code Here

         UIEditInlineWorkspace editInlineWS = event.getSource().getParent();
         UIWorkingWorkspace uiWorkingWS = editInlineWS.getParent();
         UIPortalToolPanel uiToolPanel = uiWorkingWS.findFirstComponentOfType(UIPortalToolPanel.class);

         UIPage uiPage = uiToolPanel.findFirstComponentOfType(UIPage.class);
         Page page = (Page)PortalDataMapper.buildModelObject(uiPage);
         String pageId = page.getPageId();

         UserPortalConfigService portalConfigService =
            uiWorkingWS.getApplicationComponent(UserPortalConfigService.class);
        
         /*
          * if it is a edition of the current page
          */
         if (page.getStorageId() != null && portalConfigService.getPage(pageId) == null)
         {
            uiPortalApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.PageNotExist", new String[]{pageId}, 1));
            uiPortalApp.setModeState(UIPortalApplication.NORMAL_MODE);
            uiWorkingWS.setRenderedChild(UIPortalApplication.UI_VIEWING_WS_ID);
            Util.getPortalRequestContext().setFullRender(true);
            PageNodeEvent<UIPortal> pnevent =
               new PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE,
                  (uiPortal.getSelectedNode() != null ? uiPortal.getSelectedNode().getUri() : null));
            uiPortal.broadcast(pnevent, Event.Phase.PROCESS);
            JavascriptManager jsManager = event.getRequestContext().getJavascriptManager();
            jsManager.addJavascript("eXo.portal.portalMode=" + UIPortalApplication.NORMAL_MODE + ";");
            return;
         }
         UIPortalComposer composer = uiWorkingWS.findFirstComponentOfType(UIPortalComposer.class).setRendered(false);
         composer.setEditted(false);
        
         // If it is a page creation wizard
         if (composer.isUsedInWizard())
         {
            UIWizard wizard = (UIWizard)uiToolPanel.getUIComponent();
            int step = wizard.getCurrentStep();
            step++;
            Event<UIComponent> uiEvent =
               wizard.createEvent("ViewStep" + step, Phase.PROCESS, event.getRequestContext());
            uiEvent.broadcast();
            return;
         }

         // Perform model update
         DataStorage dataService = uiWorkingWS.getApplicationComponent(DataStorage.class);
         try
         {
            dataService.save(page);
         }
         catch (StaleModelException ex)
         {
            //Temporary solution to concurrency-related issue
            //This catch block should be put in an appropriate ApplicationLifecyclec
         }
         uiToolPanel.setUIComponent(null);

         // Synchronize model object with UIPage object, that seems  redundant but in fact
         // mandatory to have consequent edit actions (on the same page) work properly
         page = dataService.getPage(page.getPageId());
         uiPage.getChildren().clear();
         PortalDataMapper.toUIPage(uiPage, page);
        
         // Update UIPage cache on UIPortal
         uiPortal.setUIPage(pageId, uiPage);
View Full Code Here

            uiForm.setShowPublicationDate(false);
            return;
         }
         UserPortalConfigService configService = uiWizard.getApplicationComponent(UserPortalConfigService.class);
         String accessUser = event.getRequestContext().getRemoteUser();
         Page page = null;
         if (pageNode.getPageReference() != null)
            page = configService.getPage(pageNode.getPageReference(), accessUser);
         if (page == null)
         {
            uiPortalApp.addMessage(new ApplicationMessage("UIWizardPageSetInfo.msg.null", null));
View Full Code Here

   @SuppressWarnings("unchecked")
   public void setValues(UIPage uiPage) throws Exception
   {
      uiPage_ = uiPage;
      Page page = (Page)PortalDataMapper.buildModelObject(uiPage);
      if (uiPage.getOwnerType().equals(PortalConfig.USER_TYPE))
      {
         removeChildById("PermissionSetting");
      }
      else if (getChildById("PermissionSetting") == null)
      {
         addUIComponentInput(uiPermissionSetting);
      }
      uiPermissionSetting.getChild(UIPermissionSelector.class).setEditable(true);
      invokeGetBindingBean(page);
      getUIStringInput("name").setEditable(false);
      getUIStringInput("pageId").setValue(uiPage.getPageId());
      getUIStringInput("title").setValue(uiPage.getTitle());
      getUIFormCheckBoxInput("showMaxWindow").setValue(uiPage.isShowMaxWindow());
      getUIFormSelectBox(OWNER_TYPE).setEnable(false).setValue(uiPage.getOwnerType());
      removeChild(UIPageTemplateOptions.class);

      UIFormInputItemSelector uiTemplate = getChild(UIFormInputItemSelector.class);
      if (uiTemplate == null)
         return;
      if (page.getFactoryId() == null || page.getFactoryId().trim().length() < 1)
      {
         uiTemplate.setValue("Default");
         return;
      }
      uiTemplate.setValue(uiPage.getFactoryId());
View Full Code Here

      if (PortalConfig.GROUP_TYPE.equals(ownerType) && ownerId.charAt(0) != '/')
      {
         ownerId = "/" + ownerId;
      }

      Page page = (Page)bean;
      page.setPageId(getUIStringInput("pageId").getValue());
      page.setOwnerType(ownerType);
      page.setOwnerId(ownerId);
      page.setName(getUIStringInput("name").getValue());
      String title = getUIStringInput("title").getValue();
      if (title == null || title.trim().length() < 1)
         title = page.getName();
      page.setTitle(title);

      if (!page.isShowMaxWindow())
      {
         page.setShowMaxWindow((Boolean)getUIFormCheckBoxInput("showMaxWindow").getValue());
      }
      if (!PortalConfig.USER_TYPE.equals(page.getOwnerType()))
      {
         page.setAccessPermissions(uiPermissionSetting.getChild(UIListPermissionSelector.class).getValue());
         page.setEditPermission(uiPermissionSetting.getChild(UIPermissionSelector.class).getValue());
      }
      UserACL userACL = getApplicationComponent(UserACL.class);
      userACL.hasPermission(page);

      UIFormInputItemSelector uiTemplate = getChildById("Template");
      if (uiTemplate != null)
      {
         SelectItemOption<?> itemOption = uiTemplate.getSelectedItemOption();
         if (itemOption != null)
         {
            page.setFactoryId(itemOption.getIcon());
            //        page.setTemplate((String)itemOption.getValue());
            if (page.getFactoryId().equals(Page.DESKTOP_PAGE))
               page.setShowMaxWindow(true);
         }
      }
      UIPageTemplateOptions uiConfigOptions = getChild(UIPageTemplateOptions.class);
      if (uiConfigOptions == null)
         return;
      Page selectedPage = uiConfigOptions.createPageFromSelectedOption(page.getOwnerType(), page.getOwnerId());
      if (selectedPage == null)
         return;
      page.setChildren(selectedPage.getChildren());
      page.setFactoryId(selectedPage.getFactoryId());
      if (Page.DESKTOP_PAGE.equals(page.getFactoryId()))
         page.setShowMaxWindow(true);

   }
View Full Code Here

            uiWorkingWS.findFirstComponentOfType(UIPortalToolPanel.class).setRendered(true);
         UserPortalConfigService userService = uiToolPanel.getApplicationComponent(UserPortalConfigService.class);

         // get selected page
         String pageId = selectedPageNode.getPageReference();
         Page selectPage = (pageId != null) ? userService.getPage(pageId) : null;
         if (selectPage != null)
         {
            UserACL userACL = uiApp.getApplicationComponent(UserACL.class);
            if (!userACL.hasEditPermission(selectPage))
            {
               uiApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.UserNotPermission", new String[]{pageId}, 1));
               return;
            }

            uiApp.setModeState(UIPortalApplication.APP_BLOCK_EDIT_MODE);
            //uiWorkingWS.setRenderedChild(UIPortalToolPanel.class);
            //uiWorkingWS.addChild(UIPortalComposer.class, "UIPageEditor", null);

            uiWorkingWS.setRenderedChild(UIEditInlineWorkspace.class);

            UIPortalComposer portalComposer =
               uiWorkingWS.findFirstComponentOfType(UIPortalComposer.class).setRendered(true);
            portalComposer.setShowControl(true);
            portalComposer.setEditted(false);
            portalComposer.setCollapse(false);
            portalComposer.setId("UIPageEditor");
            portalComposer.setComponentConfig(UIPortalComposer.class, "UIPageEditor");

            uiToolPanel.setShowMaskLayer(false);
            uiToolPanel.setWorkingComponent(UIPage.class, null);
            UIPage uiPage = (UIPage)uiToolPanel.getUIComponent();

            WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
            if(selectPage.getTitle() == null)
               selectPage.setTitle(selectedPageNode.getLabel());

            // convert Page to UIPage
            PortalDataMapper.toUIPage(uiPage, selectPage);
            Util.getPortalRequestContext().addUIComponentToUpdateByAjax(uiWorkingWS);
            Util.getPortalRequestContext().setFullRender(true);
View Full Code Here

         UIPage uiPage = uiPageForm.getUIPage();
         if (uiPage == null)
            return;
         String storageId = uiPage.getStorageId();
         Page page = new Page();
         page.setPageId(uiPage.getPageId());
         uiPageForm.invokeSetBindingBean(page);
         page.setOwnerType(uiPage.getOwnerType());
         List<UIPortlet> uiPortlets = new ArrayList<UIPortlet>();
         findAllPortlet(uiPortlets, uiPage);
         ArrayList<ModelObject> applications = new ArrayList<ModelObject>();
         for (UIPortlet uiPortlet : uiPortlets)
         {
            applications.add(PortalDataMapper.buildModelObject(uiPortlet));
         }

         if (Page.DESKTOP_PAGE.equals(uiPage.getFactoryId()) && !Page.DESKTOP_PAGE.equals(page.getFactoryId()))
         {
            page.setShowMaxWindow(false);
            uiPage.getChildren().clear();
            page.setChildren(applications);

            PortalDataMapper.toUIPage(uiPage, page);
            //        if(page.getTemplate() == null) page.setTemplate(uiPage.getTemplate()) ;
            if (page.getChildren() == null)
               page.setChildren(new ArrayList<ModelObject>());

            //        uiEditBar.setUIPage(uiPage);
            //        Class<?> [] childrenToRender = {UIPageEditBar.class,
            //            UIPageNodeSelector.class, UIPageNavigationControlBar.class};     
            //        uiManagement.setRenderedChildrenOfTypes(childrenToRender);

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

            return;
         }

         if (Page.DESKTOP_PAGE.equals(page.getFactoryId()))
         {
            uiPage.getChildren().clear();
            page.setChildren(applications);

            PortalDataMapper.toUIPage(uiPage, page);
            //        if(page.getTemplate() == null) page.setTemplate(uiPage.getTemplate()) ;
            if (page.getChildren() == null)
               page.setChildren(new ArrayList<ModelObject>());

            UIPortalToolPanel toolPanel = Util.getUIPortalToolPanel();
            toolPanel.setShowMaskLayer(true);
            pcontext.setFullRender(true);
            UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
            pcontext.addUIComponentToUpdateByAjax(uiWorkingWS);
            DataStorage dataService = uiPageForm.getApplicationComponent(DataStorage.class);
            dataService.save(page);
            return;
         }

         List<UIComponent> uiChildren = uiPage.getChildren();
         if (uiChildren == null)
         {
            PortalDataMapper.toUIPage(uiPage, page);
            return;
         }
         ArrayList<ModelObject> children = new ArrayList<ModelObject>();
         for (UIComponent child : uiChildren)
         {
            ModelObject component = PortalDataMapper.buildModelObject(child);
            if (component != null)
               children.add(component);
         }
         page.setChildren(children);
         uiPage.getChildren().clear();

         try{
            PortalDataMapper.toUIPage(uiPage, page);
         } catch(NoSuchDataException de){
            uiPortalApp.addMessage(new ApplicationMessage("UIPageForm.msg.notExistOrDeleted", null, ApplicationMessage.ERROR));
            UIPortalComposer uiPortalComposer = (UIPortalComposer)uiPortalApp.findComponentById("UIPageEditor");
            if(uiPortalComposer != null){
               Event aboutEvent = new Event<UIPortalComposer>(uiPortalComposer, "Abort", event.getRequestContext());
               uiPortalComposer.broadcast(aboutEvent, event.getExecutionPhase());
            }
         }
        
         uiPage.setStorageId(storageId);
         //      if(page.getTemplate() == null) page.setTemplate(uiPage.getTemplate()) ;
         if (page.getChildren() == null)
            page.setChildren(new ArrayList<ModelObject>());
      }
View Full Code Here

TOP

Related Classes of org.exoplatform.portal.config.model.Page

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.