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


Java JRDesignParameter.setName方法代码示例

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


在下文中一共展示了JRDesignParameter.setName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: cloneParameter

import net.sf.jasperreports.engine.design.JRDesignParameter; //导入方法依赖的package包/类
/**
 *  Utility function to duplicate a parameter. All the parameter properties
 *  and parameter default value expression are duplicated as well.
 */
public static JRDesignParameter cloneParameter(JRDesignParameter param)
{
    JRDesignParameter newParam = new JRDesignParameter();
    newParam.setName( param.getName() );
    newParam.setForPrompting( param.isForPrompting() );
    newParam.setSystemDefined( param.isSystemDefined() );
    //newParam.setValueClass( param.getValueClass() );
    newParam.setValueClassName( param.getValueClassName() );
    newParam.setDescription( param.getDescription());
    if (param.getDefaultValueExpression() != null)
    {
        newParam.setDefaultValueExpression( cloneExpression( (JRDesignExpression)param.getDefaultValueExpression()) );
    }
    
    // Duplicate properties...
    replacePropertiesMap(param.getPropertiesMap(), newParam.getPropertiesMap());
    
    return newParam;
}
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:24,代码来源:ModelUtils.java

示例3: jList1MouseClicked

import net.sf.jasperreports.engine.design.JRDesignParameter; //导入方法依赖的package包/类
private void jList1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jList1MouseClicked

        if (SwingUtilities.isLeftMouseButton(evt) && evt.getClickCount() == 2 && jList1.getSelectedValue() != null)
        {
            JRDesignParameter p = (JRDesignParameter)jList1.getSelectedValue();
            JRParameterDialog pd = new JRParameterDialog(getReportQueryDialog(),getDataset().getParametersMap());
            pd.setExpressionContext(new ExpressionContext(getDataset()));
            pd.setParameter(p);
            pd.setVisible(true);

            if (pd.getDialogResult() == JOptionPane.OK_OPTION)
            {
                JRDesignParameter pNew = pd.getParameter();

                p.setName(pNew.getName());
                p.setValueClassName(pNew.getValueClassName());
                p.setDefaultValueExpression(pNew.getDefaultValueExpression());

                jList1.updateUI();
            }

        }

    }
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:25,代码来源:SQLFieldsProviderEditor.java

示例4: setParameterAttributes

