public void execute(Event<UICategorySelector> event) throws Exception {
   UICategorySelector selector = event.getSource();
   selector.clearSelectedCategories();
   UIContainer appInfo = selector.getParent();
   appInfo.getChild(UICategorySelector.class).setRendered(false);
   event.getRequestContext().addUIComponentToUpdateByAjax(appInfo);
 }
 public void execute(Event<UICategorySelector> event) throws Exception {
   UICategorySelector selector = event.getSource();
   int page = Integer.parseInt(event.getRequestContext().getRequestParameter(OBJECTID));
   UIFormTableIteratorInputSet inputSet = selector.getChild(UIFormTableIteratorInputSet.class);
   inputSet.getUIFormPageIterator().setCurrentPage(page);
   selector.init();
   event.getRequestContext().addUIComponentToUpdateByAjax(selector);
 }
 public void execute(Event<UICategorySelector> event) throws Exception {
   UICategorySelector selector = event.getSource();
   UICheckBoxInput chkInput;
   for (String category : selector.getSelectedCategories()) {
     chkInput = selector.getUIInput(category);
     chkInput.setChecked(true);
   }
   event.getRequestContext().addUIComponentToUpdateByAjax(selector);
 }
 @Override
 public void execute(Event<UICategorySelector> event) throws Exception {
   UICategorySelector selector = event.getSource();
   ApplicationRegistryService appRegService =
       selector.getApplicationComponent(ApplicationRegistryService.class);
   List<ApplicationCategory> categories = appRegService.getApplicationCategories();
   UICheckBoxInput chkInput;
   for (ApplicationCategory category : categories) {
     chkInput = selector.getUIInput("category_" + category.getName());
     if (chkInput != null && chkInput.isChecked()) {
       selector.addSelectedCategory("category_" + category.getName());
     }
   }
 }
    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>();
      for (ApplicationCategory category : categories) {
        if (selector.getSelectedCategories().contains("category_" + category.getName())) {
          Application newApp = cloneApplication(selector.getApplication());
          UIApplicationRegistryPortlet.setPermissionToAdminGroup(newApp);
          appRegService.save(category, newApp);
        }
      }
      selector.clearSelectedCategories();

      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);
    }