KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonbeller > jpivot > olap > query > DrillReplaceExt


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 package com.tonbeller.jpivot.olap.query;
14
15 import com.tonbeller.jpivot.core.ExtensionSupport;
16 import com.tonbeller.jpivot.olap.model.Hierarchy;
17 import com.tonbeller.jpivot.olap.model.Member;
18 import com.tonbeller.jpivot.olap.navi.DrillReplace;
19
20 /**
21  * @author hh
22  *
23  */

24 public class DrillReplaceExt extends ExtensionSupport implements DrillReplace {
25
26   /**
27    * Constructor sets ID
28    */

29   public DrillReplaceExt() {
30     super.setId(DrillReplace.ID);
31   }
32
33   /**
34    * drill down is possible if <code>member</code> has children
35    */

36   public boolean canDrillDown(Member member) {
37     QueryAdapter.QueryAdapterHolder model = (QueryAdapter.QueryAdapterHolder) getModel();
38     return model.getQueryAdapter().canDrillDown(member);
39   }
40
41   /**
42    * drill up is possible if not all members of the top level
43    * hierarchy are shown.
44    */

45   public boolean canDrillUp(Hierarchy hier) {
46     QueryAdapter.QueryAdapterHolder model = (QueryAdapter.QueryAdapterHolder) getModel();
47     return model.getQueryAdapter().canDrillUp(hier);
48   }
49
50   /**
51    * replaces the members. Let <code>H</code> be the hierarchy
52    * that member belongs to. Then drillDown will replace all members from <code>H</code>
53    * that are currently visible with the children of <code>member</code>.
54    */

55   public void drillDown(Member member) {
56     QueryAdapter.QueryAdapterHolder model = (QueryAdapter.QueryAdapterHolder) getModel();
57     model.getQueryAdapter().drillDown(member);
58   }
59
60   /**
61    * replaces all visible members of hier with the members of the
62    * next higher level.
63    */

64   public void drillUp(Hierarchy hier) {
65     QueryAdapter.QueryAdapterHolder model = (QueryAdapter.QueryAdapterHolder) getModel();
66     model.getQueryAdapter().drillUp(hier);
67   }
68
69 } // End DrillReplaceExt
70
Popular Tags