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


Java JRDesignParameter.setValueClass方法代码示例

本文整理汇总了Java中net.sf.jasperreports.engine.design.JRDesignParameter.setValueClass方法的典型用法代码示例。如果您正苦于以下问题:Java JRDesignParameter.setValueClass方法的具体用法?Java JRDesignParameter.setValueClass怎么用?Java JRDesignParameter.setValueClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.sf.jasperreports.engine.design.JRDesignParameter的用法示例。


在下文中一共展示了JRDesignParameter.setValueClass方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildJRDesignParameters

import net.sf.jasperreports.engine.design.JRDesignParameter; //导入方法依赖的package包/类
public static Map<String,JRDesignParameter> buildJRDesignParameters(Map<String,Object> parameters)
{
	// convert parameters to JRDesignParameters so they can be parsed
	HashMap<String,JRDesignParameter> jrParameters = new HashMap<String,JRDesignParameter>();

	Iterator<String> iterator = parameters.keySet().iterator();
	while (iterator.hasNext())
	{
		String key = iterator.next();
		Object value = parameters.get(key);
		
		if (value != null)
		{
			JRDesignParameter jrParameter = new JRDesignParameter();
			jrParameter.setName(key);
			jrParameter.setValueClass(value.getClass());
			
			jrParameters.put(jrParameter.getName(), jrParameter);
		}			
	}

	return jrParameters;
}
 
开发者ID:mtpettyp,项目名称:openreports,代码行数:24,代码来源:ORUtil.java

示例2: addScriptlet

