@Override public void performAction() throws ActionException { JRDesignDatasetRun datasetRun = (JRDesignDatasetRun)table.getDatasetRun(); String datasetName = datasetRun.getDatasetName(); JasperDesignCache cache = JasperDesignCache.getInstance(getJasperReportsContext(), getReportContext()); JasperDesign jasperDesign = cache.getJasperDesign(targetUri); JRDesignDataset dataset = (JRDesignDataset)jasperDesign.getDatasetMap().get(datasetName); // execute command try { getCommandStack().execute( new ResetInCacheCommand( new FilterCommand(getJasperReportsContext(), dataset, getFilterData()), getJasperReportsContext(), getReportContext(), targetUri ) ); } catch (CommandException e) { throw new ActionException(e); } }
@Override public void performAction() throws ActionException { JRDesignDatasetRun datasetRun = (JRDesignDatasetRun)table.getDatasetRun(); String datasetName = datasetRun.getDatasetName(); JasperDesignCache cache = JasperDesignCache.getInstance(getJasperReportsContext(), getReportContext()); JasperDesign jasperDesign = cache.getJasperDesign(targetUri); JRDesignDataset dataset = (JRDesignDataset)jasperDesign.getDatasetMap().get(datasetName); // execute command try { getCommandStack().execute( new ResetInCacheCommand( new SortCommand(getJasperReportsContext(), dataset, getSortData()), getJasperReportsContext(), getReportContext(), targetUri ) ); } catch (CommandException e) { throw new ActionException(e); } }
private void fillData() { final String[] ds = ModelUtils.getDataSets(jrDesign, true); dsCombo.setItems(ds); dsCombo.select(0); if (eDataset != null && eDataset.getDatasetRun() != null) { for (int i = 0; i < ds.length; i++) { if (ds[i].equals(eDataset.getDatasetRun().getDatasetName())) { dsCombo.select(i); break; } } dsRun.setData((JRDesignDatasetRun) eDataset.getDatasetRun()); dsRun.setExpressionContext(this.expContext); } enableMainDatasetRun(); fillIncrement(); fillResetGroup(); dsCombo.getParent().layout(true); }
@Override public void setPropertyValue(Object id, Object value) { StandardListComponent jrList = getList(); if (id.equals(StandardListComponent.PROPERTY_IGNORE_WIDTH)) jrList.setIgnoreWidth((Boolean) value); else if (id.equals(StandardListComponent.PROPERTY_PRINT_ORDER)) jrList.setPrintOrderValue((PrintOrderEnum) printOrderD.getEnumValue(value)); else if (id.equals(PREFIX + DesignListContents.PROPERTY_HEIGHT)) ((DesignListContents) jrList.getContents()).setHeight((Integer) value); else if (id.equals(PREFIX + DesignListContents.PROPERTY_WIDTH)) ((DesignListContents) jrList.getContents()).setWidth((Integer) value); else if (id.equals(PREFIX + JRDesignElementDataset.PROPERTY_DATASET_RUN)) { if (value == null) { jrList.setDatasetRun(null); } else { MDatasetRun mdr = (MDatasetRun) value; JRDesignDatasetRun dr = (JRDesignDatasetRun) mdr.getValue(); if (dr.getDatasetName() != null) jrList.setDatasetRun(dr); else jrList.setDatasetRun(null); } } else super.setPropertyValue(id, value); }
@Override public JRDesignComponentElement createJRElement(JasperDesign jasperDesign) { JRDesignComponentElement component = new JRDesignComponentElement(); component.setHeight(getDefaultHeight()); component.setWidth(getDefaultWidth()); StandardListComponent componentImpl = new StandardListComponent(); DesignListContents contents = new DesignListContents(); contents.setHeight(100); contents.setWidth(100); componentImpl.setContents(contents); component.setComponent(componentImpl); ComponentKey componentKey = new ComponentKey("http://jasperreports.sourceforge.net/jasperreports/components", "jr", "list"); component.setComponentKey(componentKey); JRDesignDatasetRun datasetRun = new JRDesignDatasetRun(); componentImpl.setDatasetRun(datasetRun); DefaultManager.INSTANCE.applyDefault(this.getClass(), component); return component; }
@Override public void setPropertyValue(Object id, Object value) { StandardTable jrTable = getStandardTable(); if (id.equals(StandardTable.PROPERTY_WHEN_NO_DATA_TYPE)) jrTable.setWhenNoDataType((WhenNoDataTypeTableEnum) whennodataD.getEnumValue(value)); else if (id.equals(StandardTable.PROPERTY_DATASET_RUN)) { MDatasetRun mdr = (MDatasetRun) value; JRDesignDatasetRun dr = (JRDesignDatasetRun) mdr.getValue(); if (dr.getDatasetName() != null) jrTable.setDatasetRun(dr); else jrTable.setDatasetRun(null); } super.setPropertyValue(id, value); }
public void setData(JRDesignDatasetRun datasetrun) { this.datasetrun = datasetrun; if (datasetrun != null) { if (datasetrun.getConnectionExpression() == null && datasetrun.getDataSourceExpression() == null) { cnExpr.setEnabled(false); cmb.select(0); } else if (datasetrun.getConnectionExpression() != null) { cnExpr.setEnabled(true); cnExpr.bindObject(datasetrun, "ConnectionExpression"); cmb.select(1); } else if (datasetrun.getDataSourceExpression() != null) { cnExpr.setEnabled(true); cnExpr.bindObject(datasetrun, "DataSourceExpression"); cmb.select(2); } } }
/** * Set the valued edited by this dialog * * @param value a ParametersDTO (not null) of the parameters list that the user manipulate * @param datasetRun the (not null) dataset run from where the value is extracted */ public void setValue(ParameterDTO value, MDatasetRun datasetRun) { this.value = value; if (value == null) { value = new ParameterDTO(); } //get the dataset referenced by the dataset run JRDataset dataset = datasetRun.getJasperDesign().getDatasetMap().get(datasetRun.getPropertyValue(JRDesignDatasetRun.PROPERTY_DATASET_NAME)); if (dataset != null) { List<JRParameter> userParameters = new ArrayList<JRParameter>(); //flag to add or not the system parameters boolean addSystemParameters = true; for(JRParameter param : dataset.getParameters()){ if (!param.isSystemDefined() || addSystemParameters) userParameters.add(param); } //the original dataset parameters are cached datasetParameters = userParameters.toArray(new JRParameter[userParameters.size()]); } else datasetParameters = new JRDesignParameter[0]; if (table != null) fillTable(table); }
public static List<JRDesignDatasetRun> getDatasetRun(MReport mrep, JRDataset jDataset) { final String dsName = jDataset.getName(); final List<JRDesignDatasetRun> dsRuns = new ArrayList<JRDesignDatasetRun>(); new ModelVisitor<Object>(mrep) { @Override public boolean visit(INode n) { if (n instanceof IDatasetContainer) { List<MDatasetRun> dsRunList = ((IDatasetContainer) n).getDatasetRunList(); if (dsRunList != null) for (MDatasetRun mdsrun : dsRunList) { JRDesignDatasetRun dsrun = mdsrun.getValue(); if (dsrun.getDataSourceExpression() != null) continue; if (dsrun.getDatasetName() != null && dsrun.getDatasetName().equals(dsName)) dsRuns.add(dsrun); } } return true; } }; return dsRuns; }
/** * Get a list of all the datasets used by every element, and if one or more of this are references to the dataset * with the changed name ask if the user want to refactor the name inside the project */ @Override public Command postSetValue(IPropertySource target, Object prop, Object newValue, Object oldValue) { JSSCompoundCommand c = new JSSCompoundCommand(null); c.setReferenceNodeIfNull(target); //Check if the updated element is a dataset and the updated property is the name if (target instanceof MDataset && prop.equals(JRDesignDataset.PROPERTY_NAME)) { //Get all the references to this dataset List<IDatasetContainer> references = DeleteDatasetCommand.getDatasetUsage(((MDataset)target).getRoot().getChildren(), oldValue.toString()); if (references.size()>0){ boolean selectedYes = UIUtils.showConfirmation(Messages.PostSetDatasetName_title, Messages.PostSetDatasetName_message); if (selectedYes){ for(IDatasetContainer datasetRun : references){ List<MDatasetRun> datasetList = datasetRun.getDatasetRunList(); for (MDatasetRun actualDataset : datasetList){ if (actualDataset != null && oldValue.toString().equals(actualDataset.getPropertyValue(JRDesignDatasetRun.PROPERTY_DATASET_NAME))) c.add(new SetDatasetRunName(actualDataset, oldValue.toString(), newValue.toString())); } } } } } return c; }
@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; } } }
@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; } } } }
/** * Return the dataset nearest to this element * * @param node the actual node * @return the dataset nearest to this element or null if it can't be found */ private JRDataset getElementDataset(ANode node){ if (node instanceof APropertyNode){ APropertyNode pnode = (APropertyNode)node; MDatasetRun mdataset = (MDatasetRun) pnode.getPropertyValue(JRDesignElementDataset.PROPERTY_DATASET_RUN); if (mdataset != null) { JRDesignDatasetRun datasetRun = mdataset.getValue(); if (datasetRun != null) { String dsname = datasetRun.getDatasetName(); return getJasperDesign().getDatasetMap().get(dsname); } } } ANode parent = node.getParent(); if (parent != null){ return getElementDataset(parent); } else if (getJasperDesign() != null){ return getJasperDesign().getMainDataset(); } else { return null; } }
public void jRTextExpressionAreaMapExpressionTextChanged() { if (this.isInit()) return; if (currentSelectedComponent != null) { JRDesignDatasetRun datasetRun = (JRDesignDatasetRun)currentSelectedComponent.getMarkerData().getDataset().getDatasetRun(); if (datasetRun != null) { JRDesignExpression exp = null; if (jRTextExpressionAreaMapExpression.getText().trim().length() > 0) { exp = new JRDesignExpression(); exp.setValueClassName("java.util.Map");//NOI18N exp.setText(jRTextExpressionAreaMapExpression.getText()); } datasetRun.setParametersMapExpression(exp); notifyChange(); } } }
public void jRTextExpressionAreaTextConnectionExpressionTextChanged() { if (this.isInit()) return; if (currentSelectedComponent != null) { JRDesignExpression exp = null; if (jRTextExpressionAreaTextConnectionExpression.getText().trim().length() > 0) { exp = new JRDesignExpression(); exp.setText(jRTextExpressionAreaTextConnectionExpression.getText()); } int index = jComboBoxDatasetConnectionType.getSelectedIndex(); if (index == 1) { if (exp != null) exp.setValueClassName("java.sql.Connection");//NOI18N ((JRDesignDatasetRun) getDesignDataset().getDatasetRun()).setConnectionExpression(exp); } else if (index == 2) { if (exp != null) exp.setValueClassName("net.sf.jasperreports.engine.JRDataSource");//NOI18N ((JRDesignDatasetRun) getDesignDataset().getDatasetRun()).setDataSourceExpression(exp); } notifyChange(); } }
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(); }
public void jRTextExpressionAreaMapExpressionTextChanged() { if (this.isInit()) return; if (currentSelectedChartComponent != null) { JRDesignDatasetRun datasetRun = (JRDesignDatasetRun)currentSelectedChartComponent.getDataset().getDatasetRun(); if (datasetRun != null) { JRDesignExpression exp = null; if (jRTextExpressionAreaMapExpression.getText().trim().length() > 0) { exp = new JRDesignExpression(); exp.setValueClassName("java.util.Map");//NOI18N exp.setText(jRTextExpressionAreaMapExpression.getText()); } datasetRun.setParametersMapExpression(exp); notifyChange(); } } }
public void jRTextExpressionAreaTextConnectionExpressionTextChanged() { if (this.isInit()) return; if (currentSelectedChartComponent != null) { JRDesignExpression exp = null; if (jRTextExpressionAreaTextConnectionExpression.getText().trim().length() > 0) { exp = new JRDesignExpression(); exp.setText(jRTextExpressionAreaTextConnectionExpression.getText()); } int index = jComboBoxDatasetConnectionType.getSelectedIndex(); if (index == 1) { if (exp != null) exp.setValueClassName("java.sql.Connection");//NOI18N ((JRDesignDatasetRun) currentSelectedChartComponent.getDataset().getDatasetRun()).setConnectionExpression(exp); } else if (index == 2) { if (exp != null) exp.setValueClassName("net.sf.jasperreports.engine.JRDataSource");//NOI18N ((JRDesignDatasetRun) currentSelectedChartComponent.getDataset().getDatasetRun()).setDataSourceExpression(exp); } notifyChange(); } }
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(); }
protected void performAction(org.openide.nodes.Node[] activatedNodes) { ElementNode node = (ElementNode)activatedNodes[0]; if (node.getElement() instanceof JRDesignComponentElement && ((JRDesignComponentElement)node.getElement()).getComponent() instanceof StandardListComponent) { ComponentDatasetRunPanel panel = new ComponentDatasetRunPanel(); panel.setJasperDesign( node.getJasperDesign() ); StandardListComponent component = (StandardListComponent)((JRDesignComponentElement)node.getElement()).getComponent(); panel.setDatasetRun( (JRDesignDatasetRun)component.getDatasetRun() ); if (panel.showDialog(Misc.getMainFrame(), true) == JOptionPane.OK_OPTION) { component.setDatasetRun( panel.getDatasetRun() ); IReportManager.getInstance().notifyReportChange(); } } }
protected void performAction(org.openide.nodes.Node[] activatedNodes) { ElementNode node = (ElementNode)activatedNodes[0]; if (node.getElement() instanceof JRDesignComponentElement && ((JRDesignComponentElement)node.getElement()).getComponent() instanceof StandardTable) { ComponentDatasetRunPanel panel = new ComponentDatasetRunPanel(); panel.setJasperDesign( node.getJasperDesign() ); StandardTable component = (StandardTable)((JRDesignComponentElement)node.getElement()).getComponent(); panel.setDatasetRun( (JRDesignDatasetRun)component.getDatasetRun() ); if (panel.showDialog(Misc.getMainFrame(), true) == JOptionPane.OK_OPTION) { component.setDatasetRun( panel.getDatasetRun() ); IReportManager.getInstance().notifyReportChange(); } } }
public void jRTextExpressionAreaMapExpressionTextChanged() { if (this.isInit()) return; if (currentSelectedChartElement != null) { JRDesignDatasetRun datasetRun = (JRDesignDatasetRun)currentSelectedChartElement.getDataset().getDatasetRun(); if (datasetRun != null) { JRDesignExpression exp = null; if (jRTextExpressionAreaMapExpression.getText().trim().length() > 0) { exp = new JRDesignExpression(); exp.setValueClassName("java.util.Map");//NOI18N exp.setText(jRTextExpressionAreaMapExpression.getText()); } datasetRun.setParametersMapExpression(exp); notifyChange(); } } }
public void jRTextExpressionAreaTextConnectionExpressionTextChanged() { if (this.isInit()) return; if (currentSelectedChartElement != null) { JRDesignExpression exp = null; if (jRTextExpressionAreaTextConnectionExpression.getText().trim().length() > 0) { exp = new JRDesignExpression(); exp.setText(jRTextExpressionAreaTextConnectionExpression.getText()); } int index = jComboBoxDatasetConnectionType.getSelectedIndex(); if (index == 1) { if (exp != null) exp.setValueClassName("java.sql.Connection");//NOI18N ((JRDesignDatasetRun) currentSelectedChartElement.getDataset().getDatasetRun()).setConnectionExpression(exp); } else if (index == 2) { if (exp != null) exp.setValueClassName("net.sf.jasperreports.engine.JRDataSource");//NOI18N ((JRDesignDatasetRun) currentSelectedChartElement.getDataset().getDatasetRun()).setDataSourceExpression(exp); } notifyChange(); } }
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(); }
public void jRTextExpressionAreaMapExpressionTextChanged() { if (this.isInit()) return; if (currentSelectedCrosstabElement != null) { JRDesignDatasetRun datasetRun = (JRDesignDatasetRun)currentSelectedCrosstabElement.getDataset().getDatasetRun(); if (datasetRun != null) { JRDesignExpression exp = null; if (jRTextExpressionAreaMapExpression.getText().trim().length() > 0) { exp = new JRDesignExpression(); exp.setValueClassName("java.util.Map"); exp.setText(jRTextExpressionAreaMapExpression.getText()); } datasetRun.setParametersMapExpression(exp); notifyChange(); } } }
public void jRTextExpressionAreaTextConnectionExpressionTextChanged() { if (this.isInit()) return; if (currentSelectedCrosstabElement != null) { JRDesignExpression exp = null; if (jRTextExpressionAreaTextConnectionExpression.getText().trim().length() > 0) { exp = new JRDesignExpression(); exp.setText(jRTextExpressionAreaTextConnectionExpression.getText()); } int index = jComboBoxDatasetConnectionType.getSelectedIndex(); if (index == 1) { if (exp != null) exp.setValueClassName("java.sql.Connection"); ((JRDesignDatasetRun) currentSelectedCrosstabElement.getDataset().getDatasetRun()).setConnectionExpression(exp); } else if (index == 2) { if (exp != null) exp.setValueClassName("net.sf.jasperreports.engine.JRDataSource"); ((JRDesignDatasetRun) currentSelectedCrosstabElement.getDataset().getDatasetRun()).setDataSourceExpression(exp); } notifyChange(); } }
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(); }
@Override public Object createObject(Attributes atts) { JRDesignDatasetRun datasetRun = new JRDesignDatasetRun(); datasetRun.setDatasetName(atts.getValue(JRXmlConstants.ATTRIBUTE_subDataset)); String uuid = atts.getValue(JRXmlConstants.ATTRIBUTE_uuid); if (uuid != null) { datasetRun.setUUID(UUID.fromString(uuid)); } return datasetRun; }
public SortFillDatasetRun(BaseReportFiller filler, JRFillDataset dataset, DatasetSortInfo sortInfo) throws JRException { super( filler, new JRDesignDatasetRun(), //we don't need anything from a dataset run. just avoid NPEs down the call dataset ); this.sortInfo = sortInfo; }
@Override public JRDesignElement createJRElement(JasperDesign jasperDesign) { JRDesignCrosstab jrDesignElement = new JRDesignCrosstab(jasperDesign); JRDesignCrosstabDataset dataset = new JRDesignCrosstabDataset(); dataset.setDatasetRun(new JRDesignDatasetRun()); jrDesignElement.setDataset(dataset); DefaultManager.INSTANCE.applyDefault(this.getClass(), jrDesignElement); return jrDesignElement; }
/** * Returns the expression context that should be used with the map markers. * Markers can be generated by a dataset and therefore the related expressions * should use this as their context. * * @return the expression context to be used for the markers expressions */ public ExpressionContext getMarkersExpressionContext() { MDatasetRun datasetRun = (MDatasetRun) getPropertyValue(JRDesignElementDataset.PROPERTY_DATASET_RUN); if(datasetRun!=null){ JRDesignDatasetRun value = datasetRun.getValue(); if(value!=null && value.getDatasetName()!=null){ JRDesignDataset ds = ModelUtils.getDesignDatasetByName(getJasperDesign(),value.getDatasetName()); if(ds!=null) { return new ExpressionContext(ds, getJasperConfiguration()); } } } return null; }
@Override public void setPropertyValue(Object id, Object value) { if (id.equals(JRDesignDatasetRun.PROPERTY_DATASET_NAME)) { super.setPropertyValue(id, value); mapModel.setPropertyValue(JRDesignElementDataset.PROPERTY_DATASET_RUN, this); } else super.setPropertyValue(id, value); }
@Override public JRDesignElement createJRElement(JasperDesign jasperDesign) { JRDesignComponentElement jrElement = new JRDesignComponentElement(); StandardTable component = new StandardTable(); ((JRDesignComponentElement) jrElement).setComponent(component); ((JRDesignComponentElement) jrElement).setComponentKey(new ComponentKey("http://jasperreports.sourceforge.net/jasperreports/components", "jr", "table")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ JRDesignDatasetRun datasetRun = new JRDesignDatasetRun(); component.setDatasetRun(datasetRun); DefaultManager.INSTANCE.applyDefault(this.getClass(), jrElement); return jrElement; }
@Override public void execute() { removeGroup(); JRDesignDatasetRun datasetRun = (JRDesignDatasetRun)table.getStandardTable().getDatasetRun(); oldDatasetName = datasetRun.getDatasetName(); datasetRun.setDatasetName(newDatasetName); reloadAvailableGroups(); //Run an event on the table to force a grapghical refresh of the columns table.propertyChange(new PropertyChangeEvent(table.getValue(), StandardTable.PROPERTY_COLUMNS, null, null)); table.setChangedProperty(true); }
@Override public void undo() { JRDesignDatasetRun datasetRun = (JRDesignDatasetRun)table.getStandardTable().getDatasetRun(); datasetRun.setDatasetName(oldDatasetName); oldDatasetName = null; restoreGroup(); reloadAvailableGroups(); //Run an event on the table to force a grapghical refresh of the columns table.propertyChange(new PropertyChangeEvent(table.getValue(), StandardTable.PROPERTY_COLUMNS, null, null)); table.setChangedProperty(true); }
public WizardConnectionPage() { super("connectionpage"); //$NON-NLS-1$ setTitle(Messages.common_connection); setDescription(Messages.WizardConnectionPage_description); jrDsRun = new JRDesignDatasetRun(); // By default we set the dataset run to use the report connection... JRDesignExpression exp = new JRDesignExpression(); exp.setText("$P{REPORT_CONNECTION}"); jrDsRun.setConnectionExpression( exp ); }
public static void setupDatasetRun(Object[] bprms, JRDesignDatasetRun dr) throws JRException { if (dr.getDataSourceExpression() != null) return; for (int i = 0; i < bprms.length; i += 2) { String pname = (String) bprms[i]; if (getParameter(dr, pname) != null) continue; JRDesignDatasetParameter prm = new JRDesignDatasetParameter(); prm.setName(pname); prm.setExpression(new JRDesignExpression("$P{" + pname + "}")); dr.addParameter(prm); } // cleanup? }
public static void cleanDatasetRun(Object[] bprms, JRDesignDatasetRun dr) throws JRException { if (dr.getDataSourceExpression() != null) return; for (int i = 0; i < bprms.length; i += 2) { String pname = (String) bprms[i]; JRDatasetParameter p = getParameter(dr, pname); if (p.getExpression() != null && p.getExpression().getText() != null && p.getExpression().getText().equals("$P{" + pname + "}")) dr.removeParameter(p); } }
public void resetDatasetRun(boolean nullableFlag) { if (nullableFlag){ this.datasetRun=null; this.editableDataset.setDatasetRun(null); } else { this.datasetRun=new JRDesignDatasetRun(); this.editableDataset.setDatasetRun(datasetRun); } }