Exemplo n.º 1
0
  /** @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();
  }
Exemplo n.º 2
0
  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);
        }
      }
    }
  }
Exemplo n.º 3
0
  /** @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;
  }
Exemplo n.º 4
0
  protected Hierarchy getHierarchy() {
    String hierarchyName = getHierarchyName();

    if (hierarchyName != null) {
      return model.getCube().getHierarchies().get(hierarchyName);
    }

    return null;
  }
Exemplo n.º 5
0
  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;
  }
Exemplo n.º 6
0
  public void onClose() {
    ChangeSlicer transform = model.getTransform(ChangeSlicer.class);

    Hierarchy hierarchy = getHierarchy();

    if (!transform.getHierarchies().contains(hierarchy)) {
      removeHierarchy(getHierarchyName());
    }

    setHierarchyName(null);
  }
Exemplo n.º 7
0
  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);
  }
Exemplo n.º 8
0
 @PreDestroy
 protected void destroy() {
   if (model != null) {
     model.removeModelChangeListener(this);
   }
 }
Exemplo n.º 9
0
 @PostConstruct
 protected void initialize() {
   if (model != null) {
     model.addModelChangeListener(this);
   }
 }