import net.sf.jasperreports.engine.design.JRDesignParameter; //导入方法依赖的package包/类
protected void setParameterAttributes(JRDesignParameter parameter, Attributes atts)
{
	parameter.setName(atts.getValue(JRXmlConstants.ATTRIBUTE_name));
	
	if (atts.getValue(JRXmlConstants.ATTRIBUTE_class) != null)
	{
		parameter.setValueClassName(atts.getValue(JRXmlConstants.ATTRIBUTE_class));
	}
	
	String nestedType = atts.getValue(JRXmlConstants.ATTRIBUTE_nestedType);
	if (nestedType != null)
	{
		parameter.setNestedTypeName(nestedType);
	}

	String isForPrompting = atts.getValue(JRXmlConstants.ATTRIBUTE_isForPrompting);
	if (isForPrompting != null && isForPrompting.length() > 0)
	{
		parameter.setForPrompting(Boolean.valueOf(isForPrompting).booleanValue());
	}

	ParameterEvaluationTimeEnum evaluationTime = ParameterEvaluationTimeEnum.byName(atts.getValue(JRXmlConstants.ATTRIBUTE_evaluationTime));
	if (evaluationTime != null)
	{
		parameter.setEvaluationTime(evaluationTime);
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:28,代码来源:JRParameterFactory.java

示例5: 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

示例6: setPropertyValue

import net.sf.jasperreports.engine.design.JRDesignParameter; //导入方法依赖的package包/类
public void setPropertyValue(Object id, Object value) {
	if (!isEditable())
		return;
	JRDesignParameter jrParameter = (JRDesignParameter) getValue();
	if (id.equals(JRDesignParameter.PROPERTY_NAME)){
		if (!value.equals("")) {
			jrParameter.setName((String) value);
		} 
	} else if (id.equals(JRDesignParameter.PROPERTY_VALUE_CLASS_NAME)){
			jrParameter.setValueClassName((String) value);
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:13,代码来源:MParameterSystem.java

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: configureElement

import net.sf.jasperreports.engine.design.JRDesignParameter; //导入方法依赖的package包/类
private void configureElement(JRDesignSubreport element) throws IOException, JRException
{
    Boolean useSubParam  = (Boolean)wizard.getProperty("addsubreportparameter");
        String exp = (String)wizard.getProperty("subreportexpression");
        String subreport_directory = (String)wizard.getProperty("subreport_directory");
        String con_exp = (String)wizard.getProperty("subreport_connection_expression");
        String ds_exp = (String)wizard.getProperty("subreport_datasource_expression");
        
        JRParameter[] sub_params = (JRParameter[])wizard.getProperty("subreport_parameters");
        String[] params_expressions = (String[])wizard.getProperty("subreport_parameters_values");
        
        if (useSubParam != null && useSubParam.booleanValue())
        {
            JasperDesign jd = IReportManager.getInstance().getActiveReport();
            
            if (!jd.getParametersMap().containsKey("SUBREPORT_DIR"))
            {
            JRDesignParameter param = new JRDesignParameter();
            param.setName("SUBREPORT_DIR");
            param.setForPrompting(false);
            // TODO: set as directory the target directory for compiled files....
            if (subreport_directory == null)
            {
                subreport_directory = Misc.getDataFolderPath( ((TemplateWizard)wizard).getTargetFolder() ) + File.separator;
            }
            subreport_directory = Misc.string_replace("\\\\","\\",subreport_directory);
            subreport_directory = "\"" + subreport_directory + "\"";
            param.setDefaultValueExpression( Misc.createExpression("java.lang.String", subreport_directory));
            param.setValueClassName("java.lang.String");
            
            // add the parameter to the document...
                try {
                    jd.addParameter(param);
                } catch (JRException ex)
                {}
            }
        }
        
        if (exp != null)
        {
            element.setExpression( Misc.createExpression("java.lang.String", exp) );
        }
        
        if (con_exp != null)
        {
            element.setConnectionExpression( Misc.createExpression("java.sql.Connection", con_exp) );
        }

        if (ds_exp != null)
        {
            element.setDataSourceExpression( Misc.createExpression("net.sf.jasperreports.engine.JRDataSource", ds_exp) );
        }
        
        if (sub_params != null && params_expressions != null)
        {
            for (int i=0; i<sub_params.length && i<params_expressions.length; ++i)
            {
                JRDesignSubreportParameter sp = new JRDesignSubreportParameter();
                sp.setName(  sub_params[i].getName() );
                sp.setExpression( Misc.createExpression(null, params_expressions[i] ) );
                element.addParameter(sp);
            }
        }
}
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:65,代码来源:SubreportWizardIterator.java

示例12: jButtonOKActionPerformed

import net.sf.jasperreports.engine.design.JRDesignParameter; //导入方法依赖的package包/类
private void jButtonOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonOKActionPerformed
    
    String newName = this.jTextFieldName.getText().trim();
    if (newName.length() <= 0)
    {
        javax.swing.JOptionPane.showMessageDialog(this,
                I18n.getString("JRParameterDialog.Message.Warning"),
                I18n.getString("JRParameterDialog.Message.Error"),
                javax.swing.JOptionPane.WARNING_MESSAGE );
        return;
    }
    
    if ( (oldName == null || !oldName.equals(newName)) && currentParameters != null &&
        currentParameters.containsKey(newName))
    {
        javax.swing.JOptionPane.showMessageDialog(this,
                I18n.getString("JRParameterDialog.Message.Warning2"),
                I18n.getString("JRParameterDialog.Message.Error2"),
                javax.swing.JOptionPane.WARNING_MESSAGE );
        return;
    }

    String className = "";
    Object obj = jComboBox1.getSelectedItem();
    if (obj == null) className = "";
    else if (obj instanceof Tag) className = ((Tag)obj).getValue().toString();
    else className = Misc.nvl(obj,"");
     
    if (className.length() == 0 || !className.matches("(\\p{Alpha}\\p{Alnum}*\\_*\\.)*(\\p{Alpha}\\p{Alnum}*\\_*)"))
    {
        javax.swing.JOptionPane.showMessageDialog(this,
                I18n.getString("JRParameterDialog.Message.InvalidClassName"),
                I18n.getString("JRParameterDialog.Message.InvalidClassNameTitle"),
                javax.swing.JOptionPane.WARNING_MESSAGE );
        return;
    }
    else
    {
        try {
            // Try to check if the class exists...
            Class.forName(className, false, IReportManager.getReportClassLoader());
        } catch (ClassNotFoundException ex) {

            if (javax.swing.JOptionPane.showConfirmDialog(this,
                I18n.getString("JRParameterDialog.Message.UnknownClassName", className),
                I18n.getString("JRParameterDialog.Message.UnknownClassNameTitle"),
                javax.swing.JOptionPane.YES_NO_CANCEL_OPTION,
                javax.swing.JOptionPane.INFORMATION_MESSAGE) != JOptionPane.OK_OPTION)
            {

                return;
            }
        }
        

    }

    tmpParameter = new JRDesignParameter();

    tmpParameter.setName(this.jTextFieldName.getText().trim());
    JRDesignExpression exp = new JRDesignExpression();
    exp.setText(this.jRTextExpressionAreaDefaultExpression.getText());
    tmpParameter.setValueClassName(className);
    exp.setValueClassName(className);
    tmpParameter.setDefaultValueExpression(exp);

    setVisible(false);
    this.setDialogResult( javax.swing.JOptionPane.OK_OPTION);
    dispose();
}
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:71,代码来源:JRParameterDialog.java

示例13: 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

示例14: 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

示例15: 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.setName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。