net.sf.dynamicreports.report.base.DRSubtotal 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.
The newest version!
/*
* 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;
import net.sf.dynamicreports.report.base.column.DRColumn;
import net.sf.dynamicreports.report.base.component.DRTextField;
import net.sf.dynamicreports.report.constant.ComponentDimensionType;
import net.sf.dynamicreports.report.constant.Constants;
import net.sf.dynamicreports.report.constant.Position;
import net.sf.dynamicreports.report.constant.SubtotalPosition;
import net.sf.dynamicreports.report.definition.DRISubtotal;
import net.sf.dynamicreports.report.definition.expression.DRIExpression;
import net.sf.dynamicreports.report.definition.style.DRIReportStyle;
import org.apache.commons.lang3.Validate;
/**
* DRSubtotal class.
*
* @author Ricardo Mariaca
*
*/
public class DRSubtotal implements DRISubtotal {
private static final long serialVersionUID = Constants.SERIAL_VERSION_UID;
private DRColumn showInColumn;
private DRTextField valueField;
private SubtotalPosition position;
private DRGroup group;
private DRIExpression labelExpression;
private DRIReportStyle labelStyle;
private Position labelPosition;
private Integer labelWidth;
private ComponentDimensionType labelWidthType;
/**
* Constructor for DRSubtotal.
*
* @param showInColumn a {@link net.sf.dynamicreports.report.base.column.DRColumn} object.
*/
public DRSubtotal(DRColumn showInColumn) {
setShowInColumn(showInColumn);
init();
}
private void init() {
valueField = new DRTextField();
}
/** {@inheritDoc} */
@Override
public DRColumn getShowInColumn() {
return showInColumn;
}
/**
* Setter for the field showInColumn
.
*
* @param showInColumn a {@link net.sf.dynamicreports.report.base.column.DRColumn} object.
*/
public void setShowInColumn(DRColumn showInColumn) {
Validate.notNull(showInColumn, "showInColumn must not be null");
this.showInColumn = showInColumn;
}
/** {@inheritDoc} */
@Override
public DRTextField getValueField() {
return valueField;
}
/** {@inheritDoc} */
@Override
public DRIExpression getLabelExpression() {
return labelExpression;
}
/**
* Setter for the field labelExpression
.
*
* @param labelExpression a {@link net.sf.dynamicreports.report.definition.expression.DRIExpression} object.
*/
public void setLabelExpression(DRIExpression labelExpression) {
this.labelExpression = labelExpression;
}
/** {@inheritDoc} */
@Override
public DRIReportStyle getLabelStyle() {
return labelStyle;
}
/**
* Setter for the field labelStyle
.
*
* @param labelStyle a {@link net.sf.dynamicreports.report.definition.style.DRIReportStyle} object.
*/
public void setLabelStyle(DRIReportStyle labelStyle) {
this.labelStyle = labelStyle;
}
/** {@inheritDoc} */
@Override
public Position getLabelPosition() {
return labelPosition;
}
/**
* Setter for the field labelPosition
.
*
* @param labelPosition a {@link net.sf.dynamicreports.report.constant.Position} object.
*/
public void setLabelPosition(Position labelPosition) {
this.labelPosition = labelPosition;
}
/** {@inheritDoc} */
@Override
public Integer getLabelWidth() {
return labelWidth;
}
/**
* Setter for the field labelWidth
.
*
* @param labelWidth a {@link java.lang.Integer} object.
*/
public void setLabelWidth(Integer labelWidth) {
this.labelWidth = labelWidth;
}
/** {@inheritDoc} */
@Override
public ComponentDimensionType getLabelWidthType() {
return labelWidthType;
}
/**
* Setter for the field labelWidthType
.
*
* @param labelWidthType a {@link net.sf.dynamicreports.report.constant.ComponentDimensionType} object.
*/
public void setLabelWidthType(ComponentDimensionType labelWidthType) {
this.labelWidthType = labelWidthType;
}
/** {@inheritDoc} */
@Override
public SubtotalPosition getPosition() {
return position;
}
/**
* Setter for the field position
.
*
* @param position a {@link net.sf.dynamicreports.report.constant.SubtotalPosition} object.
*/
public void setPosition(SubtotalPosition position) {
Validate.notNull(position, "position must not be null");
this.position = position;
}
/** {@inheritDoc} */
@Override
public DRGroup getGroup() {
return group;
}
/**
* Setter for the field group
.
*
* @param group a {@link net.sf.dynamicreports.report.base.DRGroup} object.
*/
public void setGroup(DRGroup group) {
this.group = group;
}
/** {@inheritDoc} */
@Override
public String getName() {
return valueField.getValueExpression().getName();
}
/** {@inheritDoc} */
@Override
public Class getValueClass() {
return valueField.getValueExpression().getValueClass();
}
}