当前位置: 首页>>代码示例>>Java>>正文


Java JRXmlUtils类代码示例

本文整理汇总了Java中net.sf.jasperreports.engine.util.JRXmlUtils的典型用法代码示例。如果您正苦于以下问题:Java JRXmlUtils类的具体用法?Java JRXmlUtils怎么用?Java JRXmlUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


JRXmlUtils类属于net.sf.jasperreports.engine.util包,在下文中一共展示了JRXmlUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: SimpleFontExtensionHelper

import net.sf.jasperreports.engine.util.JRXmlUtils; //导入依赖的package包/类
/**
 *
 */
private SimpleFontExtensionHelper()
{
	try
	{
		DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
		factory.setFeature(JRXmlUtils.FEATURE_DISALLOW_DOCTYPE, true);
		
		documentBuilder = factory.newDocumentBuilder();
		documentBuilder.setErrorHandler(this);
	}
	catch (ParserConfigurationException e)
	{
		throw new JRRuntimeException(e);
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:19,代码来源:SimpleFontExtensionHelper.java

示例2: getDocumentBuilder

import net.sf.jasperreports.engine.util.JRXmlUtils; //导入依赖的package包/类
protected DocumentBuilder getDocumentBuilder() throws JRException {
	try{
		if (documentBuilderFactory != null) {
			return documentBuilderFactory.newDocumentBuilder();
		} else {
			return JRXmlUtils.createDocumentBuilder();
		}
	} catch (ParserConfigurationException e)
	{
		throw 
			new JRException(
				EXCEPTION_MESSAGE_KEY_DOCUMENT_BUILDER_CREATION_FAILURE, 
				null,
				e);
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:17,代码来源:JRXmlDocumentProducer.java

示例3: getFields

import net.sf.jasperreports.engine.util.JRXmlUtils; //导入依赖的package包/类
@Override
public List<JRDesignField> getFields(DataAdapterService con, JasperReportsConfiguration jConfig, JRDataset jDataset) throws JRException, UnsupportedOperationException {
	Throwable t = null;
	ArrayList<JRDesignField> fields = new ArrayList<JRDesignField>();
	try {
		String fileName = getDataAdapter().getFileName();
		Document doc = JRXmlUtils.parse(new URL(fileName), XMLUtils.isNamespaceAware(getDataAdapter(), jConfig.getJasperDesign()));
		fields.addAll(getFieldsFromDocument(doc, jConfig, jDataset));
	} catch (IOException e) {
		t = e;
	}

	if (t != null) {
		UIUtils.showError(t);
	}
	return fields;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:18,代码来源:RemoteXMLDataAdapterDescriptor.java

示例4: createCheckboxes

import net.sf.jasperreports.engine.util.JRXmlUtils; //导入依赖的package包/类
protected void createCheckboxes(Properties prop){
	Integer connectionIndex = 0;
	String connectionXML = prop.getProperty("connection." + connectionIndex); //$NON-NLS-1$
	while(connectionXML != null){
		try {
			Document document = JRXmlUtils.parse(new InputSource(new StringReader(connectionXML)));
			NamedNodeMap rootAttributes = document.getChildNodes().item(0).getAttributes();
			String connectionName = rootAttributes.getNamedItem("name").getTextContent(); //$NON-NLS-1$
			String connectionClass = rootAttributes.getNamedItem("connectionClass").getTextContent(); //$NON-NLS-1$
			if (ImportUtility.hasAdapter(connectionClass)){
				Button checkButton = new Button(content, SWT.CHECK);
				String type = connectionClass.substring(connectionClass.lastIndexOf(".")+1); //$NON-NLS-1$
				checkButton.setText(connectionName+" ("+ type + ")"); //$NON-NLS-1$ //$NON-NLS-2$
				checkButton.setData(document);
				selectedElements.add(checkButton);
			}
		} catch (JRException e) {}
		connectionIndex++;
		connectionXML = prop.getProperty("connection." + connectionIndex); //$NON-NLS-1$
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:22,代码来源:ShowAdaptersPage.java

示例5: createCheckboxes

import net.sf.jasperreports.engine.util.JRXmlUtils; //导入依赖的package包/类
protected void createCheckboxes(Properties prop){
	String connectionXML = prop.getProperty("dataAdapters"); //$NON-NLS-1$
	Document document;
	try {
		document = JRXmlUtils.parse(new InputSource(new StringReader(connectionXML)));
		Node actualNode = document.getFirstChild();
		if (actualNode.hasChildNodes()) actualNode = actualNode.getFirstChild();
		else actualNode = null;
		while(actualNode != null){
			if (actualNode.getAttributes() != null){
				String name = actualNode.getChildNodes().item(0).getTextContent();
				String type = actualNode.getAttributes().getNamedItem("class").getTextContent();
				type = type.substring(type.lastIndexOf(".")+1);
				Button checkButton = new Button(content, SWT.CHECK);
				checkButton.setText(name+" ("+ type + ")"); //$NON-NLS-1$ //$NON-NLS-2$
				checkButton.setData(actualNode);
				selectedElements.add(checkButton);
			}
			actualNode = actualNode.getNextSibling();
		}
	} catch (JRException e) {
		e.printStackTrace();
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:25,代码来源:ShowJSSAdaptersPage.java

示例6: loadPreferences

import net.sf.jasperreports.engine.util.JRXmlUtils; //导入依赖的package包/类
/**
 * Load the list of the template set from the preferences file. If one of them has the default 
 * attribute set to true then it will be the selected default. If more of them has the attribute
 * to true only the last one will be the default. A template set is added to the available ones
 * only if it's file exist
 */
private void loadPreferences(){
	String defaults = prefs.get(DEFAULT_KEY, "");
	availableDefaults = new ArrayList<String>();
	if (!defaults.isEmpty()){
		try {
			Document document = JRXmlUtils.parse(new InputSource(new StringReader(defaults)));
			NodeList adapterNodes = document.getDocumentElement().getChildNodes();
			for (int i = 0; i < adapterNodes.getLength(); ++i) {
				Node adapterNode = adapterNodes.item(i);
				if (adapterNode.getNodeType() == Node.ELEMENT_NODE) {
					String path = adapterNode.getAttributes().getNamedItem("path").getNodeValue(); //$NON-NLS-1$
					String defaultReport = adapterNode.getAttributes().getNamedItem("default").getNodeValue(); //$NON-NLS-1$
					//Check file existence
					if (new File(path).exists()){
						availableDefaults.add(path);
						if (Boolean.parseBoolean(defaultReport)) actualDefault = path;
					}
				}
			}
		} catch (JRException e) {
			e.printStackTrace();
		}
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:31,代码来源:DefaultManager.java

示例7: configureReport

import net.sf.jasperreports.engine.util.JRXmlUtils; //导入依赖的package包/类
@Override
protected void configureReport(JasperReportBuilder rb) {
	try {
		rb.setLocale(Locale.ENGLISH)
			.columns(
				column1 =	col.column("Column1", field("field1", type.stringType()).setDescription("@field1")),
				column2 =	col.column("Column2", field("field2", type.integerType())),
				column3 =	col.column("Column3", field("field3", type.bigDecimalType())))
			.setQuery("/data/row1", QueryLanguage.XPATH)
			.setParameter(JRXPathQueryExecuterFactory.PARAMETER_XML_DATA_DOCUMENT, JRXmlUtils.parse(XmlReportTest.class.getResourceAsStream("data.xml")))
			.summary(cmp.subreport(createSubreport()));
	} catch (JRException e) {
		e.printStackTrace();
		Assert.fail(e.getMessage());
	}
}
 
开发者ID:svn2github,项目名称:dynamicreports-jasper,代码行数:17,代码来源:XmlReportTest.java

示例8: fill

import net.sf.jasperreports.engine.util.JRXmlUtils; //导入依赖的package包/类
/**
 *
 */
public void fill() throws JRException
{
	long start = System.currentTimeMillis();
	Map<String, Object> params = new HashMap<String, Object>();
	Document document = JRXmlUtils.parse(JRLoader.getLocationInputStream("data/northwind.xml"));
	params.put(JRXPathQueryExecuterFactory.PARAMETER_XML_DATA_DOCUMENT, document);
	params.put(JRXPathQueryExecuterFactory.XML_DATE_PATTERN, "yyyy-MM-dd");
	params.put(JRXPathQueryExecuterFactory.XML_NUMBER_PATTERN, "#,##0.##");
	params.put(JRXPathQueryExecuterFactory.XML_LOCALE, Locale.ENGLISH);
	params.put(JRParameter.REPORT_LOCALE, Locale.US);
	
	JasperFillManager.fillReportToFile("build/reports/CustomersReport.jasper", params);
	System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:18,代码来源:XmlDataSourceApp.java

示例9: loadDataDocument

import net.sf.jasperreports.engine.util.JRXmlUtils; //导入依赖的package包/类
protected Document loadDataDocument(XmlDataAdapter xmlDataAdapter, Map<String, Object> parameters) throws JRException
{
	DataFileUtils dataFileUtils = DataFileUtils.instance(getParameterContributorContext());
	DataFileStream dataStream = dataFileUtils.getDataStream(
			xmlDataAdapter.getDataFile(), parameters);
	try
	{
		Document dataDocument = JRXmlUtils.parse(dataStream, xmlDataAdapter.isNamespaceAware());
		return dataDocument;
	}
	finally
	{
		dataStream.dispose();
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:16,代码来源:XmlDataAdapterService.java

示例10: JRXmlDataSource

import net.sf.jasperreports.engine.util.JRXmlUtils; //导入依赖的package包/类
public JRXmlDataSource(
		JasperReportsContext jasperReportsContext,
		InputStream in, 
		String selectExpression,
		boolean isNamespaceAware
		) throws JRException 
{
	this(jasperReportsContext, JRXmlUtils.parse(new InputSource(in), isNamespaceAware), selectExpression);
	
	this.inputStream = in;
	this.closeInputStream = false;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:13,代码来源:JRXmlDataSource.java

示例11: subDocument

import net.sf.jasperreports.engine.util.JRXmlUtils; //导入依赖的package包/类
/**
 * Creates a document using the current node as root.
 * 
 * @return a document having the current node as root
 * @throws JRException
 */
@Override
public Document subDocument() throws JRException
{
	if(currentNode == null)
	{
		throw 
			new JRException(
				EXCEPTION_MESSAGE_KEY_NODE_NOT_AVAILABLE,
				(Object[])null);
	}
	
	// create a new document from the current node
	return JRXmlUtils.createDocument(currentNode);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:21,代码来源:JRXmlDataSource.java

示例12: loadServerProfiles

import net.sf.jasperreports.engine.util.JRXmlUtils; //导入依赖的package包/类
public static void loadServerProfiles(MServers root) {
	root.removeChildren();
	serverProfiles.clear();

	Preferences prefs = PropertiesHelper.INSTANCE_SCOPE.getNode(JaspersoftStudioPlugin.getUniqueIdentifier());

	String xml = prefs.get(PREF_TAG, null); //$NON-NLS-1$

	if (xml != null) {
		try {
			Document document = JRXmlUtils.parse(new InputSource(new StringReader(xml)));

			NodeList adapterNodes = document.getDocumentElement().getChildNodes();// .getElementsByTagName("dataAdapter");

			for (int i = 0; i < adapterNodes.getLength(); ++i) {
				Node adapterNode = adapterNodes.item(i);

				if (adapterNode.getNodeType() == Node.ELEMENT_NODE) {
					try {
						ServerProfile sprof = (ServerProfile) CastorUtil.read(adapterNode, MServerProfile.MAPPINGFILE);

						MServerProfile sp = new MServerProfile(root, sprof);
						new MDummy(sp);
						serverProfiles.add(sp);
					} catch (Exception ex) {
						ex.printStackTrace();
					}
				}
			}

		} catch (JRException e) {
			UIUtils.showError(e);
		}
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:36,代码来源:ServerManager.java

示例13: getFields

import net.sf.jasperreports.engine.util.JRXmlUtils; //导入依赖的package包/类
@Override
public List<JRDesignField> getFields(DataAdapterService con, JasperReportsConfiguration jConfig, JRDataset jDataset) throws JRException, UnsupportedOperationException {
	setRecursiveRetrieval(jConfig);
	ArrayList<JRDesignField> fields = new ArrayList<JRDesignField>();
	String fileName = getDataAdapter().getFileName();
	File in = new File(fileName);
	Document doc = JRXmlUtils.parse(in, XMLUtils.isNamespaceAware(getDataAdapter(), jConfig.getJasperDesign()));
	fields.addAll(getFieldsFromDocument(doc, jConfig, jDataset));
	return fields;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:11,代码来源:XMLDataAdapterDescriptor.java

示例14: findAll

import net.sf.jasperreports.engine.util.JRXmlUtils; //导入依赖的package包/类
/**
 * Read all the styles from the properties file
 */
private void findAll() {
	try {
		String xml = prefs.get(PREF_KEYS_STYLES, null);
		if (xml != null) {
			Document document = JRXmlUtils.parse(new InputSource(new StringReader(xml)));

			NodeList adapterNodes = document.getDocumentElement().getChildNodes();
			for (int i = 0; i < adapterNodes.getLength(); ++i) {
				Node adapterNode = adapterNodes.item(i);
				if (adapterNode.getNodeType() == Node.ELEMENT_NODE) {
					// 1. Find out the class of this styles...
					String className = adapterNode.getAttributes().getNamedItem("type").getNodeValue(); //$NON-NLS-1$
					TemplateStyle factory = getBuilder(className); 
					if (factory != null){
						TemplateStyle readStyle = factory.buildFromXML(adapterNode);
						Integer uniequeTemplateId = getId();
						readStyle.storePropertiy(STYLE_ID, uniequeTemplateId);
						styleDescriptors.put(uniequeTemplateId, readStyle);
					}
				}
			}

		} else {
			prefs.put(PREF_KEYS_STYLES, "<templateStyles></templateStyles>");
			prefs.flush();
		}
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:34,代码来源:PreferencesTemplateStylesStorage.java

示例15: readTemplateFromFile

import net.sf.jasperreports.engine.util.JRXmlUtils; //导入依赖的package包/类
public List<TemplateStyle> readTemplateFromFile(String xml) {
	List<TemplateStyle> result = new ArrayList<TemplateStyle>();
	try {
		if (xml != null) {
			Document document = JRXmlUtils.parse(new InputSource(new StringReader(xml)));
			NodeList adapterNodes = document.getDocumentElement().getChildNodes();
			for (int i = 0; i < adapterNodes.getLength(); ++i) {
				Node adapterNode = adapterNodes.item(i);
				if (adapterNode.getNodeType() == Node.ELEMENT_NODE && adapterNode.getAttributes().getNamedItem("type")!=null) {
					// 1. Find out the class of this styles...
					String className = adapterNode.getAttributes().getNamedItem("type").getNodeValue(); //$NON-NLS-1$
					TemplateStyle factory = getBuilder(className); 
					if (factory != null){
						TemplateStyle readStyle = factory.buildFromXML(adapterNode);
						Integer uniequeTemplateId = getId();
						readStyle.storePropertiy(STYLE_ID, uniequeTemplateId);
						result.add(readStyle);
					}
				}
			}

		} 
	} catch (Exception e) {
		e.printStackTrace();
	}
	return result;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:28,代码来源:PreferencesTemplateStylesStorage.java


注:本文中的net.sf.jasperreports.engine.util.JRXmlUtils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。