/** @param hierarchyName */ public void removeHierarchy(String hierarchyName) { Hierarchy hierarchy = model.getCube().getHierarchies().get(hierarchyName); ChangeSlicer transform = model.getTransform(ChangeSlicer.class); transform.setSlicer(hierarchy, null); configureFilter(); }
protected void configureFilter() { if (model != null && filterPanel != null) { filterPanel.getChildren().clear(); if (model.isInitialized()) { ChangeSlicer transform = model.getTransform(ChangeSlicer.class); List<Hierarchy> hierarchies = transform.getHierarchies(); for (Hierarchy hierarchy : hierarchies) { UIComponent panel = createFilterItem(hierarchy); filterPanel.getChildren().add(panel); } } } }
/** @return the filterNode */ public TreeNode getFilterNode() { if (model != null && model.isInitialized()) { Hierarchy hierarchy = getHierarchy(); if (filterNode == null && hierarchy != null) { this.filterNode = new DefaultTreeNode(); filterNode.setExpanded(true); List<Member> members; boolean isMeasure; try { members = hierarchy.getRootMembers(); isMeasure = hierarchy.getDimension().getDimensionType() == Type.MEASURE; } catch (OlapException e) { throw new FacesException(e); } for (Member member : members) { if (isMeasure && !member.isVisible()) { continue; } MemberNode node = new MemberNode(member); node.setNodeFilter(this); node.setExpanded(true); node.setSelectable(true); node.setSelected(isSelected(member)); filterNode.getChildren().add(node); } List<TreeNode> initialSelection = ((DefaultTreeNode) filterNode) .collectNodes( new NodeCollector() { @Override public boolean collectNode(TreeNode node) { return node.isSelected(); } @Override public boolean searchNode(TreeNode node) { return node.isExpanded(); } }); this.selection = initialSelection.toArray(new TreeNode[initialSelection.size()]); } } else { this.filterNode = null; } return filterNode; }
protected Hierarchy getHierarchy() { String hierarchyName = getHierarchyName(); if (hierarchyName != null) { return model.getCube().getHierarchies().get(hierarchyName); } return null; }
protected MemberSelection getFilteredMembers() { if (filterMembers == null) { Hierarchy hierarchy = getHierarchy(); if (hierarchy != null) { ChangeSlicer transform = model.getTransform(ChangeSlicer.class); this.filterMembers = new MemberSelection(transform.getSlicer(hierarchy), model.getCube()); if (model instanceof PivotModelImpl) { MemberHierarchyCache cache = ((PivotModelImpl) model).getMemberHierarchyCache(); filterMembers.setMemberHierarchyCache(cache); } } } return filterMembers; }
public void onClose() { ChangeSlicer transform = model.getTransform(ChangeSlicer.class); Hierarchy hierarchy = getHierarchy(); if (!transform.getHierarchies().contains(hierarchy)) { removeHierarchy(getHierarchyName()); } setHierarchyName(null); }
public void apply() { List<Member> members = null; if (selection != null) { members = new ArrayList<Member>(selection.length); for (TreeNode node : selection) { MemberNode memberNode = (MemberNode) node; members.add(memberNode.getObject()); } } ChangeSlicer transform = model.getTransform(ChangeSlicer.class); transform.setSlicer(getHierarchy(), members); }
@PreDestroy protected void destroy() { if (model != null) { model.removeModelChangeListener(this); } }
@PostConstruct protected void initialize() { if (model != null) { model.addModelChangeListener(this); } }