Package org.exoplatform.portal.config.model

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


      }
   }

   private PageNode unmarshalNode(StaxNavigator<Element> navigator) throws StaxNavException
   {
      PageNode node = new PageNode();
      I18NString labels = new I18NString();
      ArrayList<PageNode> children = new ArrayList<PageNode>();

      Element current = navigator.child();
      while (current != null)
      {
         switch (navigator.getName())
         {
            case URI: // For backwards compatibility
               current = navigator.sibling();
               break;
            case NAME:
               node.setName(navigator.getContent());
               current = navigator.sibling();
               break;
            case LABEL:
               labels.add(Utils.parseLocalizedString(navigator));
               current = navigator.sibling();
               break;
            case ICON:
               node.setIcon(navigator.getContent());
               current = navigator.sibling();
               break;
            case START_PUBLICATION_DATE:
               node.setStartPublicationDate(navigator.parseContent(ValueType.DATE_TIME));
               current = navigator.sibling();
               break;
            case END_PUBLICATION_DATE:
               node.setEndPublicationDate(navigator.parseContent(ValueType.DATE_TIME));
               current = navigator.sibling();
               break;
            case VISIBILITY:
               node.setVisibility(navigator.parseContent(ValueType.get(Visibility.class)));
               current = navigator.sibling();
               break;
            case PAGE_REFERENCE:
               node.setPageReference(navigator.getContent());
               current = navigator.sibling();
               break;
            case NODE:
               PageNode child = unmarshalNode(navigator.fork());
               children.add(child);
               current = navigator.sibling();
               break;
            case UNKNOWN:
               throw unknownElement(navigator);
View Full Code Here


         UIRightClickPopupMenu uiPopupMenu = event.getSource();

         UINavigationNodeSelector uiNodeSelector = uiPopupMenu.getAncestorOfType(UINavigationNodeSelector.class);

         // get Selected PageNode
         PageNode selectedPageNode = null;
         List<PageNode> pageNodes = uiNodeSelector.getSelectedNavigation().getNodes();
         if (uri != null && uri.trim().length() > 0)
         {
            for (PageNode pageNode : pageNodes)
            {
               selectedPageNode = PageNavigationUtils.searchPageNodeByUri(pageNode, uri);
               if (selectedPageNode != null)
               {
                  break;
               }
            }
         }

         UIPortalApplication uiApp = Util.getUIPortalApplication();

         if (selectedPageNode.getPageReference() == null)
         {
            uiApp.addMessage(new ApplicationMessage("UIPageNodeSelector.msg.notAvailable", null));
            return;
         }

         UIWorkingWorkspace uiWorkingWS = uiApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
         UIPortalToolPanel uiToolPanel =
            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

   }

   public void invokeGetBindingBean(Object bean) throws Exception
   {
      super.invokeGetBindingBean(bean);
      PageNode pageNode = (PageNode)bean;
      String icon = pageNode_.getIcon();
      if (icon == null || icon.length() < 0)
         icon = "Default";
      getChild(UIFormInputIconSelector.class).setSelectedIcon(icon);
      getUIStringInput("label").setValue(pageNode_.getLabel());
      getUIFormCheckBoxInput("visible").setChecked(pageNode_.isVisible());
      setShowPublicationDate(pageNode.isShowPublicationDate());
      Calendar cal = Calendar.getInstance();
      if (pageNode.getStartPublicationDate() != null)
      {
         cal.setTime(pageNode.getStartPublicationDate());
         getUIFormDateTimeInput(START_PUBLICATION_DATE).setCalendar(cal);
      }
      else
         getUIFormDateTimeInput(START_PUBLICATION_DATE).setValue(null);
      if (pageNode.getEndPublicationDate() != null)
      {
         cal.setTime(pageNode.getEndPublicationDate());
         getUIFormDateTimeInput(END_PUBLICATION_DATE).setCalendar(cal);
      }
      else
         getUIFormDateTimeInput(END_PUBLICATION_DATE).setValue(null);
   }
View Full Code Here

         UIApplication uiApp = ctx.getUIApplication();
         String uri = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
         UINavigationNodeSelector uiNodeSelector = popupMenu.getAncestorOfType(UINavigationNodeSelector.class);
         PageNavigation selectedNav = uiNodeSelector.getSelectedNavigation();
         Object obj = PageNavigationUtils.searchParentNode(selectedNav, uri);
         PageNode selectedNode = PageNavigationUtils.searchPageNodeByUri(selectedNav, uri);
         String pageId = selectedNode.getPageReference();

         UserPortalConfigService service = uiApp.getApplicationComponent(UserPortalConfigService.class);
         Page node = (pageId != null) ? service.getPage(pageId) : null;
         if (node != null)
         {
View Full Code Here

   }

   public void invokeSetBindingBean(Object bean) throws Exception
   {
      super.invokeSetBindingBean(bean);
      PageNode node = (PageNode)bean;
      Calendar cal = getUIFormDateTimeInput(START_PUBLICATION_DATE).getCalendar();
      Date date = (cal != null) ? cal.getTime() : null;
      node.setStartPublicationDate(date);
      cal = getUIFormDateTimeInput(END_PUBLICATION_DATE).getCalendar();
      date = (cal != null) ? cal.getTime() : null;
      node.setEndPublicationDate(date);
   }
View Full Code Here

         if (selectedNode == null)
         {
            return;
         }

         PageNode newNode = selectedNode.getNode().clone();
         PageNavigation targetNav = uiNodeSelector.getSelectedNavigation();
         PageNode targetNode = PageNavigationUtils.searchPageNodeByUri(targetNav, targetUri);

         if (targetNode != null && newNode.getUri().equals(targetNode.getUri()))
         {
            UIApplication uiApp = Util.getPortalRequestContext().getUIApplication();
            uiApp.addMessage(new ApplicationMessage("UIPageNodeSelector.msg.paste.sameSrcAndDes", null));
            return;
         }

         if (isExistChild(targetNode, newNode) || (targetNode == null && isExitChild(targetNav, newNode)))
         {
            UIApplication uiApp = Util.getPortalRequestContext().getUIApplication();
            uiApp.addMessage(new ApplicationMessage("UIPageNodeSelector.msg.paste.sameName", null));
            return;
         }
         if (selectedNode.isDeleteNode())
         {
            if (selectedNode.getParentNode() != null)
            {
               selectedNode.getParentNode().getChildren().remove(selectedNode.getNode());
            }
            else
            {
               selectedNode.getPageNavigation().getNodes().remove(selectedNode.getNode());
            }
         }
         event.getRequestContext().addUIComponentToUpdateByAjax(uiNodeSelector);
         uiNodeSelector.setCopyNode(null);
         UITree uitree = uiNodeSelector.getChild(UITree.class);
         UIRightClickPopupMenu popup = uitree.getUIRightClickPopupMenu();
         popup.setActions(new String[]{"AddNode", "EditPageNode", "EditSelectedNode", "CopyNode", "CutNode",
            "CloneNode", "DeleteNode", "MoveUp", "MoveDown"});

         UserPortalConfigService service = uiPopupMenu.getApplicationComponent(UserPortalConfigService.class);
         if (targetNode == null)
         {
            newNode.setUri(newNode.getName());
            targetNav.addNode(newNode);
            if (selectedNode.isCloneNode())
            {
               clonePageFromNode(newNode, targetNav.getOwnerType(), targetNav.getOwnerId(), service);
            }
            return;
         }
         setNewUri(targetNode, newNode);
         targetNode.getChildren().add(newNode);
         if (selectedNode.isCloneNode())
         {
            clonePageFromNode(newNode, targetNav.getOwnerType(), targetNav.getOwnerId(), service);
         }
         uiNodeSelector.selectPageNodeByUri(targetNode.getUri());
      }
View Full Code Here

               uiApp.addMessage(new ApplicationMessage("UIPageNodeForm2.msg.startDateBeforeEndDate", null));
               return;
            }
         }

         PageNode pageNode = uiPageNodeForm.getPageNode();
         if (pageNode == null)
            pageNode = new PageNode();
         uiPageNodeForm.invokeSetBindingBean(pageNode);
         UIPageSelector2 pageSelector = uiPageNodeForm.getChild(UIPageSelector2.class);
         if (pageSelector.getPage() == null)
            pageNode.setPageReference(null);
         UIFormInputIconSelector uiIconSelector = uiPageNodeForm.getChild(UIFormInputIconSelector.class);
         if (uiIconSelector.getSelectedIcon().equals("Default"))
            pageNode.setIcon(null);
         else
            pageNode.setIcon(uiIconSelector.getSelectedIcon());
         if (pageNode.getLabel() == null)
            pageNode.setLabel(pageNode.getName());

         String remoteUser = ctx.getRemoteUser();
         Object selectedParent = uiPageNodeForm.getSelectedParent();
         PageNavigation pageNav = null;

         if (selectedParent instanceof PageNavigation)
         {
            pageNav = (PageNavigation)selectedParent;
            pageNode.setUri(pageNode.getName());
            if (!pageNav.getNodes().contains(pageNode))
            {
               if (PageNavigationUtils.searchPageNodeByUri(pageNav, pageNode.getUri()) != null)
               {
                  uiApp.addMessage(new ApplicationMessage("UIPageNodeForm2.msg.SameName", null));
                  return;
               }
               pageNav.addNode(pageNode);
            }
         }
         else if (selectedParent instanceof PageNode)
         {
            PageNode parentNode = (PageNode)selectedParent;
            List<PageNode> children = parentNode.getChildren();
            if (children == null)
            {
               children = new ArrayList<PageNode>();
               parentNode.setChildren((ArrayList<PageNode>)children);
            }
            pageNode.setUri(parentNode.getUri() + "/" + pageNode.getName());
            if (!children.contains(pageNode))
            {
               if (PageNavigationUtils.searchPageNodeByUri(parentNode, pageNode.getUri()) != null)
               {
                  uiApp.addMessage(new ApplicationMessage("UIPageNodeForm2.msg.SameName", null));
View Full Code Here

      {
         String uri = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
         UINavigationNodeSelector uiNodeSelector = event.getSource().getAncestorOfType(UINavigationNodeSelector.class);
         event.getRequestContext().addUIComponentToUpdateByAjax(uiNodeSelector.getParent());
         PageNavigation nav = uiNodeSelector.getSelectedNavigation();
         PageNode targetNode = PageNavigationUtils.searchPageNodeByUri(nav, uri);
         Object parentNode = PageNavigationUtils.searchParentNode(nav, uri);
         List<PageNode> children = new ArrayList<PageNode>();
         if (parentNode instanceof PageNavigation)
         {
            children = ((PageNavigation)parentNode).getNodes();
View Full Code Here

      if (title == null)
      {
         UIPortal uiportal = Util.getUIPortal();

         //
         PageNode node = uiportal.getSelectedNode();
         if (node != null)
         {
            ExoContainer container = getApplication().getApplicationServiceContainer();
            container.getComponentInstanceOfType(UserPortalConfigService.class);
            UserPortalConfigService configService = (UserPortalConfigService)container.getComponentInstanceOfType(UserPortalConfigService.class);
            Page page = configService.getPage(node.getPageReference(), getRemoteUser());

            //
            if (page != null)
            {
               title = page.getTitle();
            }
            else
            {
               title = node.getResolvedLabel();
            }
         }
      }

      //
View Full Code Here

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

         UIContainer uiParent = uiPageNodeSelector.getParent();
         PageNode node = null;
         if (uiPageNodeSelector.getSelectedNode() == null)
         {
            node = Util.getUIPortal().getSelectedNode();
         }
         else
         {
            node = uiPageNodeSelector.getSelectedNode().getNode();
         }
         if (node == null)
         {
            uiPageNodeSelector.selectNavigation(uiPageNodeSelector.getSelectedNavigation());
            uiToolPanel.setUIComponent(null);
            return;
         }

         UserPortalConfigService configService = uiParent.getApplicationComponent(UserPortalConfigService.class);
         Page page = null;
         if (node.getPageReference() != null)
         {
            page = configService.getPage(node.getPageReference(), event.getRequestContext().getRemoteUser());
         }

         if (page == null)
         {
            uiToolPanel.setUIComponent(null);
View Full Code Here

TOP

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

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.