本文整理汇总了Java中net.sf.jasperreports.engine.JRDatasetParameter.getName方法的典型用法代码示例。如果您正苦于以下问题:Java JRDatasetParameter.getName方法的具体用法?Java JRDatasetParameter.getName怎么用?Java JRDatasetParameter.getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.jasperreports.engine.JRDatasetParameter
的用法示例。
在下文中一共展示了JRDatasetParameter.getName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addParameter
import net.sf.jasperreports.engine.JRDatasetParameter; //导入方法依赖的package包/类
/**
* Adds a parameter value.
*
* @param parameter the parameter value
* @throws JRException
* @see net.sf.jasperreports.engine.JRDatasetRun#getParameters()
*/
public void addParameter(JRDatasetParameter parameter) throws JRException
{
if (parametersMap.containsKey(parameter.getName()))
{
throw
new JRException(
EXCEPTION_MESSAGE_KEY_DUPLICATE_PARAMETER,
new Object[]{parameter.getName()});
}
parametersMap.put(parameter.getName(), parameter);
parametersList.add(parameter);
getEventSupport().fireCollectionElementAddedEvent(PROPERTY_PARAMETERS,
parameter, parametersList.size() - 1);
}
示例2: execute
import net.sf.jasperreports.engine.JRDatasetParameter; //导入方法依赖的package包/类
@Override
public void execute() {
ParameterDTO parameters = (ParameterDTO) element.getPropertyValue(JRDesignDatasetRun.PROPERTY_PARAMETERS);
List<JRDatasetParameter> lst = new ArrayList<JRDatasetParameter>(Arrays.asList(parameters.getValue()));
for (JRDatasetParameter param : lst) {
if (param.getName() != null && param.getName().equals(oldName)) {
try {
// The parameter is removed and readded to have JR to update its internal structure (list and map)
element.getValue().removeParameter(param);
((JRDesignDatasetParameter) param).setName(newName);
element.getValue().addParameter(param);
parameterFound = true;
} catch (JRException e) {
e.printStackTrace();
}
// element.setPropertyValue(JRDesignDatasetRun.PROPERTY_PARAMETERS, parameters);
// The parameter was found, i mark the flag to support the undo and exit the cycle when the parameter is found
// since the aren't two parameters with the same name
break;
}
}
}
示例3: undo
import net.sf.jasperreports.engine.JRDatasetParameter; //导入方法依赖的package包/类
@Override
public void undo() {
if (parameterFound) {
ParameterDTO parameters = (ParameterDTO) element.getPropertyValue(JRDesignDatasetRun.PROPERTY_PARAMETERS);
List<JRDatasetParameter> lst = new ArrayList<JRDatasetParameter>(Arrays.asList(parameters.getValue()));
for (JRDatasetParameter param : lst) {
if (param.getName() != null && param.getName().equals(newName)) {
try {
// The parameter is removed and readded to have JR to update its internal structure (list and map)
element.getValue().removeParameter(param);
((JRDesignDatasetParameter) param).setName(oldName);
element.getValue().addParameter(param);
} catch (JRException e) {
e.printStackTrace();
}
parameterFound = false;
break;
}
}
}
}
示例4: JRBaseDatasetParameter
import net.sf.jasperreports.engine.JRDatasetParameter; //导入方法依赖的package包/类
/**
*
*/
protected JRBaseDatasetParameter(JRDatasetParameter datasetParameter, JRBaseObjectFactory factory)
{
factory.put(datasetParameter, this);
name = datasetParameter.getName();
expression = factory.getExpression(datasetParameter.getExpression());
}
示例5: dispose
import net.sf.jasperreports.engine.JRDatasetParameter; //导入方法依赖的package包/类
/**
* When the dialog is disposed the return value is update
*/
@Override
public void dispose() {
value = new ParameterDTO();
value.setJasperDesign(value.getJasperDesign());
List<JRDatasetParameter> returnValues = new ArrayList<JRDatasetParameter>();
for(JRDatasetParameter param : input){
if (param.getName() != null && !param.getName().isEmpty()) returnValues.add(param);
}
value.setValue(returnValues.toArray(new JRDatasetParameter[returnValues.size()]));
super.dispose();
}
示例6: verifyDatasetRun
import net.sf.jasperreports.engine.JRDatasetParameter; //导入方法依赖的package包/类
/**
* Verifies a subdataset run object.
*
* @param datasetRun the subdataset run
*/
public void verifyDatasetRun(JRDatasetRun datasetRun)
{
JRDesignDataset dataset = null;
String datasetName = datasetRun.getDatasetName();
if (datasetName == null || datasetName.length() == 0)
{
addBrokenRule("Dataset name is missing for dataset run.", datasetRun);
}
else
{
dataset = (JRDesignDataset) jasperDesign.getDatasetMap().get(datasetName);
if (dataset == null)
{
addBrokenRule("Unknown dataset name " + datasetName + ".", datasetRun);
}
}
JRDatasetParameter[] parameters = datasetRun.getParameters();
if (parameters != null && parameters.length > 0)
{
for(int index = 0; index < parameters.length; index++)
{
JRDatasetParameter parameter = parameters[index];
String paramName = parameter.getName();
if (paramName == null || paramName.trim().length() == 0)
{
addBrokenRule("Dataset " + datasetName + " parameter name missing.", parameter);
}
JRParameter datasetParam = null;
if (dataset != null)
{
datasetParam = dataset.getParametersMap().get(paramName);
if (datasetParam == null)
{
addBrokenRule("Unknown parameter " + paramName + " in dataset " + datasetName + ".", parameter);
}
}
}
}
JRExpression connectionExpression = datasetRun.getConnectionExpression();
JRExpression dataSourceExpression = datasetRun.getDataSourceExpression();
if (connectionExpression != null && dataSourceExpression != null)
{
addBrokenRule("Dataset " + datasetName + " cannot have both connection expresion and data source expression.", datasetRun);
}
List<ReturnValue> returnValues = datasetRun.getReturnValues();
if (returnValues != null && !returnValues.isEmpty())
{
for (ReturnValue returnValue : returnValues)
{
verifyReturnValue(returnValue);
}
}
}