1 13 package com.tonbeller.jpivot.mondrian; 14 15 import java.util.ArrayList ; 16 17 import com.tonbeller.jpivot.olap.model.Hierarchy; 18 import com.tonbeller.jpivot.olap.model.Level; 19 import com.tonbeller.jpivot.olap.model.Visitor; 20 import com.tonbeller.jpivot.olap.query.MDXElement; 21 import com.tonbeller.jpivot.olap.query.MDXLevel; 22 import com.tonbeller.tbutils.res.Resources; 23 24 28 public class MondrianLevel implements Level, MDXElement, MDXLevel { 29 30 private mondrian.olap.Level monLevel; 31 private MondrianHierarchy hierarchy; 32 private ArrayList aMembers; 33 private MondrianModel model; 34 private Resources resources; 35 36 42 protected MondrianLevel( 43 mondrian.olap.Level monLevel, 44 MondrianHierarchy hierarchy, 45 MondrianModel model) { 46 this.monLevel = monLevel; 47 this.hierarchy = hierarchy; 48 this.model = model; 49 this.resources = Resources.instance(model.getLocale(), MondrianLevel.class); 50 aMembers = new ArrayList (); 51 hierarchy.addLevel(this); 52 } 53 54 58 protected void addMember(MondrianMember member) { 59 aMembers.add(member); 60 } 61 62 65 public Hierarchy getHierarchy() { 66 return hierarchy; 67 } 68 69 public String getLabel() { 70 String label = monLevel.getCaption(); 71 return resources.getOptionalString(label, label); 72 } 73 74 78 public int getDepth() { 79 return monLevel.getDepth(); 80 } 81 82 85 public void accept(Visitor visitor) { 86 visitor.visitLevel(this); 87 } 88 89 public Object getRootDecoree() { 90 return this; 91 } 92 93 96 public mondrian.olap.Level getMonLevel() { 97 return monLevel; 98 } 99 100 103 public String getUniqueName() { 104 return monLevel.getUniqueName(); 105 } 106 107 110 public boolean isAll() { 111 return monLevel.isAll(); 112 } 113 114 117 public boolean hasChildLevel() { 118 return (monLevel.getChildLevel() != null); 119 } 120 121 } | Popular Tags |