/** * Reset tree into the current selected group. * * @param groupId * @throws Exception */ @SuppressWarnings("unchecked") private void changeGroup(String groupId) throws Exception { OrganizationService service = getApplicationComponent(OrganizationService.class); UIBreadcumbs uiBreadcumb = getChild(UIBreadcumbs.class); uiBreadcumb.setPath(getPath(null, groupId)); UITree tree = getChild(UIFilterableTree.class); Collection<?> sibblingGroup; if (groupId == null) { sibblingGroup = service.getGroupHandler().findGroups(null); tree.setSibbling((List) sibblingGroup); tree.setChildren(null); tree.setSelected(null); selectGroup_ = null; return; } selectGroup_ = service.getGroupHandler().findGroupById(groupId); String parentGroupId = null; if (selectGroup_ != null) parentGroupId = selectGroup_.getParentId(); Group parentGroup = null; if (parentGroupId != null) parentGroup = service.getGroupHandler().findGroupById(parentGroupId); Collection childrenGroup = service.getGroupHandler().findGroups(selectGroup_); sibblingGroup = service.getGroupHandler().findGroups(parentGroup); tree.setSibbling((List) sibblingGroup); tree.setChildren((List) childrenGroup); tree.setSelected(selectGroup_); tree.setParentSelected(parentGroup); }
public void changeGroup(String groupId) throws Exception { OrganizationService service = WCMCoreUtils.getService(OrganizationService.class); UIBreadcumbs uiBreadcumb = getChild(UIBreadcumbs.class); uiBreadcumb.setPath(getPath(null, groupId)); UITree tree = getChild(UITree.class); Collection<?> sibblingGroup; if (groupId == null) { sibblingGroup = service.getGroupHandler().findGroups(null); tree.setSibbling((List) sibblingGroup); tree.setChildren(null); tree.setSelected(null); selectGroup_ = null; return; } selectGroup_ = service.getGroupHandler().findGroupById(groupId); String parentGroupId = null; if (selectGroup_ != null) parentGroupId = selectGroup_.getParentId(); Group parentGroup = null; if (parentGroupId != null) parentGroup = service.getGroupHandler().findGroupById(parentGroupId); Collection childrenGroup = service.getGroupHandler().findGroups(selectGroup_); sibblingGroup = service.getGroupHandler().findGroups(parentGroup); tree.setSibbling((List) sibblingGroup); tree.setChildren((List) childrenGroup); tree.setSelected(selectGroup_); tree.setParentSelected(parentGroup); }