KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonbeller > jpivot > table > navi > DrillExpandPositionUI


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.table.navi;
14
15 import com.tonbeller.jpivot.olap.model.Member;
16 import com.tonbeller.jpivot.olap.model.OlapModel;
17 import com.tonbeller.jpivot.olap.model.Position;
18 import com.tonbeller.jpivot.olap.navi.DrillExpandPosition;
19 import com.tonbeller.jpivot.table.span.Span;
20
21 /**
22  * Created on 29.11.2002
23  *
24  * @author av
25  */

26 public class DrillExpandPositionUI extends DrillExpandUI {
27   public static final String JavaDoc ID = "drillPosition";
28   public String JavaDoc getId() {
29     return ID;
30   }
31
32   DrillExpandPosition expandPosition;
33
34   protected boolean initializeExtension() {
35     OlapModel om = table.getOlapModel();
36     expandPosition = (DrillExpandPosition) om.getExtension(DrillExpandPosition.ID);
37     return expandPosition != null;
38   }
39
40   protected boolean canExpand(Span span) {
41     if (!positionContainsMember(span))
42       return false;
43     return expandPosition.canExpand(
44       (Position) span.getPosition().getRootDecoree(),
45       (Member) span.getMember().getRootDecoree());
46   }
47
48   protected boolean canCollapse(Span span) {
49     if (!positionContainsMember(span))
50       return false;
51     return expandPosition.canCollapse(
52       (Position) span.getPosition().getRootDecoree(),
53       (Member) span.getMember().getRootDecoree());
54   }
55
56   protected void expand(Span span) {
57     expandPosition.expand(
58       (Position) span.getPosition().getRootDecoree(),
59       (Member) span.getMember().getRootDecoree());
60   }
61
62   protected void collapse(Span span) {
63     expandPosition.collapse(
64       (Position) span.getPosition().getRootDecoree(),
65       (Member) span.getMember().getRootDecoree());
66   }
67
68   protected String JavaDoc getCollapseImage() {
69     return "drill-position-collapse";
70   }
71
72   protected String JavaDoc getExpandImage() {
73     return "drill-position-expand";
74   }
75
76   protected String JavaDoc getOtherImage() {
77     return "drill-position-other";
78   }
79
80 }
81
Popular Tags