private void registerColumns() {
		for (int i = 0; i < cols.length; i++) {
			DJCrosstabColumn crosstabColumn = cols[i];

			JRDesignCrosstabColumnGroup ctColGroup = new JRDesignCrosstabColumnGroup();
			ctColGroup.setName(crosstabColumn.getProperty().getProperty());
			ctColGroup.setHeight(crosstabColumn.getHeaderHeight());

			JRDesignCrosstabBucket bucket = new JRDesignCrosstabBucket();

            bucket.setValueClassName(crosstabColumn.getProperty().getValueClassName());

			JRDesignExpression bucketExp = ExpressionUtils.createExpression("$F{"+crosstabColumn.getProperty().getProperty()+"}", crosstabColumn.getProperty().getValueClassName());
			bucket.setExpression(bucketExp);

			ctColGroup.setBucket(bucket);

			JRDesignCellContents colHeaerContent = new JRDesignCellContents();
			JRDesignTextField colTitle = new JRDesignTextField();

			JRDesignExpression colTitleExp = new JRDesignExpression();
			colTitleExp.setValueClassName(crosstabColumn.getProperty().getValueClassName());
			colTitleExp.setText("$V{"+crosstabColumn.getProperty().getProperty()+"}");


			colTitle.setExpression(colTitleExp);
			colTitle.setWidth(crosstabColumn.getWidth());
			colTitle.setHeight(crosstabColumn.getHeaderHeight());

			//The height can be the sum of the heights of all the columns starting from the current one, up to the inner most one.
			int auxWidth = calculateRowHeaderMaxWidth(crosstabColumn);
			colTitle.setWidth(auxWidth);

			Style headerstyle = crosstabColumn.getHeaderStyle() == null ? this.djcross.getColumnHeaderStyle(): crosstabColumn.getHeaderStyle();

			if (headerstyle != null){
				layoutManager.applyStyleToElement(headerstyle,colTitle);
				colHeaerContent.setBackcolor(headerstyle.getBackgroundColor());
			}


			colHeaerContent.addElement(colTitle);
			colHeaerContent.setMode( ModeEnum.OPAQUE );

			boolean fullBorder = i <= 0; //Only outer most will have full border
			applyCellBorder(colHeaerContent, fullBorder, false);

			ctColGroup.setHeader(colHeaerContent);

			if (crosstabColumn.isShowTotals())
				createColumTotalHeader(ctColGroup,crosstabColumn,fullBorder);


			try {
				jrcross.addColumnGroup(ctColGroup);
			} catch (JRException e) {
				log.error(e.getMessage(),e);
			}
		}
	}
private void registerColumns ( ) { for ( int i = 0 ; i < cols . length ; i ++ ) { DJCrosstabColumn crosstabColumn = cols [ i ] ; JRDesignCrosstabColumnGroup ctColGroup = new JRDesignCrosstabColumnGroup ( ) ; ctColGroup . setName ( crosstabColumn . getProperty ( ) . getProperty ( ) ) ; ctColGroup . setHeight ( crosstabColumn . getHeaderHeight ( ) ) ; JRDesignCrosstabBucket bucket = new JRDesignCrosstabBucket ( ) ; bucket . setValueClassName ( crosstabColumn . getProperty ( ) . getValueClassName ( ) ) ; JRDesignExpression bucketExp = ExpressionUtils . createExpression ( "$F{" + crosstabColumn . getProperty ( ) . getProperty ( ) + "}" , crosstabColumn . getProperty ( ) . getValueClassName ( ) ) ; bucket . setExpression ( bucketExp ) ; ctColGroup . setBucket ( bucket ) ; JRDesignCellContents colHeaerContent = new JRDesignCellContents ( ) ; JRDesignTextField colTitle = new JRDesignTextField ( ) ; JRDesignExpression colTitleExp = new JRDesignExpression ( ) ; colTitleExp . setValueClassName ( crosstabColumn . getProperty ( ) . getValueClassName ( ) ) ; colTitleExp . setText ( "$V{" + crosstabColumn . getProperty ( ) . getProperty ( ) + "}" ) ; colTitle . setExpression ( colTitleExp ) ; colTitle . setWidth ( crosstabColumn . getWidth ( ) ) ; colTitle . setHeight ( crosstabColumn . getHeaderHeight ( ) ) ; int auxWidth = calculateRowHeaderMaxWidth ( crosstabColumn ) ; colTitle . setWidth ( auxWidth ) ; Style headerstyle = crosstabColumn . getHeaderStyle ( ) == null ? this . djcross . getColumnHeaderStyle ( ) : crosstabColumn . getHeaderStyle ( ) ; if ( headerstyle != null ) { layoutManager . applyStyleToElement ( headerstyle , colTitle ) ; colHeaerContent . setBackcolor ( headerstyle . getBackgroundColor ( ) ) ; } colHeaerContent . addElement ( colTitle ) ; colHeaerContent . setMode ( ModeEnum . OPAQUE ) ; boolean fullBorder = i <= 0 ; applyCellBorder ( colHeaerContent , fullBorder , false ) ; ctColGroup . setHeader ( colHeaerContent ) ; if ( crosstabColumn . isShowTotals ( ) ) createColumTotalHeader ( ctColGroup , crosstabColumn , fullBorder ) ; try { jrcross . addColumnGroup ( ctColGroup ) ; } catch ( JRException e ) { log . error ( e . getMessage ( ) , e ) ; } } }
Registers the Columngroup Buckets and creates the header cell for the columns