ar.com.fdvs.dj.domain.builders
Class ColumnBuilder

java.lang.Object
  extended by ar.com.fdvs.dj.domain.builders.ColumnBuilder

public class ColumnBuilder
extends Object

Builder created to give users a friendly way of adding columns to a report.

Usage example:
AbstractColumn columnState = ColumnBuilder.getNew()
.addColumnProperty("state", String.class.getName())
.addTitle("State").addWidth(new Integer(85))
.addStyle(detailStyle).addHeaderStyle(headerStyle).build();

Like with all DJ's builders, it's usage must end with a call to build() mehtod.


Field Summary
static int COLUMN_TYPE_BARCODE
           
static int COLUMN_TYPE_DEFAULT
           
static int COLUMN_TYPE_IMAGE
           
 
Constructor Summary
ColumnBuilder()
           
 
Method Summary
 ColumnBuilder addColumnOperation(ColumnOperation operation, AbstractColumn[] operationColumns)
           
 ColumnBuilder addConditionalStyle(ConditionalStyle conditionalStyle)
           
 ColumnBuilder addConditionalStyles(Collection conditionalStyles)
           
 ColumnBuilder addFieldProperty(String propertyName, String value)
          When the JRField needs properties, use this method.
 AbstractColumn build()
           
protected  AbstractColumn buildExpressionColumn()
          For creating expression columns
protected  AbstractColumn buildOperationColumn()
           
protected  AbstractColumn buildPercentageColumn()
           
protected  AbstractColumn buildSimpleBarcodeColumn()
          When creating barcode columns
protected  AbstractColumn buildSimpleColumn()
          For creating regular columns
protected  AbstractColumn buildSimpleImageColumn()
          When creating image columns
static ColumnBuilder getInstance()
          Deprecated. use getNew()
static ColumnBuilder getNew()
           
protected  void populateCommonAttributes(AbstractColumn column)
           
protected  void populateExpressionAttributes(ExpressionColumn column)
           
 ColumnBuilder setApplicationIdentifier(String applicationIdentifier)
          Only used when barcode type is UCCEAN128
 ColumnBuilder setBarcodeType(int barcodeType)
           
 ColumnBuilder setCheckSum(boolean checkSum)
           
 ColumnBuilder setColumnProperty(ColumnProperty columnProperty)
          Adds a property to the column being created.
 ColumnBuilder setColumnProperty(String propertyName, Class clazz)
           
 ColumnBuilder setColumnProperty(String propertyName, String valueClassName)
          Adds a property to the column being created.
 ColumnBuilder setColumnProperty(String propertyName, String valueClassName, String fieldDescription)
           
 ColumnBuilder setColumnType(int columnType)
          For image columns use: COLUMN_TYPE_IMAGE or COLUMN_TYPE_BARCODE
 ColumnBuilder setCommonProperties(String title, String property, Class clazz, int width, boolean fixedWidth)
           
 ColumnBuilder setCommonProperties(String title, String property, String className, int width, boolean fixedWidth)
           
 ColumnBuilder setCustomExpression(CustomExpression customExpression)
           
 ColumnBuilder setCustomExpressionForCalculation(CustomExpression customExpression)
           
 ColumnBuilder setCustomExpressionToGroupBy(CustomExpression customExpression)
           
 ColumnBuilder setFieldDescription(String fieldDescription)
           
 ColumnBuilder setFixedWidth(boolean bool)
           
 ColumnBuilder setFixedWidth(Boolean bool)
           
 ColumnBuilder setHeaderMarkup(String markup)
          Markup to use in the column header (html, styled, etc)
 ColumnBuilder setHeaderStyle(Style style)
           
 ColumnBuilder setImageScaleMode(ImageScaleMode imageScaleMode)
           
 ColumnBuilder setMarkup(String markup)
          Markup to use in the column data (html, styled, etc)
 ColumnBuilder setPattern(String pattern)
           
 ColumnBuilder setPercentageColumn(PropertyColumn percentageColumn)
           
 ColumnBuilder setPercentageColumn(PropertyColumn percentageColumn, DJGroup group)
          Deprecated.  
 ColumnBuilder setPrintRepeatedValues(boolean bool)
           
 ColumnBuilder setPrintRepeatedValues(Boolean bool)
           
 ColumnBuilder setShowText(boolean showText)
           
 ColumnBuilder setStyle(Style style)
           
 ColumnBuilder setTextFormatter(Format textFormatter)
           
 ColumnBuilder setTitle(String title)
           
 ColumnBuilder setTruncateSuffix(String suffix)
          A suffix to be used in case content does not fit in given space.
 ColumnBuilder setWidth(int width)
           
 ColumnBuilder setWidth(Integer width)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COLUMN_TYPE_DEFAULT

public static final int COLUMN_TYPE_DEFAULT
See Also:
Constant Field Values

COLUMN_TYPE_IMAGE

public static final int COLUMN_TYPE_IMAGE
See Also:
Constant Field Values

COLUMN_TYPE_BARCODE

public static final int COLUMN_TYPE_BARCODE
See Also:
Constant Field Values
Constructor Detail

ColumnBuilder

public ColumnBuilder()
Method Detail

getInstance

public static ColumnBuilder getInstance()
Deprecated. use getNew()

Returns:

getNew

public static ColumnBuilder getNew()

build

public AbstractColumn build()
                     throws ColumnBuilderException
Throws:
ColumnBuilderException

buildSimpleBarcodeColumn

