net.sf.dynamicreports.report.base.DRGroup Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dynamicreports-core Show documentation
Show all versions of dynamicreports-core Show documentation
DynamicReports is an open source Java reporting library based on JasperReports. It allows to create dynamic report designs and it doesn't need a visual report designer.
You can very quickly create reports and produce documents that can be displayed, printed or exported into many popular formats such as PDF, Excel, Word and others.
/*
* DynamicReports - Free Java reporting library for creating reports dynamically
*
* Copyright (C) 2010 - 2018 Ricardo Mariaca and the Dynamic Reports Contributors
* http://www.dynamicreports.org
*
* 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;
import net.sf.dynamicreports.report.ReportUtils;
import net.sf.dynamicreports.report.base.component.DRTextField;
import net.sf.dynamicreports.report.constant.Constants;
import net.sf.dynamicreports.report.constant.GroupFooterPosition;
import net.sf.dynamicreports.report.constant.GroupHeaderLayout;
import net.sf.dynamicreports.report.definition.DRIGroup;
import net.sf.dynamicreports.report.definition.expression.DRIExpression;
import net.sf.dynamicreports.report.definition.style.DRIReportStyle;
import org.apache.commons.lang3.Validate;
/**
* DRGroup class.
*
* @author Ricardo Mariaca ([email protected])
* @version $Id: $Id
*/
public class DRGroup implements DRIGroup {
private static final long serialVersionUID = Constants.SERIAL_VERSION_UID;
private String name;
private DRTextField valueField;
private DRIExpression titleExpression;
private DRIReportStyle titleStyle;
private Integer titleWidth;
private GroupHeaderLayout headerLayout;
private Boolean hideColumn;
private Boolean groupByDataType;
private Boolean showColumnHeaderAndFooter;
private Boolean addToTableOfContents;
private DRIExpression printSubtotalsWhenExpression;
private Integer padding;
private Boolean startInNewPage;
private Boolean startInNewColumn;
private Boolean reprintHeaderOnEachPage;
private Boolean resetPageNumber;
private Integer minHeightToStartNewPage;
private GroupFooterPosition footerPosition;
private Boolean keepTogether;
private Boolean headerWithSubtotal;
private DRBand headerBand;
private DRBand footerBand;
/**
* Constructor for DRGroup.
*
* @param valueField a {@link net.sf.dynamicreports.report.base.component.DRTextField} object.
*/
public DRGroup(DRTextField valueField) {
this(ReportUtils.generateUniqueName("group"), valueField);
}
/**
* Constructor for DRGroup.
*
* @param name a {@link java.lang.String} object.
* @param valueField a {@link net.sf.dynamicreports.report.base.component.DRTextField} object.
*/
public DRGroup(String name, DRTextField valueField) {
Validate.notEmpty(name, "name must not be empty");
Validate.notNull(valueField, "valueField must not be null");
this.name = name;
this.valueField = valueField;
init();
}
private void init() {
headerBand = new DRBand();
footerBand = new DRBand();
}
/** {@inheritDoc} */
@Override
public String getName() {
return name;
}
/** {@inheritDoc} */
@Override
public DRTextField getValueField() {
return valueField;
}
/** {@inheritDoc} */
@Override
public DRIExpression getTitleExpression() {
return titleExpression;
}
/**
* Setter for the field titleExpression
.
*
* @param titleExpression a {@link net.sf.dynamicreports.report.definition.expression.DRIExpression} object.
*/
public void setTitleExpression(DRIExpression titleExpression) {
this.titleExpression = titleExpression;
}
/** {@inheritDoc} */
@Override
public DRIReportStyle getTitleStyle() {
return titleStyle;
}
/**
* Setter for the field titleStyle
.
*
* @param titleStyle a {@link net.sf.dynamicreports.report.definition.style.DRIReportStyle} object.
*/
public void setTitleStyle(DRIReportStyle titleStyle) {
this.titleStyle = titleStyle;
}
/** {@inheritDoc} */
@Override
public Integer getTitleWidth() {
return titleWidth;
}
/**
* Setter for the field titleWidth
.
*
* @param titleWidth a {@link java.lang.Integer} object.
*/
public void setTitleWidth(Integer titleWidth) {
this.titleWidth = titleWidth;
}
/** {@inheritDoc} */
@Override
public GroupHeaderLayout getHeaderLayout() {
return headerLayout;
}
/**
* Setter for the field headerLayout
.
*
* @param headerLayout a {@link net.sf.dynamicreports.report.constant.GroupHeaderLayout} object.
*/
public void setHeaderLayout(GroupHeaderLayout headerLayout) {
this.headerLayout = headerLayout;
}
/** {@inheritDoc} */
@Override
public Boolean getHideColumn() {
return hideColumn;
}
/**
* Setter for the field hideColumn
.
*
* @param hideColumn a {@link java.lang.Boolean} object.
*/
public void setHideColumn(Boolean hideColumn) {
this.hideColumn = hideColumn;
}
/** {@inheritDoc} */
@Override
public Boolean getGroupByDataType() {
return groupByDataType;
}
/**
* Setter for the field groupByDataType
.
*
* @param groupByDataType a {@link java.lang.Boolean} object.
*/
public void setGroupByDataType(Boolean groupByDataType) {
this.groupByDataType = groupByDataType;
}
/** {@inheritDoc} */
@Override
public Boolean getShowColumnHeaderAndFooter() {
return showColumnHeaderAndFooter;
}
/**
* Setter for the field showColumnHeaderAndFooter
.
*
* @param showColumnHeaderAndFooter a {@link java.lang.Boolean} object.
*/
public void setShowColumnHeaderAndFooter(Boolean showColumnHeaderAndFooter) {
this.showColumnHeaderAndFooter = showColumnHeaderAndFooter;
}
/** {@inheritDoc} */
@Override
public Boolean getAddToTableOfContents() {
return addToTableOfContents;
}
/**
* Setter for the field addToTableOfContents
.
*
* @param addToTableOfContents a {@link java.lang.Boolean} object.
*/
public void setAddToTableOfContents(Boolean addToTableOfContents) {
this.addToTableOfContents = addToTableOfContents;
}
/** {@inheritDoc} */
@Override
public DRIExpression getPrintSubtotalsWhenExpression() {
return printSubtotalsWhenExpression;
}
/**
* Setter for the field printSubtotalsWhenExpression
.
*
* @param printSubtotalsWhenExpression a {@link net.sf.dynamicreports.report.definition.expression.DRIExpression} object.
*/
public void setPrintSubtotalsWhenExpression(DRIExpression printSubtotalsWhenExpression) {
this.printSubtotalsWhenExpression = printSubtotalsWhenExpression;
}
/** {@inheritDoc} */
@Override
public Integer getPadding() {
return padding;
}
/**
* Setter for the field padding
.
*
* @param padding a {@link java.lang.Integer} object.
*/
public void setPadding(Integer padding) {
if (padding != null) {
Validate.isTrue(padding >= 0, "padding must be >= 0");
}
this.padding = padding;
}
/** {@inheritDoc} */
@Override
public Boolean getStartInNewPage() {
return startInNewPage;
}
/**
* Setter for the field startInNewPage
.
*
* @param startInNewPage a {@link java.lang.Boolean} object.
*/
public void setStartInNewPage(Boolean startInNewPage) {
this.startInNewPage = startInNewPage;
}
/** {@inheritDoc} */
@Override
public Boolean getStartInNewColumn() {
return startInNewColumn;
}
/**
* Setter for the field startInNewColumn
.
*
* @param startInNewColumn a {@link java.lang.Boolean} object.
*/
public void setStartInNewColumn(Boolean startInNewColumn) {
this.startInNewColumn = startInNewColumn;
}
/** {@inheritDoc} */
@Override
public Boolean getReprintHeaderOnEachPage() {
return reprintHeaderOnEachPage;
}
/**
* Setter for the field reprintHeaderOnEachPage
.
*
* @param reprintHeaderOnEachPage a {@link java.lang.Boolean} object.
*/
public void setReprintHeaderOnEachPage(Boolean reprintHeaderOnEachPage) {
this.reprintHeaderOnEachPage = reprintHeaderOnEachPage;
}
/** {@inheritDoc} */
@Override
public Boolean getResetPageNumber() {
return resetPageNumber;
}
/**
* Setter for the field resetPageNumber
.
*
* @param resetPageNumber a {@link java.lang.Boolean} object.
*/
public void setResetPageNumber(Boolean resetPageNumber) {
this.resetPageNumber = resetPageNumber;
}
/** {@inheritDoc} */
@Override
public Integer getMinHeightToStartNewPage() {
return minHeightToStartNewPage;
}
/**
* Setter for the field minHeightToStartNewPage
.
*
* @param minHeightToStartNewPage a {@link java.lang.Integer} object.
*/
public void setMinHeightToStartNewPage(Integer minHeightToStartNewPage) {
this.minHeightToStartNewPage = minHeightToStartNewPage;
}
/** {@inheritDoc} */
@Override
public GroupFooterPosition getFooterPosition() {
return footerPosition;
}
/**
* Setter for the field footerPosition
.
*
* @param footerPosition a {@link net.sf.dynamicreports.report.constant.GroupFooterPosition} object.
*/
public void setFooterPosition(GroupFooterPosition footerPosition) {
this.footerPosition = footerPosition;
}
/** {@inheritDoc} */
@Override
public Boolean getKeepTogether() {
return keepTogether;
}
/**
* Setter for the field keepTogether
.
*
* @param keepTogether a {@link java.lang.Boolean} object.
*/
public void setKeepTogether(Boolean keepTogether) {
this.keepTogether = keepTogether;
}
/** {@inheritDoc} */
@Override
public Boolean getHeaderWithSubtotal() {
return headerWithSubtotal;
}
/**
* Setter for the field headerWithSubtotal
.
*
* @param headerWithSubtotal a {@link java.lang.Boolean} object.
*/
public void setHeaderWithSubtotal(Boolean headerWithSubtotal) {
this.headerWithSubtotal = headerWithSubtotal;
}
/** {@inheritDoc} */
@Override
public DRBand getHeaderBand() {
return headerBand;
}
/** {@inheritDoc} */
@Override
public DRBand getFooterBand() {
return footerBand;
}
}