}
protected void registerEntity(Entity entity) {
// log.debug("registering column...");
//A default name is setted if the user didn't specify one.
AbstractColumn column = (AbstractColumn)entity;
if (column.getName() == null){
column.setName(COLUMN_NAME_PREFIX + colCounter++ );
}
if (column.getConditionalStyles() != null && !column.getConditionalStyles().isEmpty()){
new ConditionalStylesRegistrationManager(getDjd(),getDynamicReport(),column.getName()).registerEntities(column.getConditionalStyles());
}
if (column.getTextFormatter() != null) {
JRDesignParameter parameter = new JRDesignParameter();
parameter.setName(ExpressionUtils.createParameterName("formatter_", column.getTextFormatter()));
parameter.setValueClassName(Object.class.getName());
getDjd().getParametersWithValues().put(parameter.getName(), column.getTextFormatter());
try {
getDjd().addParameter(parameter);
} catch (JRException e) {
log.debug("repeated parameter: " + parameter.getName());
}
}
if (entity instanceof PropertyColumn) {
try {
//addField() will throw an exception only if the column has already been registered.
PropertyColumn propertyColumn = ((PropertyColumn)entity);
log.debug("registering column " + column.getName());
if ( propertyColumn.getColumnProperty() != null && !(entity instanceof ExpressionColumn)){
getDjd().addField((JRField)transformEntity(entity));
}
if (entity instanceof ExpressionColumn) {
//The Custom Expression parameter must be registered