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

net.sf.jasperreports.parts.PartComponentsExtensionsRegistryFactory Maven / Gradle / Ivy

There is a newer version: 6.21.3
Show newest version
/*
 * JasperReports - Free Java Reporting Library.
 * Copyright (C) 2001 - 2019 TIBCO Software Inc. All rights reserved.
 * http://www.jaspersoft.com
 *
 * Unless you have purchased a commercial license agreement from Jaspersoft,
 * the following license terms apply:
 *
 * This program is part of JasperReports.
 *
 * JasperReports 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.
 *
 * JasperReports 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 JasperReports. If not, see .
 */
package net.sf.jasperreports.parts;

import java.util.HashMap;

import net.sf.jasperreports.components.list.ListComponent;
import net.sf.jasperreports.engine.JRPropertiesMap;
import net.sf.jasperreports.engine.component.DefaultComponentXmlParser;
import net.sf.jasperreports.engine.part.DefaultPartComponentsBundle;
import net.sf.jasperreports.engine.part.PartComponentManager;
import net.sf.jasperreports.engine.part.PartComponentsBundle;
import net.sf.jasperreports.extensions.ExtensionsRegistry;
import net.sf.jasperreports.extensions.ExtensionsRegistryFactory;
import net.sf.jasperreports.extensions.ListExtensionsRegistry;
import net.sf.jasperreports.parts.subreport.FillSubreportPartFactory;
import net.sf.jasperreports.parts.subreport.SubreportPartComponentCompiler;

/**
 * Extension registry factory that includes built-in part component implementations.
 * 
 * 

* This registry factory is registered by default in JasperReports. * * @author Lucian Chirita ([email protected]) * @see ListComponent */ public class PartComponentsExtensionsRegistryFactory implements ExtensionsRegistryFactory { public static final String NAMESPACE = "http://jasperreports.sourceforge.net/jasperreports/parts"; public static final String XSD_LOCATION = "http://jasperreports.sourceforge.net/xsd/parts.xsd"; public static final String XSD_RESOURCE = "net/sf/jasperreports/parts/parts.xsd"; public static final String SUBREPORT_PART_COMPONENT_NAME = "subreportPart"; private static final ExtensionsRegistry REGISTRY; static { final DefaultPartComponentsBundle bundle = new DefaultPartComponentsBundle(); DefaultComponentXmlParser parser = new DefaultComponentXmlParser(); parser.setNamespace(NAMESPACE); parser.setPublicSchemaLocation(XSD_LOCATION); parser.setInternalSchemaResource(XSD_RESOURCE); parser.setDigesterConfigurer(new PartComponentsXmlDigesterConfigurer()); bundle.setXmlParser(parser); HashMap componentManagers = new HashMap(); PartComponentsManager reportManager = new PartComponentsManager(); reportManager.setComponentCompiler(new SubreportPartComponentCompiler()); //listManager.setComponentXmlWriter(xmlHandler); reportManager.setComponentFillFactory(new FillSubreportPartFactory()); componentManagers.put(SUBREPORT_PART_COMPONENT_NAME, reportManager); bundle.setComponentManagers(componentManagers); ListExtensionsRegistry registry = new ListExtensionsRegistry(); registry.add(PartComponentsBundle.class, bundle); REGISTRY = registry; } @Override public ExtensionsRegistry createRegistry(String registryId, JRPropertiesMap properties) { return REGISTRY; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy