public void execute(Event<UICategorySelector> event) throws Exception {
      UICategorySelector selector = event.getSource();
      ApplicationRegistryService appRegService =
          selector.getApplicationComponent(ApplicationRegistryService.class);
      List<ApplicationCategory> categories = appRegService.getApplicationCategories();
      categories = categories != null ? categories : new ArrayList<ApplicationCategory>();
      UIFormCheckBoxInput<Boolean> chkInput;
      for (ApplicationCategory category : categories) {
        chkInput = selector.getUIInput("category_" + category.getName());
        if (chkInput != null && chkInput.isChecked()) {
          Application newApp = cloneApplication(selector.getApplication());
          UIApplicationRegistryPortlet.setPermissionToEveryone(newApp);
          appRegService.save(category, newApp);
        }
      }
      UIContainer appInfo = selector.getParent();
      appInfo.getChild(UICategorySelector.class).setRendered(false);
      UIApplicationRegistryPortlet uiPortlet =
          appInfo.getAncestorOfType(UIApplicationRegistryPortlet.class);
      UIApplicationOrganizer uiOrganizer = uiPortlet.getChild(UIApplicationOrganizer.class);
      UIGadgetManagement uiGadgetManagement = uiPortlet.getChild(UIGadgetManagement.class);

      uiOrganizer.reload();
      if (uiGadgetManagement != null) {
        uiGadgetManagement.setSelectedGadget(selector.getApplication().getApplicationName());
      }

      event.getRequestContext().addUIComponentToUpdateByAjax(appInfo);
    }
示例#2
0
 public void execute(Event<UISelectUserForm> event) throws Exception {
   UISelectUserForm uiForm = event.getSource();
   UIPopupContainer uiContainer = uiForm.getAncestorOfType(UIPopupContainer.class);
   UIEventForm uiEventForm = uiContainer.findFirstComponentOfType(UIEventForm.class);
   if (uiEventForm != null) {
     StringBuilder sb = new StringBuilder();
     for (Object o : uiForm.uiIterator_.getCurrentPageData()) {
       User u = (User) o;
       UIFormCheckBoxInput input = uiForm.getUIFormCheckBoxInput(u.getUserName());
       if (input != null && input.isChecked()) {
         if (sb != null && sb.length() > 0) sb.append(CalendarUtils.COMMA);
         sb.append(u.getUserName());
       }
     }
     if (CalendarUtils.isEmpty(sb.toString())) {
       event
           .getRequestContext()
           .getUIApplication()
           .addMessage(new ApplicationMessage("UISelectUserForm.msg.user-required", null));
       return;
     }
     uiEventForm.setSelectedTab(uiForm.tabId_);
     event.getRequestContext().addUIComponentToUpdateByAjax(uiEventForm.getParent());
   }
   UIPopupAction chilPopup = uiContainer.getChild(UIPopupAction.class);
   chilPopup.deActivate();
   event.getRequestContext().addUIComponentToUpdateByAjax(chilPopup);
 }
 public void execute(Event<UISyntaxSettingForm> event) throws Exception {
   UIWikiPortlet wikiPortlet = event.getSource().getAncestorOfType(UIWikiPortlet.class);
   UIWikiSyntaxPreferences uiSyntaxPreferences =
       wikiPortlet.findComponentById(PREFERENCES_SYNTAX);
   UIFormSelectBox defaultSyntaxSelect =
       uiSyntaxPreferences.getChildById(UIWikiSyntaxPreferences.FIELD_SYNTAX);
   UIFormCheckBoxInput<Boolean> allowCheckBox =
       uiSyntaxPreferences.getChildById(UIWikiSyntaxPreferences.FIELD_ALLOW);
   WikiPreferences preferences = Utils.getCurrentPreferences();
   WikiPreferencesSyntax preferencesSyntax = preferences.getWikiPreferencesSyntax();
   preferencesSyntax.setAllowMultipleSyntaxes(allowCheckBox.isChecked());
   preferencesSyntax.setDefaultSyntax(defaultSyntaxSelect.getValue());
   event
       .getRequestContext()
       .getUIApplication()
       .addMessage(
           new ApplicationMessage(
               "UISyntaxSettingForm.msg.Save-syntax-setting-success",
               null,
               ApplicationMessage.INFO));
 }