protected AbstractColumn buildSimpleBarcodeColumn()
When creating barcode columns

Returns:

buildSimpleImageColumn

protected AbstractColumn buildSimpleImageColumn()
When creating image columns

Returns:

buildExpressionColumn

protected AbstractColumn buildExpressionColumn()
For creating expression columns

Returns:

populateExpressionAttributes

protected void populateExpressionAttributes(ExpressionColumn column)

buildPercentageColumn

protected AbstractColumn buildPercentageColumn()

buildSimpleColumn

protected AbstractColumn buildSimpleColumn()
For creating regular columns

Returns:

buildOperationColumn

protected AbstractColumn buildOperationColumn()

populateCommonAttributes

protected void populateCommonAttributes(AbstractColumn column)

setTitle

public ColumnBuilder setTitle(String title)

setPattern

public ColumnBuilder setPattern(String pattern)

setPrintRepeatedValues

public ColumnBuilder setPrintRepeatedValues(boolean bool)

setPrintRepeatedValues

public ColumnBuilder setPrintRepeatedValues(Boolean bool)

setWidth

public ColumnBuilder setWidth(Integer width)

setWidth

public ColumnBuilder setWidth(int width)

setStyle

public ColumnBuilder setStyle(Style style)

setHeaderStyle

public ColumnBuilder setHeaderStyle(Style style)

setColumnProperty

public ColumnBuilder setColumnProperty(ColumnProperty columnProperty)
Adds a property to the column being created.

Parameters:
ColumnProperty - columnProperty : BeanUtils like syntax allowed here
Returns:
ColumnBuilder

setColumnProperty

public ColumnBuilder setColumnProperty(String propertyName,
                                       String valueClassName)
Adds a property to the column being created.

Parameters:
ColumnProperty - columnProperty : BeanUtils like syntax allowed here
String - valueClassName
Returns:
ColumnBuilder

setColumnProperty

public ColumnBuilder setColumnProperty(String propertyName,
                                       Class clazz)

setFieldDescription

public ColumnBuilder setFieldDescription(String fieldDescription)

setColumnProperty

public ColumnBuilder setColumnProperty(String propertyName,
                                       String valueClassName,
                                       String fieldDescription)

addFieldProperty

public ColumnBuilder addFieldProperty(String propertyName,
                                      String value)
When the JRField needs properties, use this method.

Parameters:
propertyName -
value -
Returns:

setCustomExpression

public ColumnBuilder setCustomExpression(CustomExpression customExpression)

setCustomExpressionToGroupBy

public ColumnBuilder setCustomExpressionToGroupBy(CustomExpression customExpression)

setCustomExpressionForCalculation

public ColumnBuilder setCustomExpressionForCalculation(CustomExpression customExpression)

addConditionalStyle

public ColumnBuilder addConditionalStyle(ConditionalStyle conditionalStyle)
Parameters:
conditionalStyle -
Returns:

addConditionalStyles

public ColumnBuilder addConditionalStyles(Collection conditionalStyles)
Parameters:
conditionalStyles -
Returns:

addColumnOperation

public ColumnBuilder addColumnOperation(ColumnOperation operation,
                                        AbstractColumn[] operationColumns)

setFixedWidth

public ColumnBuilder setFixedWidth(boolean bool)

setFixedWidth

public ColumnBuilder setFixedWidth(Boolean bool)

setColumnType

public ColumnBuilder setColumnType(int columnType)
For image columns use: COLUMN_TYPE_IMAGE or COLUMN_TYPE_BARCODE

Parameters:
columnType -
Returns:

setImageScaleMode

public ColumnBuilder setImageScaleMode(ImageScaleMode imageScaleMode)

setCommonProperties

public ColumnBuilder setCommonProperties(String title,
                                         String property,
                                         String className,
                                         int width,
                                         boolean fixedWidth)

setCommonProperties

public ColumnBuilder setCommonProperties(String title,
                                         String property,
                                         Class clazz,
                                         int width,
                                         boolean fixedWidth)

setBarcodeType

public ColumnBuilder setBarcodeType(int barcodeType)
Parameters:
barcodeType - use constanst defined in BarcodeTypes
Returns:

setShowText

public ColumnBuilder setShowText(boolean showText)

setCheckSum

public ColumnBuilder setCheckSum(boolean checkSum)

setApplicationIdentifier

public ColumnBuilder setApplicationIdentifier(String applicationIdentifier)
Only used when barcode type is UCCEAN128

Parameters:
applicationIdentifier -
Returns:

setTruncateSuffix

public ColumnBuilder setTruncateSuffix(String suffix)
A suffix to be used in case content does not fit in given space. Must be used with style.setStretchWithOverflow(false);

Parameters:
suffix -
Returns:

setTextFormatter

public ColumnBuilder setTextFormatter(Format textFormatter)

setPercentageColumn

public ColumnBuilder setPercentageColumn(PropertyColumn percentageColumn)

setPercentageColumn

public ColumnBuilder setPercentageColumn(PropertyColumn percentageColumn,
                                         DJGroup group)
Deprecated. 

Use setPercentageColumn(PropertyColumn percentageColumn)


setMarkup

public ColumnBuilder setMarkup(String markup)
Markup to use in the column data (html, styled, etc)

Parameters:
markup -
Returns:

setHeaderMarkup

public ColumnBuilder setHeaderMarkup(String markup)
Markup to use in the column header (html, styled, etc)

Parameters:
markup -
Returns:


Copyright © 2006–2013 FDV Solutions. All rights reserved.