本文整理汇总了Java中net.sf.jasperreports.engine.JRDatasetParameter类的典型用法代码示例。如果您正苦于以下问题:Java JRDatasetParameter类的具体用法?Java JRDatasetParameter怎么用?Java JRDatasetParameter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JRDatasetParameter类属于net.sf.jasperreports.engine包,在下文中一共展示了JRDatasetParameter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDatasetParameter
import net.sf.jasperreports.engine.JRDatasetParameter; //导入依赖的package包/类
protected JRBaseDatasetParameter getDatasetParameter(JRDatasetParameter datasetParameter)
{
JRBaseDatasetParameter baseSubreportParameter = null;
if (datasetParameter != null)
{
baseSubreportParameter = (JRBaseDatasetParameter) get(datasetParameter);
if (baseSubreportParameter == null)
{
baseSubreportParameter = new JRBaseDatasetParameter(datasetParameter, this);
put(datasetParameter, baseSubreportParameter);
}
}
return baseSubreportParameter;
}
示例2: 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);
}
示例3: removeParameter
import net.sf.jasperreports.engine.JRDatasetParameter; //导入依赖的package包/类
/**
* Removes a parameter value.
*
* @param parameterName the parameter name
* @return the removed parameter value
*/
public JRDatasetParameter removeParameter(String parameterName)
{
JRDatasetParameter param = parametersMap.remove(parameterName);
if (param != null)
{
int idx = parametersList.indexOf(param);
if (idx >= 0)
{
parametersList.remove(idx);
}
getEventSupport().fireCollectionElementRemovedEvent(PROPERTY_PARAMETERS, param, idx);
}
return param;
}
示例4: fillTable
import net.sf.jasperreports.engine.JRDatasetParameter; //导入依赖的package包/类
/**
* Set the input of the table and of the combo viewer. On the table will be available a number of
* rows equals to the number of parameters that the user can select
*
* @param table the table
*/
private void fillTable(Table table) {
List<JRDatasetParameter> lst = new ArrayList<JRDatasetParameter>(Arrays.asList(value.getValue()));
input = new ArrayList<JRDatasetParameter>();
for(JRDatasetParameter param : lst){
JRDesignDatasetParameter newParam = new JRDesignDatasetParameter();
newParam.setExpression(param.getExpression() != null ? (JRExpression)param.getExpression().clone() : null);
newParam.setName(param.getName());
input.add(newParam);
}
Collections.sort(input, new Comparator<JRDatasetParameter>() {
@Override
public int compare(JRDatasetParameter o1, JRDatasetParameter o2) {
return o1.getName().compareTo(o2.getName());
}
});
tableViewer.setInput(input);
}
示例5: fixDSParametersList
import net.sf.jasperreports.engine.JRDatasetParameter; //导入依赖的package包/类
private void fixDSParametersList() {
JRDatasetParameter[] currParams = (JRDatasetParameter[]) tableViewerDatasetRunParams.getInput();
String datasetName = "";
JRDatasetRun jrDatasetRun = datasetRunInstance.getJRDatasetRun();
if(jrDatasetRun!=null) {
datasetName = jrDatasetRun.getDatasetName();
List<JRParameter> parameters4Datasource = ModelUtils.getParameters4Datasource(datasetRunInstance.getEditableDataset().getJasperDesign(), datasetName);
if(currParams!=null) {
for(JRDatasetParameter p1 : currParams) {
for(JRParameter p2 : parameters4Datasource) {
if(p2.getName().equals(p1.getName())){
datasetRunInstance.addParameter((JRDatasetParameter) p1.clone());
break;
}
}
}
}
tableViewerDatasetRunParams.setInput(datasetRunInstance.getJRDatasetRun().getParameters());
}
else {
// switching to main one
tableViewerDatasetRunParams.getTable().clearAll();
}
}
示例6: 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;
}
}
}
示例7: 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;
}
}
}
}
示例8: jButtonRemParameterActionPerformed
import net.sf.jasperreports.engine.JRDatasetParameter; //导入依赖的package包/类
private void jButtonRemParameterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonRemParameterActionPerformed
if (this.isInit()) return;
if (getCurrentSelectedComponent() == null) return;
javax.swing.table.DefaultTableModel dtm = (javax.swing.table.DefaultTableModel)jTableDatasetParameters.getModel();
JRDesignDatasetRun datasetRun = (JRDesignDatasetRun)getDesignDataset().getDatasetRun();
while (jTableDatasetParameters.getSelectedRowCount() > 0) {
int i=jTableDatasetParameters.getSelectedRow();
datasetRun.removeParameter( ((JRDatasetParameter)jTableDatasetParameters.getValueAt( i, 0)).getName() );
dtm.removeRow(i);
}
notifyChange();
}
示例9: jButtonRemParameterActionPerformed
import net.sf.jasperreports.engine.JRDatasetParameter; //导入依赖的package包/类
private void jButtonRemParameterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonRemParameterActionPerformed
if (this.isInit()) return;
if (getCurrentSelectedChartComponent() == null) return;
javax.swing.table.DefaultTableModel dtm = (javax.swing.table.DefaultTableModel)jTableDatasetParameters.getModel();
JRDesignDatasetRun datasetRun = (JRDesignDatasetRun)getCurrentSelectedChartComponent().getDataset().getDatasetRun();
while (jTableDatasetParameters.getSelectedRowCount() > 0) {
int i=jTableDatasetParameters.getSelectedRow();
datasetRun.removeParameter( ((JRDatasetParameter)jTableDatasetParameters.getValueAt( i, 0)).getName() );
dtm.removeRow(i);
}
notifyChange();
}
示例10: jButtonRemParameterActionPerformed
import net.sf.jasperreports.engine.JRDatasetParameter; //导入依赖的package包/类
private void jButtonRemParameterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonRemParameterActionPerformed
if (this.isInit()) return;
if (currentSelectedChartElement == null) return;
javax.swing.table.DefaultTableModel dtm = (javax.swing.table.DefaultTableModel)jTableDatasetParameters.getModel();
JRDesignDatasetRun datasetRun = (JRDesignDatasetRun)currentSelectedChartElement.getDataset().getDatasetRun();
while (jTableDatasetParameters.getSelectedRowCount() > 0) {
int i=jTableDatasetParameters.getSelectedRow();
datasetRun.removeParameter( ((JRDatasetParameter)jTableDatasetParameters.getValueAt( i, 0)).getName() );
dtm.removeRow(i);
}
notifyChange();
}
示例11: jButtonRemParameterActionPerformed
import net.sf.jasperreports.engine.JRDatasetParameter; //导入依赖的package包/类
private void jButtonRemParameterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonRemParameterActionPerformed
if (this.isInit()) return;
if (currentSelectedCrosstabElement == null) return;
javax.swing.table.DefaultTableModel dtm = (javax.swing.table.DefaultTableModel)jTableDatasetParameters.getModel();
JRDesignDatasetRun datasetRun = (JRDesignDatasetRun)currentSelectedCrosstabElement.getDataset().getDatasetRun();
while (jTableDatasetParameters.getSelectedRowCount() > 0) {
int i=jTableDatasetParameters.getSelectedRow();
datasetRun.removeParameter( ((JRDatasetParameter)jTableDatasetParameters.getValueAt( i, 0)).getName() );
dtm.removeRow(i);
}
notifyChange();
}
示例12: getTableCellRendererComponent
import net.sf.jasperreports.engine.JRDatasetParameter; //导入依赖的package包/类
@Override
public Component getTableCellRendererComponent(JTable table,
Object value,
boolean isSelected,
boolean hasFocus, int row, int column)
{
super.getTableCellRendererComponent(table, value, isSelected, hasFocus,row, column);
setIcon(null);
if (value instanceof JRDatasetParameter && value != null)
{
setText( ((JRDatasetParameter)value).getName() );
}
else if (value instanceof JRExpression)
{
JRExpression exp = (JRExpression)value;
if (exp == null) setText("");
else if (exp.getText() == null) setText("");
else setText(exp.getText());
}
return this;
}
示例13: 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());
}
示例14: JRBaseDatasetRun
import net.sf.jasperreports.engine.JRDatasetParameter; //导入依赖的package包/类
/**
* Creates a copy of a dataset instantiation.
*
* @param datasetRun the dataset instantiation
* @param factory the base object factory
*/
protected JRBaseDatasetRun(JRDatasetRun datasetRun, JRBaseObjectFactory factory)
{
factory.put(datasetRun, this);
uuid = datasetRun.getUUID();
datasetName = datasetRun.getDatasetName();
parametersMapExpression = factory.getExpression(datasetRun.getParametersMapExpression());
connectionExpression = factory.getExpression(datasetRun.getConnectionExpression());
dataSourceExpression = factory.getExpression(datasetRun.getDataSourceExpression());
propertiesMap = JRPropertiesMap.getPropertiesClone(datasetRun);
JRDatasetParameter[] datasetParams = datasetRun.getParameters();
if (datasetParams != null && datasetParams.length > 0)
{
parameters = new JRBaseDatasetParameter[datasetParams.length];
for (int i = 0; i < parameters.length; i++)
{
parameters[i] = factory.getDatasetParameter(datasetParams[i]);
}
}
List<ReturnValue> datesetReturnValues = datasetRun.getReturnValues();
if (datesetReturnValues != null && !datesetReturnValues.isEmpty())
{
this.returnValues = new ArrayList<ReturnValue>(datesetReturnValues.size());
for (ReturnValue datasetReturnValue : datesetReturnValues)
{
BaseReturnValue returnValue = factory.getReturnValue(datasetReturnValue);
this.returnValues.add(returnValue);
}
}
}
示例15: addDatasetRules
import net.sf.jasperreports.engine.JRDatasetParameter; //导入依赖的package包/类
private static void addDatasetRules(Digester digester)
{
String subDatasetPattern = "jasperReport/" + JRXmlConstants.ELEMENT_subDataset;
digester.addFactoryCreate(subDatasetPattern, JRDatasetFactory.class.getName());
digester.addSetNext(subDatasetPattern, "addDataset", JRDesignDataset.class.getName());
String datasetRunPattern = "*/" + JRXmlConstants.ELEMENT_datasetRun;
digester.addFactoryCreate(datasetRunPattern, JRDatasetRunFactory.class.getName());
digester.addSetNext(datasetRunPattern, "setDatasetRun", JRDatasetRun.class.getName());
String datasetParamPattern = datasetRunPattern + "/" + JRXmlConstants.ELEMENT_datasetParameter;
digester.addFactoryCreate(datasetParamPattern, JRDatasetRunParameterFactory.class.getName());
digester.addSetNext(datasetParamPattern, "addParameter", JRDatasetParameter.class.getName());
String datasetParamExprPattern = datasetParamPattern + "/" + JRXmlConstants.ELEMENT_datasetParameterExpression;
digester.addFactoryCreate(datasetParamExprPattern, JRExpressionFactory.class.getName());
digester.addSetNext(datasetParamExprPattern, "setExpression", JRExpression.class.getName());
digester.addCallMethod(datasetParamExprPattern, "setText", 0);
String returnValuePattern = datasetRunPattern + "/" + JRXmlConstants.ELEMENT_returnValue;
digester.addObjectCreate(returnValuePattern, DesignReturnValue.class.getName());
digester.addSetProperties(returnValuePattern,
new String[]{JRXmlConstants.ATTRIBUTE_incrementerFactoryClass, JRXmlConstants.ATTRIBUTE_calculation},
new String[]{"incrementerFactoryClassName"});
digester.addRule(returnValuePattern, new XmlConstantPropertyRule(
JRXmlConstants.ATTRIBUTE_calculation, CalculationEnum.values()));
digester.addSetNext(returnValuePattern, "addReturnValue");
}