public void execute(Event<UISelectUserForm> event) throws Exception { UISelectUserForm uiAddressForm = event.getSource(); UIPopupContainer uiContainer = uiAddressForm.getAncestorOfType(UIPopupContainer.class); UIPopupAction chilPopup = uiContainer.getChild(UIPopupAction.class); chilPopup.deActivate(); event.getRequestContext().addUIComponentToUpdateByAjax(chilPopup); }
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<UISelectUserForm> event) throws Exception { UISelectUserForm uiForm = event.getSource(); uiForm.setSelectedGroup(uiForm.getSelectedGroup()); uiForm.setKeyword(null); OrganizationService service = CalendarUtils.getOrganizationService(); if (!CalendarUtils.isEmpty(uiForm.getSelectedGroup())) { uiForm.uiIterator_.setPageList( service.getUserHandler().findUsersByGroup(uiForm.getSelectedGroup())); } else { uiForm.uiIterator_.setPageList(service.getUserHandler().getUserPageList(0)); } for (String s : uiForm.pars_) { if (uiForm.getUIFormCheckBoxInput(s) != null) uiForm.getUIFormCheckBoxInput(s).setChecked(true); } event.getRequestContext().addUIComponentToUpdateByAjax(uiForm); }
public void execute(Event<UISelectUserForm> event) throws Exception { UISelectUserForm uiForm = event.getSource(); OrganizationService service = uiForm.getApplicationComponent(OrganizationService.class); String keyword = uiForm.getUIStringInput(FIELD_KEYWORD).getValue(); String filter = uiForm.getUIFormSelectBox(FIELD_FILTER).getValue(); // uiForm.groupId_ = null ; // uiForm.setSelectedGroup(null) ; if (CalendarUtils.isEmpty(keyword)) { uiForm.init(uiForm.pars_); } else { keyword = "*" + keyword + "*"; Query q = new Query(); if (USER_NAME.equals(filter)) { q.setUserName(keyword); } if (LAST_NAME.equals(filter)) { q.setLastName(keyword); } if (FIRST_NAME.equals(filter)) { q.setFirstName(keyword); } if (EMAIL.equals(filter)) { q.setEmail(keyword); } List results = new CopyOnWriteArrayList(); results.addAll(service.getUserHandler().findUsers(q).getAll()); MembershipHandler memberShipHandler = service.getMembershipHandler(); String groupId = uiForm.getSelectedGroup(); if (groupId != null && groupId.trim().length() != 0) { for (Object user : results) { if (memberShipHandler .findMembershipsByUserAndGroup(((User) user).getUserName(), groupId) .size() == 0) { results.remove(user); } } } // ObjectPageList objPageList = new ObjectPageList(results, 10) ; LazyPageList<User> pageList = new LazyPageList<User>(new ListAccessImpl<User>(User.class, results), 10); uiForm.uiIterator_.setPageList(pageList); } event.getRequestContext().addUIComponentToUpdateByAjax(uiForm); }
public void execute(Event<UISelectUserForm> event) throws Exception { UISelectUserForm uiSelectUserForm = event.getSource(); int page = Integer.parseInt(event.getRequestContext().getRequestParameter(OBJECTID)); uiSelectUserForm.updateCurrentPage(page); event.getRequestContext().addUIComponentToUpdateByAjax(uiSelectUserForm); }