1 13 package com.tonbeller.jpivot.table; 14 import org.w3c.dom.Element ; 15 16 import com.tonbeller.jpivot.olap.model.Axis; 17 import com.tonbeller.jpivot.table.span.Span; 18 19 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 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 |