KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonbeller > jpivot > test > olap > TestMemberDeleter


1 /*
2  * ====================================================================
3  * This software is subject to the terms of the Common Public License
4  * Agreement, available at the following URL:
5  * http://www.opensource.org/licenses/cpl.html .
6  * Copyright (C) 2003-2004 TONBELLER AG.
7  * All Rights Reserved.
8  * You must accept the terms of that agreement to use this software.
9  * ====================================================================
10  *
11  *
12  */

13 /*
14  * Created on 11.11.2003
15  *
16  * To change the template for this generated file go to
17  * Window>Preferences>Java>Code Generation>Code and Comments
18  */

19 package com.tonbeller.jpivot.test.olap;
20
21 import java.util.ArrayList JavaDoc;
22 import java.util.List JavaDoc;
23
24 import com.tonbeller.jpivot.olap.model.Member;
25 import com.tonbeller.jpivot.olap.navi.MemberDeleter;
26
27 /**
28  * @author av
29  */

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 JavaDoc list = new ArrayList JavaDoc();
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     // TestOlapModelUtils.rebuildAxis(model(), (TestMember)m);
47
super.fireModelChanged();
48   }
49
50 }
51
Popular Tags