net.sf.dynamicreports.report.builder.component.DimensionComponentBuilder 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 - 2016 Ricardo Mariaca
* 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.builder.component;
import net.sf.dynamicreports.report.base.component.DRDimensionComponent;
import net.sf.dynamicreports.report.builder.group.GroupBuilder;
import net.sf.dynamicreports.report.constant.ComponentDimensionType;
import net.sf.dynamicreports.report.constant.ComponentPositionType;
import net.sf.dynamicreports.report.constant.Constants;
import net.sf.dynamicreports.report.constant.StretchType;
import org.apache.commons.lang3.Validate;
/**
* @author Ricardo Mariaca ([email protected])
*/
@SuppressWarnings("unchecked")
public abstract class DimensionComponentBuilder, U extends DRDimensionComponent> extends ComponentBuilder {
private static final long serialVersionUID = Constants.SERIAL_VERSION_UID;
public DimensionComponentBuilder(U component) {
super(component);
}
/**
* Sets the component preferred dimension.
* @see net.sf.dynamicreports.report.builder.Units
*
* @param width the component preferred width >= 0
* @param height the component preferred height >= 0
* @exception IllegalArgumentException if width
is < 0
* @exception IllegalArgumentException if height
is < 0
*/
public T setDimension(Integer width, Integer height) {
getObject().setWidth(width);
getObject().setHeight(height);
return (T) this;
}
/**
* Sets the component fixed dimension.
* @see net.sf.dynamicreports.report.builder.Units
*
* @param width the component fixed width >= 0
* @param height the component fixed height >= 0
* @exception IllegalArgumentException if width
is < 0
* @exception IllegalArgumentException if height
is < 0
*/
public T setFixedDimension(Integer width, Integer height) {
getObject().setWidth(width);
getObject().setHeight(height);
getObject().setWidthType(ComponentDimensionType.FIXED);
getObject().setHeightType(ComponentDimensionType.FIXED);
return (T) this;
}
/**
* Sets the component minimum dimension.
* @see net.sf.dynamicreports.report.builder.Units
*
* @param width the component minimum width >= 0
* @param height the component minimum height >= 0
* @exception IllegalArgumentException if width
is < 0
* @exception IllegalArgumentException if height
is < 0
*/
public T setMinDimension(Integer width, Integer height) {
getObject().setWidth(width);
getObject().setHeight(height);
getObject().setWidthType(ComponentDimensionType.EXPAND);
getObject().setHeightType(ComponentDimensionType.EXPAND);
return (T) this;
}
/**
* Sets the component preferred width.
* @see net.sf.dynamicreports.report.builder.Units
*
* @param width the component preferred width >= 0
* @exception IllegalArgumentException if width
is < 0
*/
public T setWidth(Integer width) {
getObject().setWidth(width);
return (T) this;
}
/**
* Sets the component fixed width.
* @see net.sf.dynamicreports.report.builder.Units
*
* @param width the component fixed width >= 0
* @exception IllegalArgumentException if width
is < 0
*/
public T setFixedWidth(Integer width) {
getObject().setWidth(width);
getObject().setWidthType(ComponentDimensionType.FIXED);
return (T) this;
}
/**
* Sets the component minimum width.
* @see net.sf.dynamicreports.report.builder.Units
*
* @param width the component minimum width >= 0
* @exception IllegalArgumentException if width
is < 0
*/
public T setMinWidth(Integer width) {
getObject().setWidth(width);
getObject().setWidthType(ComponentDimensionType.EXPAND);
return (T) this;
}
/**
* Sets the component preferred height.
* @see net.sf.dynamicreports.report.builder.Units
*
* @param height the component preferred height >= 0
* @exception IllegalArgumentException if height
is < 0
*/
public T setHeight(Integer height) {
getObject().setHeight(height);
return (T) this;
}
/**
* Sets the component fixed height.
* @see net.sf.dynamicreports.report.builder.Units
*
* @param height the component fixed height >= 0
* @exception IllegalArgumentException if height
is < 0
*/
public T setFixedHeight(Integer height) {
getObject().setHeight(height);
getObject().setHeightType(ComponentDimensionType.FIXED);
return (T) this;
}
/**
* Sets the component minimum height.
* @see net.sf.dynamicreports.report.builder.Units
*
* @param height the component minimum height >= 0
* @exception IllegalArgumentException if height
is < 0
*/
public T setMinHeight(Integer height) {
getObject().setHeight(height);
getObject().setHeightType(ComponentDimensionType.EXPAND);
return (T) this;
}
public T setPositionType(ComponentPositionType positionType) {
getObject().setPositionType(positionType);
return (T) this;
}
public T setStretchType(StretchType stretchType) {
getObject().setStretchType(stretchType);
return (T) this;
}
public T setPrintInFirstWholeBand(Boolean printInFirstWholeBand) {
getObject().setPrintInFirstWholeBand(printInFirstWholeBand);
return (T) this;
}
public T setPrintWhenDetailOverflows(Boolean printWhenDetailOverflows) {
getObject().setPrintWhenDetailOverflows(printWhenDetailOverflows);
return (T) this;
}
public T setPrintWhenGroupChanges(GroupBuilder group) {
Validate.notNull(group, "group must not be null");
getObject().setPrintWhenGroupChanges(group.getGroup());
return (T) this;
}
}