JRDesignBand detail = (JRDesignBand) design.getDetail();
detail.setHeight(report.getOptions().getDetailHeight().intValue());
for (Iterator iter = getVisibleColumns().iterator(); iter.hasNext();) {
AbstractColumn column = (AbstractColumn)iter.next();
/**
* Barcode column
*/
if (column instanceof BarCodeColumn) {
BarCodeColumn barcodeColumn = (BarCodeColumn)column;
JRDesignImage image = new JRDesignImage(new JRDesignStyle().getDefaultStyleProvider());
JRDesignExpression imageExp = new JRDesignExpression();
// imageExp.setText("ar.com.fdvs.dj.core.BarcodeHelper.getBarcodeImage("+barcodeColumn.getBarcodeType() + ", "+ column.getTextForExpression()+ ", "+ barcodeColumn.isShowText() + ", " + barcodeColumn.isCheckSum() + ", " + barcodeColumn.getApplicationIdentifier() + ","+ column.getWidth() +", "+ report.getOptions().getDetailHeight().intValue() + " )" );
//Do not pass column height and width mecause barbecue
//generates the image with wierd dimensions. Pass 0 in both cases
String applicationIdentifier = barcodeColumn.getApplicationIdentifier();
if (applicationIdentifier != null && !"".equals(applicationIdentifier.trim()) ){
applicationIdentifier = "$F{" + applicationIdentifier + "}";
} else {
applicationIdentifier = "\"\"";
}
imageExp.setText("ar.com.fdvs.dj.core.BarcodeHelper.getBarcodeImage("+barcodeColumn.getBarcodeType() + ", "+ column.getTextForExpression()+ ", "+ barcodeColumn.isShowText() + ", " + barcodeColumn.isCheckSum() + ", " + applicationIdentifier + ",0,0 )" );
imageExp.setValueClass(java.awt.Image.class);
image.setExpression(imageExp);
image.setHeight(getReport().getOptions().getDetailHeight().intValue());
image.setWidth(column.getWidth().intValue());
image.setX(column.getPosX().intValue());
image.setScaleImage(barcodeColumn.getScaleMode().getValue());
image.setOnErrorType(JRDesignImage.ON_ERROR_TYPE_ICON); //FIXME should we provide control of this to the user?
applyStyleToElement(column.getStyle(), image);
detail.addElement(image);
}
/**
* Image columns
*/
else if (column instanceof ImageColumn) {
ImageColumn imageColumn = (ImageColumn)column;
JRDesignImage image = new JRDesignImage(new JRDesignStyle().getDefaultStyleProvider());
JRDesignExpression imageExp = new JRDesignExpression();
imageExp.setText(column.getTextForExpression());
imageExp.setValueClassName(imageColumn.getColumnProperty().getValueClassName());
image.setExpression(imageExp);
image.setHeight(getReport().getOptions().getDetailHeight().intValue());
image.setWidth(column.getWidth().intValue());
image.setX(column.getPosX().intValue());
image.setScaleImage(imageColumn.getScaleMode().getValue());
applyStyleToElement(column.getStyle(), image);
detail.addElement(image);
}
/**
* Regular Column
*/
else {
if (column.getConditionalStyles() != null && !column.getConditionalStyles().isEmpty() ){
for (Iterator iterator = column.getConditionalStyles().iterator(); iterator.hasNext();) {
ConditionalStyle condition = (ConditionalStyle) iterator.next();
JRDesignTextField textField = generateTextFieldFromColumn(column, getReport().getOptions().getDetailHeight().intValue(), null);
transformDetailBandTextField(column, textField);
applyStyleToElement(condition.getStyle(), textField);
textField.setPrintWhenExpression(getExpressionForConditionalStyle(condition.getName(), column.getTextForExpression()));
detail.addElement(textField);
}
} else {
JRDesignTextField textField = generateTextFieldFromColumn(column, getReport().getOptions().getDetailHeight().intValue(), null);
transformDetailBandTextField(column, textField);