public CreateE4ObjectCommand(ANode child, MCell parent, Rectangle location, int index) { super(parent, null, location, index); JasperDesign jd = parent.getJasperDesign(); jDataset = jd.getMainDesignDataset(); StandardTable st = TableManager.getTable(parent.getMTable()); JRDatasetRun dr = st.getDatasetRun(); if (dr != null) { String dbname = dr.getDatasetName(); if (dbname != null) jDataset = (JRDesignDataset) jd.getDatasetMap().get(dbname); } this.child = child; this.parent = parent; }
private static JRDataset findSubdataset(JRDatasetRun datasetRun, JasperReport report) { JRDataset[] datasets = report.getDatasets(); JRDataset reportDataset = null; if (datasets != null) { for (int i = 0; i < datasets.length; i++) { if (datasetRun.getDatasetName().equals(datasets[i].getName())) { reportDataset = datasets[i]; break; } } } if (reportDataset == null) { throw new JRRuntimeException( "Could not find subdataset named \"" + datasetRun.getDatasetName() + "\" in report \"" + report.getName() + "\""); } return reportDataset; }