net.sf.dynamicreports.report.base.crosstab.DRCrosstabGroup Maven / Gradle / Ivy
/*
* DynamicReports - Free Java reporting library for creating reports dynamically
*
* Copyright (C) 2010 - 2018 Ricardo Mariaca and the Dynamic Reports Contributors
*
* This file is part of DynamicReports.
*
* DynamicReports is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DynamicReports is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with DynamicReports. If not, see .
*/
package net.sf.dynamicreports.report.base.crosstab;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import org.apache.commons.lang3.Validate;
import net.sf.dynamicreports.report.ReportUtils;
import net.sf.dynamicreports.report.base.DRHyperLink;
import net.sf.dynamicreports.report.constant.Constants;
import net.sf.dynamicreports.report.constant.CrosstabTotalPosition;
import net.sf.dynamicreports.report.constant.HorizontalTextAlignment;
import net.sf.dynamicreports.report.constant.OrderType;
import net.sf.dynamicreports.report.constant.TextAdjust;
import net.sf.dynamicreports.report.definition.crosstab.DRICrosstabGroup;
import net.sf.dynamicreports.report.definition.datatype.DRIDataType;
import net.sf.dynamicreports.report.definition.expression.DRIExpression;
import net.sf.dynamicreports.report.definition.expression.DRIPropertyExpression;
import net.sf.dynamicreports.report.definition.expression.DRIValueFormatter;
import net.sf.dynamicreports.report.definition.style.DRIReportStyle;
/**
* Abstract DRCrosstabGroup class.
*
* @author Ricardo Mariaca, Jan Moxter
*
*/
public abstract class DRCrosstabGroup implements DRICrosstabGroup {
private static final long serialVersionUID = Constants.SERIAL_VERSION_UID;
private final String name;
private String headerPattern;
private HorizontalTextAlignment headerHorizontalTextAlignment;
private DRIValueFormatter headerValueFormatter;
private Boolean headerStretchWithOverflow;
private TextAdjust headerTextAdjust;
private DRHyperLink headerHyperLink;
private DRIReportStyle headerStyle;
private List headerPropertyExpressions;
private Boolean showTotal;
private CrosstabTotalPosition totalPosition;
private DRIExpression totalHeaderExpression;
private Boolean totalHeaderStretchWithOverflow;
private TextAdjust totalHeaderTextAdjust;
private DRIReportStyle totalHeaderStyle;
private List totalHeaderPropertyExpressions;
private DRIExpression expression;
private DRIDataType dataType;
private DRIExpression> orderByExpression;
private OrderType orderType;
private DRIExpression> comparatorExpression;
/**
* Constructor for DRCrosstabGroup.
*/
public DRCrosstabGroup() {
this.name = ReportUtils.generateUniqueName("crosstabGroup");
headerPropertyExpressions = new ArrayList<>();
totalHeaderPropertyExpressions = new ArrayList<>();
}
/** {@inheritDoc} */
@Override
public String getName() {
return name;
}
/** {@inheritDoc} */
@Override
public String getHeaderPattern() {
return headerPattern;
}
/**
* Setter for the field headerPattern
.
*
* @param headerPattern a {@link java.lang.String} object.
*/
public void setHeaderPattern(final String headerPattern) {
this.headerPattern = headerPattern;
}
/** {@inheritDoc} */
@Override
public HorizontalTextAlignment getHeaderHorizontalTextAlignment() {
return headerHorizontalTextAlignment;
}
/**
* Setter for the field headerHorizontalTextAlignment
.
*
* @param headerHorizontalTextAlignment a {@link net.sf.dynamicreports.report.constant.HorizontalTextAlignment} object.
*/
public void setHeaderHorizontalTextAlignment(final HorizontalTextAlignment headerHorizontalTextAlignment) {
this.headerHorizontalTextAlignment = headerHorizontalTextAlignment;
}
/** {@inheritDoc} */
@Override
public DRIValueFormatter getHeaderValueFormatter() {
return headerValueFormatter;
}
/**
* Setter for the field headerValueFormatter
.
*
* @param headerValueFormatter a {@link net.sf.dynamicreports.report.definition.expression.DRIValueFormatter} object.
*/
public void setHeaderValueFormatter(final DRIValueFormatter headerValueFormatter) {
this.headerValueFormatter = headerValueFormatter;
}
/** {@inheritDoc} */
@Override
public Boolean getHeaderStretchWithOverflow() {
return headerStretchWithOverflow;
}
/**
* Setter for the field headerStretchWithOverflow
.
*
* @param headerStretchWithOverflow a {@link java.lang.Boolean} object.
* @deprecated replaced by {@link #setHeaderTextAdjust(TextAdjust)}
*/
@Deprecated
public void setHeaderStretchWithOverflow(final Boolean headerStretchWithOverflow) {
this.headerStretchWithOverflow = headerStretchWithOverflow;
}
/** {@inheritDoc} */
@Override
public TextAdjust getHeaderTextAdjust() {
return this.headerTextAdjust;
}
/**
* Setter for the field setHeaderTextAdjust
.
*
* @param headerTextAdjust a {@link net.sf.dynamicreports.report.constant.TextAdjust} object.
*/
public void setHeaderTextAdjust(final TextAdjust headerTextAdjust) {
this.headerTextAdjust = headerTextAdjust;
}
/** {@inheritDoc} */
@Override
public DRHyperLink getHeaderHyperLink() {
return headerHyperLink;
}
/**
* Setter for the field headerHyperLink
.
*
* @param headerHyperLink a {@link net.sf.dynamicreports.report.base.DRHyperLink} object.
*/
public void setHeaderHyperLink(final DRHyperLink headerHyperLink) {
this.headerHyperLink = headerHyperLink;
}
/** {@inheritDoc} */
@Override
public DRIReportStyle getHeaderStyle() {
return headerStyle;
}
/**
* Setter for the field headerStyle
.
*
* @param headerStyle a {@link net.sf.dynamicreports.report.definition.style.DRIReportStyle} object.
*/
public void setHeaderStyle(final DRIReportStyle headerStyle) {
this.headerStyle = headerStyle;
}
/** {@inheritDoc} */
@Override
public List getHeaderPropertyExpressions() {
return headerPropertyExpressions;
}
/**
* Setter for the field headerPropertyExpressions
.
*
* @param headerPropertyExpressions a {@link java.util.List} object.
*/
public void setHeaderPropertyExpressions(final List headerPropertyExpressions) {
this.headerPropertyExpressions = headerPropertyExpressions;
}
/**
* addHeaderPropertyExpression.
*
* @param headerPropertyExpression a {@link net.sf.dynamicreports.report.definition.expression.DRIPropertyExpression} object.
*/
public void addHeaderPropertyExpression(final DRIPropertyExpression headerPropertyExpression) {
Validate.notNull(headerPropertyExpression, "headerPropertyExpression must not be null");
this.headerPropertyExpressions.add(headerPropertyExpression);
}
/** {@inheritDoc} */
@Override
public Boolean getShowTotal() {
return showTotal;
}
/**
* Setter for the field showTotal
.
*
* @param showTotal a {@link java.lang.Boolean} object.
*/
public void setShowTotal(final Boolean showTotal) {
this.showTotal = showTotal;
}
/** {@inheritDoc} */
@Override
public CrosstabTotalPosition getTotalPosition() {
return totalPosition;
}
/**
* Setter for the field totalPosition
.
*
* @param totalPosition a {@link net.sf.dynamicreports.report.constant.CrosstabTotalPosition} object.
*/
public void setTotalPosition(final CrosstabTotalPosition totalPosition) {
this.totalPosition = totalPosition;
}
/** {@inheritDoc} */
@Override
public DRIExpression getTotalHeaderExpression() {
return totalHeaderExpression;
}
/**
* Setter for the field totalHeaderExpression
.
*
* @param totalHeaderExpression a {@link net.sf.dynamicreports.report.definition.expression.DRIExpression} object.
*/
public void setTotalHeaderExpression(final DRIExpression totalHeaderExpression) {
this.totalHeaderExpression = totalHeaderExpression;
}
/** {@inheritDoc} */
@Override
public Boolean getTotalHeaderStretchWithOverflow() {
return totalHeaderStretchWithOverflow;
}
/**
* Setter for the field totalHeaderStretchWithOverflow
.
*
* @param totalHeaderStretchWithOverflow a {@link java.lang.Boolean} object.
* @deprecated replaced by {@link #setTotalHeaderTextAdjust(TextAdjust)}
*/
@Deprecated
public void setTotalHeaderStretchWithOverflow(final Boolean totalHeaderStretchWithOverflow) {
this.totalHeaderStretchWithOverflow = totalHeaderStretchWithOverflow;
}
/** {@inheritDoc} */
@Override
public TextAdjust getTotalHeaderTextAdjust() {
return this.totalHeaderTextAdjust;
}
/**
* Setter for the field totalHeaderTextAdjust
.
*
* @param headerTextAdjust a {@link net.sf.dynamicreports.report.constant.TextAdjust} object.
*/
public void setTotalHeaderTextAdjust(final TextAdjust headerTextAdjust) {
this.totalHeaderTextAdjust = headerTextAdjust;
}
/** {@inheritDoc} */
@Override
public DRIReportStyle getTotalHeaderStyle() {
return totalHeaderStyle;
}
/**
* Setter for the field totalHeaderStyle
.
*
* @param totalHeaderStyle a {@link net.sf.dynamicreports.report.definition.style.DRIReportStyle} object.
*/
public void setTotalHeaderStyle(final DRIReportStyle totalHeaderStyle) {
this.totalHeaderStyle = totalHeaderStyle;
}
/** {@inheritDoc} */
@Override
public List getTotalHeaderPropertyExpressions() {
return totalHeaderPropertyExpressions;
}
/**
* Setter for the field totalHeaderPropertyExpressions
.
*
* @param totalHeaderPropertyExpressions a {@link java.util.List} object.
*/
public void setTotalHeaderPropertyExpressions(final List totalHeaderPropertyExpressions) {
this.totalHeaderPropertyExpressions = totalHeaderPropertyExpressions;
}
/**
* addTotalHeaderPropertyExpression.
*
* @param totalHeaderPropertyExpression a {@link net.sf.dynamicreports.report.definition.expression.DRIPropertyExpression} object.
*/
public void addTotalHeaderPropertyExpression(final DRIPropertyExpression totalHeaderPropertyExpression) {
Validate.notNull(totalHeaderPropertyExpression, "totalHeaderPropertyExpression must not be null");
this.totalHeaderPropertyExpressions.add(totalHeaderPropertyExpression);
}
/** {@inheritDoc} */
@Override
public DRIExpression getExpression() {
return expression;
}
/**
* Setter for the field expression
.
*
* @param expression a {@link net.sf.dynamicreports.report.definition.expression.DRIExpression} object.
*/
public void setExpression(final DRIExpression expression) {
Validate.notNull(expression, "expression must not be null");
this.expression = expression;
}
/** {@inheritDoc} */
@Override
public DRIDataType getDataType() {
return dataType;
}
/**
* Setter for the field dataType
.
*
* @param dataType a {@link net.sf.dynamicreports.report.definition.datatype.DRIDataType} object.
*/
public void setDataType(final DRIDataType dataType) {
this.dataType = dataType;
}
/** {@inheritDoc} */
@Override
public DRIExpression> getOrderByExpression() {
return orderByExpression;
}
/**
* Setter for the field orderByExpression
.
*
* @param orderByExpression a {@link net.sf.dynamicreports.report.definition.expression.DRIExpression} object.
*/
public void setOrderByExpression(final DRIExpression> orderByExpression) {
this.orderByExpression = orderByExpression;
}
/** {@inheritDoc} */
@Override
public OrderType getOrderType() {
return orderType;
}
/**
* Setter for the field orderType
.
*
* @param orderType a {@link net.sf.dynamicreports.report.constant.OrderType} object.
*/
public void setOrderType(final OrderType orderType) {
this.orderType = orderType;
}
/** {@inheritDoc} */
@Override
public DRIExpression> getComparatorExpression() {
return comparatorExpression;
}
/**
* Setter for the field comparatorExpression
.
*
* @param comparatorExpression a {@link net.sf.dynamicreports.report.definition.expression.DRIExpression} object.
*/
public void setComparatorExpression(final DRIExpression> comparatorExpression) {
this.comparatorExpression = comparatorExpression;
}
/** {@inheritDoc} */
@Override
public Class getValueClass() {
return getExpression().getValueClass();
}
}