Example #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);
 }
Example #2
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);
 }
Example #3
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();
    }