@Override
 public void execute(Event<UISpaceNavigationManagement> event) throws Exception {
   UISpaceNavigationManagement uiManagement = event.getSource();
   UISpaceNavigationNodeSelector uiNodeSelector =
       uiManagement.getChild(UISpaceNavigationNodeSelector.class);
   UIRightClickPopupMenu menu = uiNodeSelector.getChild(UIRightClickPopupMenu.class);
   menu.createEvent("AddNode", Phase.PROCESS, event.getRequestContext()).broadcast();
 }
 @Override
 public void execute(Event<UIPageNodeForm> event) throws Exception {
   UIPageNodeForm uiPageNode = event.getSource();
   UserNavigation contextNavigation = uiPageNode.getContextPageNavigation();
   UISpaceNavigationManagement uiSpaceNavManagement =
       uiPageNode.getAncestorOfType(UISpaceNavigationManagement.class);
   UIPopupWindow uiPopup = uiSpaceNavManagement.getChild(UIPopupWindow.class);
   uiPopup.setShow(false);
 }
    public void execute(Event<UISpaceNavigationManagement> event) throws Exception {
      //
      UISpaceNavigationManagement uiSNM = event.getSource();
      UISpaceNavigationNodeSelector uiNodeSelector =
          uiSNM.getChild(UISpaceNavigationNodeSelector.class);

      String nodeID = event.getRequestContext().getRequestParameter(OBJECTID);
      TreeNode node = uiNodeSelector.findNode(nodeID);
      uiNodeSelector.selectNode(node);
      event.getRequestContext().addUIComponentToUpdateByAjax(uiNodeSelector.getParent());
    }
    public void execute(Event<UISpaceNavigationManagement> event) throws Exception {
      PortalRequestContext prContext = Util.getPortalRequestContext();
      UISpaceNavigationManagement uiManagement = event.getSource();
      UISpaceNavigationNodeSelector uiNodeSelector =
          uiManagement.getChild(UISpaceNavigationNodeSelector.class);
      UserPortalConfigService portalConfigService =
          uiManagement.getApplicationComponent(UserPortalConfigService.class);

      UIPortalApplication uiPortalApp = (UIPortalApplication) prContext.getUIApplication();
      UIWorkingWorkspace uiWorkingWS =
          uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
      prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
      prContext.ignoreAJAXUpdateOnPortlets(true);

      UserNavigation navigation = uiNodeSelector.getEdittedNavigation();
      SiteKey siteKey = navigation.getKey();
      String editedOwnerId = siteKey.getName();

      // Check existed
      UserPortalConfig userPortalConfig;
      if (SiteType.PORTAL.equals(siteKey.getType())) {
        userPortalConfig =
            portalConfigService.getUserPortalConfig(
                editedOwnerId, event.getRequestContext().getRemoteUser());
        if (userPortalConfig == null) {
          prContext
              .getUIApplication()
              .addMessage(
                  new ApplicationMessage(
                      "UIPortalForm.msg.notExistAnymore", null, ApplicationMessage.ERROR));
          return;
        }
      } else {
        userPortalConfig =
            portalConfigService.getUserPortalConfig(
                prContext.getPortalOwner(), event.getRequestContext().getRemoteUser());
      }

      UserNavigation persistNavigation = userPortalConfig.getUserPortal().getNavigation(siteKey);
      if (persistNavigation == null) {
        prContext
            .getUIApplication()
            .addMessage(
                new ApplicationMessage(
                    "UINavigationManagement.msg.NavigationNotExistAnymore",
                    null,
                    ApplicationMessage.ERROR));
        return;
      }

      uiNodeSelector.save();
    }
 @Override
 public void execute(Event<UIPopupWindow> event) throws Exception {
   UIPopupWindow uiPopup = event.getSource();
   UISpaceNavigationManagement uiSpaceNavManagement =
       uiPopup.getAncestorOfType(UISpaceNavigationManagement.class);
   UISpaceNavigationNodeSelector selector =
       uiSpaceNavManagement.getChild(UISpaceNavigationNodeSelector.class);
   UserNavigation contextNavigation = selector.getEdittedNavigation();
   uiPopup.setShow(false);
   uiSpaceNavManagement.setOwner(contextNavigation.getKey().getName());
   uiSpaceNavManagement.setOwnerType(contextNavigation.getKey().getTypeName());
   selector.setEdittedNavigation(contextNavigation);
   selector.initTreeData();
   event.getRequestContext().addUIComponentToUpdateByAjax(uiSpaceNavManagement);
 }