Java Code Examples for net.sf.jasperreports.engine.JRParameter#isForPrompting()

The following examples show how to use net.sf.jasperreports.engine.JRParameter#isForPrompting() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JRBaseParameter.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 *
 */
protected JRBaseParameter(JRParameter parameter, JRBaseObjectFactory factory)
{
	factory.put(parameter, this);
	
	name = parameter.getName();
	description = parameter.getDescription();
	valueClassName = parameter.getValueClassName();
	nestedTypeName = parameter.getNestedTypeName();
	isSystemDefined = parameter.isSystemDefined();
	isForPrompting = parameter.isForPrompting();
	evaluationTime = parameter.getEvaluationTime();

	defaultValueExpression = factory.getExpression(parameter.getDefaultValueExpression());
	
	propertiesMap = parameter.getPropertiesMap().cloneProperties();
}
 
Example 2
Source File: JasperReportsUtil.java    From nextreports-server with Apache License 2.0 6 votes vote down vote up
public static LinkedHashMap<String, Serializable> getJasperReportUserParameters(JasperReport jr) {
    LinkedHashMap<String, Serializable> result = new LinkedHashMap<String, Serializable>();
    JRParameter[] params = jr.getParameters();
    for (JRParameter p : params) {
        if (!p.isSystemDefined() && p.isForPrompting()) {
            JasperParameter jp = new JasperParameter();
            jp.setDescription(p.getDescription());
            jp.setName(p.getName());
            jp.setSystemDefined(p.isSystemDefined());
            jp.setValueClassName(p.getValueClassName());
            result.put(p.getName(), jp);
        }
    }

    return result;
}
 
Example 3
Source File: ReportManager.java    From jdal with Apache License 2.0 6 votes vote down vote up
/**
 * Pre-process file. In case this report includes params, display it.
 * The fact a report has params can be determined at the moment of registering
 * it the system. At this point, it could be possible to have this information
 * thus making this process faster
 * @param report report to process
 */
public boolean preprocessFile(Report report){
	if (log.isDebugEnabled())
		log.debug("ReportManager. Preprocess file: hasQuery -> " + report.getHasQuery());

	if (report.getHasQuery()) {
		JasperReport jasperReport = report.newJasperReport();

		if (log.isDebugEnabled())
				log.debug("Parameters in jasperReport");
		
		Map<String, JRParameter> jrParameters = new HashMap<String, JRParameter>();
		for (JRParameter param : jasperReport.getParameters()) {
			if (!param.isSystemDefined() && param.isForPrompting()){
				if (log.isDebugEnabled())
					log.debug("Param to fill from paramEntry: " + param.getName());
				jrParameters.put(param.getName(), param);					
			}
		}
		if (!jrParameters.isEmpty() && interactive) {
			if (!showParameterDialog(jrParameters)) return false;
		}
	}
	return true;
}