本文整理汇总了Java中net.sf.jasperreports.engine.JRParameter.getName方法的典型用法代码示例。如果您正苦于以下问题:Java JRParameter.getName方法的具体用法?Java JRParameter.getName怎么用?Java JRParameter.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.jasperreports.engine.JRParameter
的用法示例。
在下文中一共展示了JRParameter.getName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: JRBaseParameter
import net.sf.jasperreports.engine.JRParameter; //导入方法依赖的package包/类
/**
*
*/
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();
}
示例2: addParameter
import net.sf.jasperreports.engine.JRParameter; //导入方法依赖的package包/类
/**
* Inserts a parameter at the specified position into the dataset.
* @param index the parameter position
* @param parameter the parameter to insert
* @throws JRException
* @see net.sf.jasperreports.engine.JRDataset#getParameters()
*/
public void addParameter(int index, JRParameter parameter) throws JRException
{
if (parametersMap.containsKey(parameter.getName()))
{
throw
new JRException(
EXCEPTION_MESSAGE_KEY_DUPLICATE_PARAMETER,
new Object[]{parameter.getName()});
}
parametersList.add(index, parameter);
parametersMap.put(parameter.getName(), parameter);
getEventSupport().fireCollectionElementAddedEvent(PROPERTY_PARAMETERS, parameter, index);
}
示例3: JasperReportParameterDto
import net.sf.jasperreports.engine.JRParameter; //导入方法依赖的package包/类
public JasperReportParameterDto(JRParameter param) {
this.name = param.getName();
this.typeAsString = param.getValueClassName();
this.type = (Class<?>) param.getValueClass();
this.forPrompting = param.isForPrompting();
if (param.getDescription() != null){
this.description = param.getDescription();
}
this.nestedType = param.getNestedType();
this.nestedTypeAsString = param.getNestedTypeName();
this.value = new ArrayList<>();
this.value.add(new JasperReportValueDto());
this.properties = new JasperReportParameterPropertiesDto(param.getPropertiesMap());
}
示例4: verifyParameters
import net.sf.jasperreports.engine.JRParameter; //导入方法依赖的package包/类
/**
*
*/
private void verifyParameters(JRDesignDataset dataset)
{
JRParameter[] parameters = dataset.getParameters();
if (parameters != null && parameters.length > 0)
{
for(int index = 0; index < parameters.length; index++)
{
JRParameter parameter = parameters[index];
Object errorSource = parameter;
if (parameter.isSystemDefined())
{
errorSource = jasperDesign;
}
if (parameter.getName() == null || parameter.getName().trim().length() == 0)
{
addBrokenRule("Parameter name missing.", errorSource);
}
if (parameter.getValueClassName() == null)
{
addBrokenRule("Class not set for parameter : " + parameter.getName(), errorSource);
}
}
}
}
示例5: evaluateParameterDefaultValues
import net.sf.jasperreports.engine.JRParameter; //导入方法依赖的package包/类
/**
* Evaluates the default values for the parameters of a report.
*
* @param report the report
* @param initialParameters initial parameter value map
* @return a map containing parameter values indexed by parameter names
* @throws JRException
*/
public static Map<String,Object> evaluateParameterDefaultValues(JasperReportsContext jasperReportsContext, JasperReport report, Map<String,Object> initialParameters) throws JRException
{
Map<String,Object> valuesMap = initialParameters == null ? new HashMap<String,Object>() : new HashMap<String,Object>(initialParameters);
valuesMap.put(JRParameter.JASPER_REPORT, report);
ObjectFactory factory = new ObjectFactory();
JRDataset reportDataset = report.getMainDataset();
JRFillDataset fillDataset = factory.getDataset(reportDataset);
fillDataset.setJasperReportsContext(LocalJasperReportsContext.getLocalContext(jasperReportsContext, initialParameters));
fillDataset.createCalculator(report);
fillDataset.initCalculator();
JRResourcesFillUtil.ResourcesFillContext resourcesContext =
JRResourcesFillUtil.setResourcesFillContext(valuesMap);
try
{
fillDataset.setParameterValues(valuesMap);
Map<String,Object> parameterValues = new HashMap<String,Object>();
JRParameter[] parameters = reportDataset.getParameters();
for (int i = 0; i < parameters.length; i++)
{
JRParameter param = parameters[i];
if (!param.isSystemDefined())
{
String name = param.getName();
Object value = fillDataset.getParameterValue(name);
parameterValues.put(name, value);
}
}
return parameterValues;
}
finally
{
fillDataset.disposeParameterContributors();
JRResourcesFillUtil.revertResourcesFillContext(resourcesContext);
}
}