示例#4
0
  @Override
  public void activate() {
    UIJCRExplorer uiExplorer = getAncestorOfType(UIJCRExplorer.class);
    try {
      currentNode = uiExplorer.getCurrentNode();
      initParams();
    } catch (Exception E) {
      return;
    }

    /** node field */
    UIFormStringInput uiFormNameValueStringInput = new UIFormStringInput(NODE, NODE, nameValue_);
    uiFormNameValueStringInput.setEditable(false);

    /** visible field */
    UIFormCheckBoxInput<Boolean> uiFormVisibleValueCheckBoxInput =
        new UIFormCheckBoxInput<Boolean>(IS_VISIBLE, IS_VISIBLE, false);
    uiFormVisibleValueCheckBoxInput.setChecked(isVisible);

    /** navigation node field */
    UIFormStringInput uiFormNavigationNodeValueStringInput =
        new UIFormStringInput(
            NAVIGATION_NODE_STRING_INPUT, NAVIGATION_NODE_STRING_INPUT, navigationNode_);
    uiFormNavigationNodeValueStringInput.setEditable(false);

    UIFormInputSetWithAction navigationNodeInputSet =
        new UIFormInputSetWithAction(NAVIGATION_NODE_INPUT_SET);
    navigationNodeInputSet.setActionInfo(
        NAVIGATION_NODE_STRING_INPUT,
        new String[] {"SelectNavigationNode", "RemoveNavigationNode"});
    navigationNodeInputSet.addUIFormInput(uiFormNavigationNodeValueStringInput);

    /** index field */
    UIFormStringInput uiFormIndexValueStringInput =
        new UIFormStringInput(INDEX, INDEX, String.valueOf(index_));
    try {
      uiFormIndexValueStringInput.addValidator(NumberFormatValidator.class);
    } catch (Exception E) {
      // TODO : add log
    }

    /** clickable field */
    UIFormCheckBoxInput<Boolean> uiFormClickableValueCheckBoxInput =
        new UIFormCheckBoxInput<Boolean>(IS_CLICKABLE, IS_CLICKABLE, false);
    uiFormClickableValueCheckBoxInput.setChecked(isClickable);

    /** TARGET PAGE */
    UIFormStringInput uiFormTargetPageValueStringInput =
        new UIFormStringInput(
            LIST_TARGET_PAGE_STRING_INPUT, LIST_TARGET_PAGE_STRING_INPUT, listTargetPage_);
    uiFormTargetPageValueStringInput.setEditable(false);

    UIFormInputSetWithAction targetPageInputSet =
        new UIFormInputSetWithAction(LIST_TARGET_PAGE_INPUT_SET);

    targetPageInputSet.setActionInfo(
        LIST_TARGET_PAGE_STRING_INPUT,
        new String[] {"SelectListTargetPage", "RemoveListTargetPage"});
    targetPageInputSet.addUIFormInput(uiFormTargetPageValueStringInput);

    /** DETAIL_TARGET PAGE */
    UIFormStringInput uiFormDetailTargetPageValueStringInput =
        new UIFormStringInput(
            DETAIL_TARGET_PAGE_STRING_INPUT, DETAIL_TARGET_PAGE_STRING_INPUT, detailTargetPage_);
    uiFormDetailTargetPageValueStringInput.setEditable(false);
    UIFormInputSetWithAction detailTargetPageInputSet =
        new UIFormInputSetWithAction(DETAIL_TARGET_PAGE_INPUT_SET);
    detailTargetPageInputSet.setActionInfo(
        DETAIL_TARGET_PAGE_STRING_INPUT,
        new String[] {"SelectDetailTargetPage", "RemoveDetailTargetPage"});
    detailTargetPageInputSet.addUIFormInput(uiFormDetailTargetPageValueStringInput);

    /*
    if (!navigationNode_.equals("")) {
    	uiFormIndexValueStringInput.setEnable(false);
    	uiFormClickableValueRadioBoxInput.setEnable(false);
    }
    */
    addChild(uiFormNameValueStringInput);
    addChild(uiFormVisibleValueCheckBoxInput);
    addChild(navigationNodeInputSet);
    if (renderIndexField) {
      addChild(uiFormIndexValueStringInput);
    }
    addChild(uiFormClickableValueCheckBoxInput);
    addChild(targetPageInputSet);
    addChild(detailTargetPageInputSet);

    setActions(new String[] {"Save", "Cancel"});
  }