import net.sf.jasperreports.engine.design.JRDesignParameter; //导入方法依赖的package包/类
public void addScriptlet(String name, Class<? extends JRAbstractScriptlet> type)
{
	JRDesignScriptlet scriptlet = new JRDesignScriptlet();
	scriptlet.setName(name);
	scriptlet.setValueClass(type);
	
	JRDesignParameter parameter = new JRDesignParameter();
	parameter.setName(name + JRScriptlet.SCRIPTLET_PARAMETER_NAME_SUFFIX);
	parameter.setValueClass(scriptlet.getValueClass());
	parameter.setSystemDefined(true);
	parameter.setForPrompting(false);
	
	scriptlets.add(scriptlet);
	parameters.add(parameter);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:16,代码来源:TableReportDataset.java

示例3: addParameter

import net.sf.jasperreports.engine.design.JRDesignParameter; //导入方法依赖的package包/类
private static void addParameter(JasperDesign report, String paramName) {
	try {
		report.removeParameter(paramName);
		JRDesignParameter param = new JRDesignParameter();
		param.setName(paramName);
		param.setValueClass(Object.class);
		report.addParameter(param);
	} catch (Throwable e) {
		throw new RuntimeException(e);
	}

}
 
开发者ID:PGWelch,项目名称:com.opendoorlogistics,代码行数:13,代码来源:SubreportsWithProviderBuilder.java

示例4: addParametersToDisplayReportParameters

import net.sf.jasperreports.engine.design.JRDesignParameter; //导入方法依赖的package包/类
/**
 * add user friendly paramters to the band and report port parameters if not
 * already present
 *
 * @param designFile
 * @param targetBand
 * @param maxY
 * @return
 * @throws JRException
 */
private int addParametersToDisplayReportParameters(JasperDesign designFile, JRDesignBand targetBand, int maxY)
		throws JRException
{
	for (ReportParameter<?> param : reportProperties.getFilterBuilder().getReportParameters())
	{
		if (param.displayInreport())
		{
			for (String parameterName : param.getParameterNames())
			{
				JRDesignStaticText labelElement = new JRDesignStaticText();

				String strippedLabel = param.getLabel(parameterName).replaceAll("ReportParameter", "");

				labelElement.setText(strippedLabel);
				labelElement.setWidth(125);
				labelElement.setHeight(20);
				labelElement.setBackcolor(new Color(208, 208, 208));
				labelElement.setMode(ModeEnum.OPAQUE);
				labelElement.setVerticalAlignment(VerticalAlignEnum.MIDDLE);

				labelElement.setX(0);
				labelElement.setY(maxY);
				labelElement.setFontName("SansSerif");
				labelElement.setFontSize(12);
				targetBand.addElement(labelElement);

				JRDesignTextField valueElement = new JRDesignTextField();
				valueElement.setExpression(new JRDesignExpression("$P{ParamDisplay-" + parameterName + "}"));
				valueElement.setWidth(400);
				valueElement.setHeight(20);
				valueElement.setBackcolor(new Color(208, 208, 208));
				valueElement.setMode(ModeEnum.OPAQUE);

				valueElement.setX(125);
				valueElement.setY(maxY);
				valueElement.setFontName("SansSerif");
				valueElement.setFontSize(12);
				valueElement.setVerticalAlignment(VerticalAlignEnum.MIDDLE);

				targetBand.addElement(valueElement);
				maxY = valueElement.getY() + valueElement.getHeight();

				if (!designFile.getParametersMap().containsKey("ParamDisplay-" + parameterName))
				{
					JRDesignParameter parameter = new JRDesignParameter();
					parameter.setName("ParamDisplay-" + parameterName);
					parameter.setValueClass(String.class);

					parameter.setForPrompting(false);

					designFile.addParameter(parameter);
				}
			}
		}
	}
	return maxY;
}
 
开发者ID:rlsutton1,项目名称:VaadinUtils,代码行数:68,代码来源:JasperManager.java

示例5: addParameter

import net.sf.jasperreports.engine.design.JRDesignParameter; //导入方法依赖的package包/类
private <T> void addParameter(JRDesignDataset jrDataset, Map<String, Object> parameters, String name, Class<T> parameterClass, T value) {
	JRDesignParameter jrParameter = new JRDesignParameter();
	jrParameter.setName(name);
	jrParameter.setValueClass(parameterClass);
	try {
		jrDataset.addParameter(jrParameter);
	} catch (JRException e) {
		throw new JasperDesignException("Registration failed for parameter \"" + name + "\"", e);
	}
	parameters.put(jrParameter.getName(), value);
}
 
开发者ID:svn2github,项目名称:dynamicreports-jasper,代码行数:12,代码来源:DatasetTransform.java

示例6: getTemplate

import net.sf.jasperreports.engine.design.JRDesignParameter; //导入方法依赖的package包/类
public byte[] getTemplate(){
		try{
//			design.remadgetFields().
			design.getFieldsList().clear();
			design.getParametersList().clear();
            design.getFieldsMap().clear();
            design.getParametersMap().clear();
            for (JasperReportFieldDto field : fields) {
				if (field.isEmpty()){
					continue;
				}
				JRDesignField f = new JRDesignField();
				f.setValueClassName(field.getTypeAsString());
				f.setValueClass(Class.forName(field.getTypeAsString()));
				f.setName(field.getName());
				design.addField(f);
			}

			for (JasperReportParameterDto param : parameters) {
				if (param.isEmpty()) {
					continue;
				}
				JRDesignParameter p = new JRDesignParameter();
				p.setValueClassName(param.getTypeAsString());
				p.setValueClass(Class.forName(param.getTypeAsString()));
				p.setName(param.getName());
				p.setForPrompting(param.isForPrompting());
				p.setDescription(param.getDescription());
				p.setNestedTypeName(param.getNestedTypeAsString());
				p.setNestedType(param.getNestedType());
				p.getPropertiesMap().setBaseProperties(param.getJRProperties());
				//			p.getPropertiesMap().setProperty(propName, value);
				design.addParameter(p);
			}

			JasperDesign oldDesign = ReportTypeUtil.loadJasperDesign(jasperReportXml);
			oldDesign.getParametersList().clear();
			oldDesign.getParametersList().addAll(design.getParametersList());

			oldDesign.getFieldsList().clear();
			oldDesign.getFieldsList().addAll(design.getFieldsList());

			JRDesignQuery q = new JRDesignQuery();
			q.setLanguage("mql");
			q.setText(query);
			oldDesign.setQuery(q);

			String reportAsString = JRXmlWriter.writeReport(oldDesign, "UTF-8");
			return Base64.encodeBase64(reportAsString.getBytes("UTF-8"));

		} catch (JRException | ClassNotFoundException | SchemaException | UnsupportedEncodingException ex) {
			throw new IllegalStateException(ex.getMessage(), ex.getCause());
		}
		
	}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:56,代码来源:JasperReportDto.java

示例7: getTemplate

import net.sf.jasperreports.engine.design.JRDesignParameter; //导入方法依赖的package包/类
public byte[] getTemplate(){
		try{
//			design.remadgetFields().
			design.getFieldsList().clear();
			design.getParametersList().clear();
            design.getFieldsMap().clear();
            design.getParametersMap().clear();
            for (JasperReportFieldDto field : fields) {
				if (field.isEmpty()){
					continue;
				}
				JRDesignField f = new JRDesignField();
				f.setValueClassName(field.getTypeAsString());
				f.setValueClass(Class.forName(field.getTypeAsString()));
				f.setName(field.getName());
				design.addField(f);
			}

			for (JasperReportParameterDto param : parameters) {
				if (param.isEmpty()) {
					continue;
				}
				JRDesignParameter p = new JRDesignParameter();
				p.setValueClassName(param.getTypeAsString());
				p.setValueClass(Class.forName(param.getTypeAsString()));
				p.setName(param.getName());
				p.setForPrompting(param.isForPrompting());
				p.setDescription(param.getDescription());
				p.setNestedTypeName(param.getNestedTypeAsString());
				p.setNestedType(param.getNestedType());
				p.getPropertiesMap().setBaseProperties(param.getJRProperties());
				//			p.getPropertiesMap().setProperty(propName, value);
				design.addParameter(p);
			}

			JasperDesign oldDesign = ReportTypeUtil.loadJasperDesign(jasperReportXml);
			oldDesign.getParametersList().clear();
			oldDesign.getParametersList().addAll(design.getParametersList());

			oldDesign.getFieldsList().clear();
			oldDesign.getFieldsList().addAll(design.getFieldsList());

			JRDesignQuery q = new JRDesignQuery();
			q.setLanguage("mql");
			q.setText(query);
			oldDesign.setQuery(q);

			String reportAsString = JRXmlWriter.writeReport(oldDesign, "UTF-8");
			return Base64.encodeBase64(reportAsString.getBytes("UTF-8"));

		} catch (JRException | ClassNotFoundException | SchemaException | UnsupportedEncodingException ex) {
			throw new IllegalStateException(ex.getMessage(), ex.getCause());
		}

	}
 
开发者ID:Evolveum,项目名称:midpoint,代码行数:56,代码来源:JasperReportDto.java

示例8: buildSingleTableDesign

import net.sf.jasperreports.engine.design.JRDesignParameter; //导入方法依赖的package包/类
public JasperDesign buildSingleTableDesign(ODLTableDefinition table,String title, OrientationEnum orientation, boolean hasHeaderMap) {
	if(title==null){
		if(table!=null){
			title = table.getName();
		}else{
			title = "Report";
		}
	}
	int horizontalReduction = ((flags & FLAG_IS_SUBREPORT) != 0) ? 40 : 0;
	JasperDesign ret = ReportBuilderUtils.createEmptyA4(title, orientation, (flags & FLAG_MARGINS) != 0, horizontalReduction);

	// Add fields
	boolean sub = (flags & FLAG_INCLUDES_SUBREPORT) != 0;
	if(table!=null){
		ReportBuilderUtils.addFields(table, sub, ret);			
	}

	// add subreport template property - see http://stackoverflow.com/questions/9785451/generate-jasper-report-with-subreport-from-java
	if (sub) {
		JRDesignParameter parameter = new JRDesignParameter();
		parameter.setName(ReportConstants.SUBREPORT_TEMPLATE_PARAMETER);
		parameter.setValueClass(net.sf.jasperreports.engine.JasperReport.class);
		try {
			ret.addParameter(parameter);
		} catch (Throwable e) {
			throw new RuntimeException(e);
		}
	}

	int pageWidth = ret.getPageWidth();
	int leftMargin = ret.getLeftMargin();
	int rightMargin = ret.getRightMargin();
	int elementWidth = pageWidth - leftMargin - rightMargin - horizontalReduction;

	// Add Title
	if ((flags & FLAG_TITLE) != 0) {
		ReportBuilderUtils.addTitle(title, hasHeaderMap,table!=null, ret);
	}

	if (table != null) {
		ReportBuilderUtils.addColumnHeaderSection(table, elementWidth, ret);
		
		if (sub) {
			ReportBuilderUtils.addDetailBand(table, elementWidth, true, ret);
		} else {
			ReportBuilderUtils.addDetailBand(table, elementWidth, false, ret);
		}
	}

	if ((flags & FLAG_FOOTER) != 0) {
		ReportBuilderUtils.addPageFooter( elementWidth, ret);
	}

	return ret;
}
 
开发者ID:PGWelch,项目名称:com.opendoorlogistics,代码行数:56,代码来源:SingleLevelReportBuilder.java

示例9: createJRParameter

import net.sf.jasperreports.engine.design.JRDesignParameter; //导入方法依赖的package包/类
protected JRParameter createJRParameter() {
    JRDesignParameter jrParameter = new JRDesignParameter();
    jrParameter.setName(CUBA_PARAM);
    jrParameter.setValueClass(com.haulmont.yarg.formatters.impl.jasper.CubaJRFunction.class);
    return jrParameter;
}
 
开发者ID:cuba-platform,项目名称:yarg,代码行数:7,代码来源:JasperFormatter.java


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