1 13 19 package com.tonbeller.jpivot.test.olap; 20 21 import java.util.ArrayList ; 22 import java.util.List ; 23 24 import com.tonbeller.jpivot.olap.model.Member; 25 import com.tonbeller.jpivot.olap.navi.MemberDeleter; 26 27 30 public class TestMemberDeleter extends TestExtensionSupport implements MemberDeleter { 31 32 public boolean isDeletable(Member m) { 33 return "Measures".equals(m.getLevel().getLabel()); 34 } 35 36 public void delete(Member m) { 37 System.out.println("deleting " + m.getLabel()); 38 TestHierarchy hier = (TestHierarchy) m.getLevel().getHierarchy(); 39 TestMember[] tm = hier.getRootMembers(); 40 List list = new ArrayList (); 41 for (int i = 0; i < tm.length; i++) 42 list.add(tm[i]); 43 list.remove(m); 44 tm = (TestMember[]) list.toArray(new TestMember[0]); 45 hier.setRootMembers(tm); 46 super.fireModelChanged(); 48 } 49 50 } 51 | Popular Tags |