All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ar.com.fdvs.dj.domain.DynamicReport Maven / Gradle / Ivy

Go to download

DynamicJasper (DJ) is an API that hides the complexity of Jasper Reports, it helps developers to save time when designing simple/medium complexity reports generating the layout of the report elements automatically. It creates reports dynamically, defining at runtime the columns, column width (auto width), groups, variables, fonts, charts, crosstabs, sub reports (that can also be dynamic), page size and everything else that you can define at design time. DJ keeps full compatibility with Jasper Reports since it's a tool that helps create reports programmatically in a easy way (it only interferes with the creation of the report design doing the layout of the elements). You can use the classic .jrxml files as templates while the content and layout of the report elements are handled by the DJ API. http://dynamicjasper.com

There is a newer version: 5.3.9
Show newest version
/*
 * Dynamic Jasper: A library for creating reports dynamically by specifying
 * columns, groups, styles, etc. at runtime. It also saves a lot of development
 * time in many cases! (http://sourceforge.net/projects/dynamicjasper)
 *
 * Copyright (C) 2008  FDV Solutions (http://www.fdvsolutions.com)
 *
 * This library 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 2.1 of the License, or (at your option) any later version.
 *
 * This library 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 this library; if not, write to the Free Software
 *
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 *
 *
 */

package ar.com.fdvs.dj.domain;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;

import ar.com.fdvs.dj.core.DJConstants;

/**
 * One of the main classes of this product. It represents the report itself.
 */
public class DynamicReport {

	private String title;
	private String subtitle;
	private Style titleStyle = new Style("reportTitleStyle");
	private Style subtitleStyle = new Style("reportSubtitleStyle");

	private Locale reportLocale = Locale.getDefault();
	private String resourceBundle = null;
	
	protected Map fontsMap = new HashMap(); //

	//
	private List columns = new ArrayList();
	//
	private List columnsGroups = new ArrayList();

	//
	private List charts = new ArrayList();

	private DynamicReportOptions options;

	//Other fields to register, not necesary aigned to columns
	private List fields = new ArrayList();

	//Other parameters needed (E.g. Subreports)
	private List parameters = new ArrayList();

	private String templateFileName = null;

	private List autoTexts = new ArrayList();

	private Map styles = new HashMap();
	
	private DJQuery query;
	
	private String whenNoDataText;
	private Style  whenNoDataStyle;
	private boolean whenNoDataShowTitle = true;
	private boolean whenNoDataShowColumnHeader = true;

	private boolean allowDetailSplit = true;
	
	/**
	 * Defines the behaviour when the datasource is empty.
	 * Valid values are: 
	 * DJConstants.WHEN_NO_DATA_TYPE_NO_PAGES
	 * DJConstants.WHEN_NO_DATA_TYPE_BLANK_PAGE
	 * DJConstants.WHEN_NO_DATA_TYPE_ALL_SECTIONS_NO_DETAIL
	 * DJConstants.WHEN_NO_DATA_TYPE_NO_DATA_SECTION
	 * 
	 * Defatul is: DJConstants.WHEN_NO_DATA_TYPE_NO_PAGES
	 */
	private byte whenNoDataType = DJConstants.WHEN_NO_DATA_TYPE_NO_PAGES;

	/**********************
	 * Defines what to show if a missing resource is referenced
	 * Possible values are:
* DJConstants.WHEN_RESOURCE_MISSING_TYPE_EMPTY: Leaves and empty field.
* DJConstants.WHEN_RESOURCE_MISSING_TYPE_ERROR: Throwns and exception.
* DJConstants.WHEN_RESOURCE_MISSING_TYPE_KEY: Shows the key of the missing resource.
* DJConstants.WHEN_RESOURCE_MISSING_TYPE_NULL: returns NULL **********************/ private byte whenResourceMissing = DJConstants.WHEN_RESOURCE_MISSING_TYPE_KEY; public void addStyle(Style style) { styles.put(style.getName(), style); } public Map getStyles() { return styles; } public void setStyles(Map styles) { this.styles = styles; } public DynamicReport() {} public DynamicReport(String title, List columns, List columnsGroups, List charts, DynamicReportOptions options) { this.title = title; this.columns = columns; this.columnsGroups = columnsGroups; this.charts = charts; this.options = options; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public List getColumns() { return columns; } public void setColumns(List columns) { this.columns = columns; } public List getColumnsGroups() { return columnsGroups; } public void setColumnsGroups(List columnsGroups) { this.columnsGroups = columnsGroups; } public DynamicReportOptions getOptions() { return options; } public void setOptions(DynamicReportOptions options) { this.options = options; } public String getSubtitle() { return subtitle; } public void setSubtitle(String subtitle) { this.subtitle = subtitle; } public Style getSubtitleStyle() { return subtitleStyle; } public void setSubtitleStyle(Style subtitleStyle) { this.subtitleStyle = subtitleStyle; } public Style getTitleStyle() { return titleStyle; } public void setTitleStyle(Style titleStyle) { this.titleStyle = titleStyle; } public String getTemplateFileName() { return templateFileName; } public void setTemplateFileName(String templateFileName) { this.templateFileName = templateFileName; } public List getFields() { return fields; } public void setFields(List fields) { this.fields = fields; } public List getCharts() { return charts; } public void setCharts(List charts) { this.charts = charts; } public List getAutoTexts() { return autoTexts; } public void setAutoTexts(List autoTexts) { this.autoTexts = autoTexts; } public Locale getReportLocale() { return reportLocale; } public void setReportLocale(Locale reportLocale) { this.reportLocale = reportLocale; } public String getResourceBundle() { return resourceBundle; } public void setResourceBundle(String resourceBundle) { this.resourceBundle = resourceBundle; } public DJQuery getQuery() { return query; } public void setQuery(DJQuery query) { this.query = query; } public Map getFontsMap() { return fontsMap; } public void setFontsMap(Map fontsMap) { this.fontsMap = fontsMap; } public byte getWhenNoDataType() { return whenNoDataType; } public void setWhenNoDataType(byte whenNoDataType) { this.whenNoDataType = whenNoDataType; } public byte getWhenResourceMissing() { return whenResourceMissing; } public void setWhenResourceMissing(byte whenResourceMissing) { this.whenResourceMissing = whenResourceMissing; } public String getWhenNoDataText() { return whenNoDataText; } public void setWhenNoDataText(String whenNoDataText) { this.whenNoDataText = whenNoDataText; } public Style getWhenNoDataStyle() { return whenNoDataStyle; } public void setWhenNoDataStyle(Style whenNoDataStyle) { this.whenNoDataStyle = whenNoDataStyle; } public boolean isWhenNoDataShowTitle() { return whenNoDataShowTitle; } public void setWhenNoDataShowTitle(boolean whenNoDataShowTitle) { this.whenNoDataShowTitle = whenNoDataShowTitle; } public boolean isWhenNoDataShowColumnHeader() { return whenNoDataShowColumnHeader; } public void setWhenNoDataShowColumnHeader(boolean whenNoDataShowColumnHeader) { this.whenNoDataShowColumnHeader = whenNoDataShowColumnHeader; } public List getParameters() { return parameters; } public void setParameters(List parameters) { this.parameters = parameters; } public boolean isAllowDetailSplit() { return allowDetailSplit; } public void setAllowDetailSplit(boolean allowDetailSplit) { this.allowDetailSplit = allowDetailSplit; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy