Пример #1
0
 public void execute(Event<UINavigationForm> event) throws Exception {
   UINavigationForm uiNavigationForm = event.getSource();
   uiNavigationForm.getUIStringInput(NAVIGATION_NODE_STRING_INPUT).setValue("");
   // if NAVIGATION_NODE_STRING_INPUT is not selected other fields must
   // be enabled
   //			uiNavigationForm.getUIStringInput(INDEX).setEnable(true);
   //			((UIFormCheckBoxInput) uiNavigationForm.getUIInput(IS_CLICKABLE)).setEnable(true);
   //			uiNavigationForm.getUIStringInput(LIST_TARGET_PAGE_STRING_INPUT).setEnable(true);
   //			uiNavigationForm.getUIStringInput(DETAIL_SHOW_CLV_BY_STRING_INPUT).setEnable(true);
   event.getRequestContext().addUIComponentToUpdateByAjax(uiNavigationForm);
 }
Пример #2
0
 /*
  * (non-Javadoc)
  *
  * @see
  * org.exoplatform.webui.event.EventListener#execute(org.exoplatform
  * .webui.event.Event)
  */
 public void execute(Event<UINavigationForm> event) throws Exception {
   UINavigationForm uiNavigationForm = event.getSource();
   UIPageSelector pageSelector =
       uiNavigationForm.createUIComponent(UIPageSelector.class, null, null);
   pageSelector.setSourceComponent(
       uiNavigationForm, new String[] {DETAIL_TARGET_PAGE_STRING_INPUT});
   UIJCRExplorer uiExplorer = event.getSource().getAncestorOfType(UIJCRExplorer.class);
   UIPopupContainer popupContainer = uiExplorer.getChild(UIPopupContainer.class);
   popupContainer.removeChildById(DETAIL_TARGET_PAGE_SELECTOR_POPUP_WINDOW);
   UIPopupWindow popupWindow =
       popupContainer.addChild(
           UIPopupWindow.class, null, DETAIL_TARGET_PAGE_SELECTOR_POPUP_WINDOW);
   popupWindow.setUIComponent(pageSelector);
   popupWindow.setWindowSize(800, 0);
   popupWindow.setShow(true);
   popupWindow.setRendered(true);
   popupWindow.setResizable(true);
   WebuiRequestContext requestContext = WebuiRequestContext.getCurrentInstance();
   requestContext.addUIComponentToUpdateByAjax(popupContainer);
   uiNavigationForm.setPopupId(DETAIL_TARGET_PAGE_SELECTOR_POPUP_WINDOW);
 }
Пример #3
0
 public void execute(Event<UINavigationForm> event) throws Exception {
   UINavigationForm uiNavigationForm = event.getSource();
   uiNavigationForm.getUIStringInput(LIST_TARGET_PAGE_STRING_INPUT).setValue("");
   event.getRequestContext().addUIComponentToUpdateByAjax(uiNavigationForm);
 }
Пример #4
0
    public void execute(Event<UINavigationForm> event) throws Exception {
      UINavigationForm uiNavigationForm = event.getSource();
      UIJCRExplorer uiExplorer = uiNavigationForm.getAncestorOfType(UIJCRExplorer.class);
      UIApplication uiApp = uiNavigationForm.getAncestorOfType(UIApplication.class);
      // retrieve current node
      Node node = uiExplorer.getCurrentNode();
      // if current node is locked...
      if (uiExplorer.nodeIsLocked(node)) {
        uiApp.addMessage(new ApplicationMessage("UIPopupMenu.msg.node-locked", null));
        event.getRequestContext().addUIComponentToUpdateByAjax(uiApp.getUIPopupMessages());
        return;
      }

      boolean isVisible =
          (Boolean)
              uiNavigationForm.<UIFormCheckBoxInput<Boolean>>getUIInput(IS_VISIBLE).getValue();

      boolean hasNavigableMixinType = node.isNodeType("exo:navigable");
      if (isVisible) {
        if (!hasNavigableMixinType) {
          if (node.canAddMixin("exo:navigable")) {
            node.addMixin("exo:navigable");
          } else {
            uiApp.addMessage(
                new ApplicationMessage("UISingleExternalMetadataForm.msg.can-not-add", null));
            event.getRequestContext().addUIComponentToUpdateByAjax(uiApp.getUIPopupMessages());
            return;
          }
        }

        String navigationNode =
            uiNavigationForm.getUIStringInput(NAVIGATION_NODE_STRING_INPUT).getValue();
        node.setProperty("exo:navigationNode", navigationNode);

        // if navigation node is selected, default values of
        // "index and clickable" are saved
        long index = 1000;
        boolean isClickable = false;
        String listTargetPage =
            uiNavigationForm.getUIStringInput(LIST_TARGET_PAGE_STRING_INPUT).getValue();

        if (navigationNode.equals("")) {
          if (uiNavigationForm.getUIStringInput(INDEX) != null) {
            index = Long.parseLong(uiNavigationForm.getUIStringInput(INDEX).getValue());
          }
          isClickable =
              (Boolean)
                  uiNavigationForm
                      .<UIFormCheckBoxInput<Boolean>>getUIInput(IS_CLICKABLE)
                      .getValue();
        }

        node.setProperty("exo:index", index);
        node.setProperty("exo:clickable", isClickable);
        node.setProperty("exo:page", listTargetPage);
        node.setProperty("exo:pageParamId", "folder-id");

        String detailTargetPage =
            uiNavigationForm.getUIStringInput(DETAIL_TARGET_PAGE_STRING_INPUT).getValue();
        node.setProperty("exo:childrenPage", detailTargetPage);

        node.setProperty("exo:childrenPageParamId", "content-id");
      } else {
        if (hasNavigableMixinType) {
          node.removeMixin("exo:navigable");
        }
      }
      node.save();

      propagateVisibility(node, isVisible);

      node.getSession().save();

      // close window
      uiExplorer.cancelAction();
    }