KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonbeller > jpivot > table > ColumnAxisBuilderImpl


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;
14 import org.w3c.dom.Element JavaDoc;
15
16 import com.tonbeller.jpivot.olap.model.Axis;
17 import com.tonbeller.jpivot.table.span.Span;
18
19 /**
20  * @author av
21  */

22 public class ColumnAxisBuilderImpl extends AxisBuilderSupport implements ColumnAxisBuilder {
23   
24   public ColumnAxisBuilderImpl() {
25     super(new SpanBuilderImpl("column-heading", "heading-heading"));
26     setMemberIndent(false);
27     setShowParentMembers(false);
28     setHierarchyHeader(HIERARCHY_HEADER);
29     setMemberSpan(HIERARCHY_THEN_POSITION_SPAN);
30     setHeaderSpan(HIERARCHY_THEN_POSITION_SPAN);
31   }
32
33   public void buildRow(Element JavaDoc parent, int rowIndex) {
34     final int N = spanCalc.getPositionCount();
35     for (int i = 0; i < N; i++) {
36       boolean even = (i % 2 == 0);
37       Span span = spanCalc.getSpan(i, rowIndex);
38       if (span.isSignificant()) {
39         int colspan = span.getPositionSpan();
40         int rowspan = span.getHierarchySpan();
41         buildHeading(parent, span, rowspan, colspan, even);
42       }
43     }
44   }
45
46   public int getColumnCount() {
47     return spanCalc.getPositionCount();
48   }
49
50   public int getRowCount() {
51     return spanCalc.getHierarchyCount();
52   }
53
54   protected Axis getAxis() {
55     return table.getColumnAxis();
56   }
57 }
58
Popular Tags