/** * Generates sub-reports and adds them into the parameter map. * * @param templateFile * The path to the JR template of the report. * @param parameters * The parameters to be sent to Jasper Report. * @param baseDesignPath * Base design path. * @param connectionProvider * A connection provider in case the report needs it. * @param language * Language to be used when generating the sub-report. * @throws OBException * In case there is any error generating the sub-reports an exception is thrown with the * error message. */ private static void processSubReports(String templateFile, Map<String, Object> parameters, String baseDesignPath, ConnectionProvider connectionProvider, String language) throws OBException { try { JasperDesign jasperDesign = JRXmlLoader.load(templateFile); Object[] parameterList = jasperDesign.getParametersList().toArray(); String parameterName = ""; String subReportName = ""; Collection<String> subreportList = new ArrayList<String>(); File template = new File(templateFile); String templateLocation = template.getParent() + "/"; /* * TODO: At present this process assumes the subreport is a .jrxml file. Need to handle the * possibility that this subreport file could be a .jasper file. */ for (int i = 0; i < parameterList.length; i++) { final JRDesignParameter parameter = (JRDesignParameter) parameterList[i]; if (parameter.getName().startsWith("SUBREP_")) { parameterName = parameter.getName(); subreportList.add(parameterName); subReportName = Replace.replace(parameterName, "SUBREP_", "") + ".jrxml"; JasperReport jasperReportLines = createSubReport(templateLocation, subReportName, baseDesignPath, connectionProvider, language); parameters.put(parameterName, jasperReportLines); } } } catch (final JRException e) { log.error("Error processing subreports for template: " + templateFile, e); throw new OBException(e.getMessage(), e); } }
public static Map<String,JRDesignParameter> buildJRDesignParameters(Map<String,Object> parameters) { // convert parameters to JRDesignParameters so they can be parsed HashMap<String,JRDesignParameter> jrParameters = new HashMap<String,JRDesignParameter>(); Iterator<String> iterator = parameters.keySet().iterator(); while (iterator.hasNext()) { String key = iterator.next(); Object value = parameters.get(key); if (value != null) { JRDesignParameter jrParameter = new JRDesignParameter(); jrParameter.setName(key); jrParameter.setValueClass(value.getClass()); jrParameters.put(jrParameter.getName(), jrParameter); } } return jrParameters; }
public void run(List<JRDesignParameter> prms) { Object sel = selection[0]; MExpression mexpr = null; List<MFromTable> tbls = Util.getFromTables((ANode) sel); for (JRParameter t : prms) { if (sel instanceof AMExpression) mexpr = run(t, (AMExpression<?>) sel); else if (isInSelect(sel)) mexpr = run(t, (ANode) sel, -1); sel = mexpr; mexpr.getOperands().add(Factory.getDefaultOperand(mexpr)); ParameterPOperand pop = new ParameterPOperand(mexpr); pop.setJrParameter((JRDesignParameter) t); mexpr.getOperands().add(pop); } showDialog(mexpr); }
public String getColumnText(Object element, int columnIndex) { JRDesignParameter field = (JRDesignParameter) element; switch (columnIndex) { case 0: return field.getName(); case 1: if (field.isSystemDefined()) return ""; //$NON-NLS-1$ else return Boolean.toString(field.isForPrompting()); case 2: return Misc.nvl(field.getValueClassName(), ""); //$NON-NLS-1$ case 3: return Misc.nvl(field.getDescription(), ""); //$NON-NLS-1$ } return ""; //$NON-NLS-1$ }
/** * When the data is refreshed is checked if the class name is a collection, in this * case the controls to define the nested type are shown, otherwise they are hidden. */ @Override public void refresh() { setRefreshing(true); APropertyNode element = getElement(); if (element != null) { element.getPropertyDescriptors(); for (Object key : widgets.keySet()) { if (key.equals(JRDesignParameter.PROPERTY_NESTED_TYPE_NAME)){ String type = element.getPropertyValue(JRDesignVariable.PROPERTY_VALUE_CLASS_NAME).toString(); if (isClassCollection(type)) setCompVisible(true); else setCompVisible(false); } widgets.get(key).setData(element, element.getPropertyValue(key)); if (key.equals(JRDesignParameter.PROPERTY_DEFAULT_VALUE_EXPRESSION)){ // fix the visibilities mask: allows only PARAMETERS ExpressionContext expContext = ((WTextExpression) ((SPExpression) widgets.get(key)).getControl()).getExpressionContext(); if(expContext!=null){ expContext.setVisibilities(EnumSet.of(Visibility.SHOW_PARAMETERS)); } } } } setRefreshing(false); }
/** * 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); }
/** * Get a list of all the datasets run used by every element, and if one or more of this are references to the dataset * with the changed parameter search create a command that search inside them the reference to the parameter and if * found rename it */ @Override public Command postSetValue(IPropertySource target, Object prop, Object newValue, Object oldValue) { JSSCompoundCommand c = new JSSCompoundCommand(null); // Check if the updated element is a dataset and the updated property is the name if (target instanceof MParameter && prop.equals(JRDesignParameter.PROPERTY_NAME)) { MParameter mprm = (MParameter) target; if (mprm.getParent() != null && mprm.getParent().getParent() != null) { // Get all the references to this dataset ANode parentElement = mprm.getParent().getParent(); c.setReferenceNodeIfNull(parentElement); if (parentElement instanceof MDataset) { MDataset parentDataset = (MDataset) parentElement; List<IDatasetContainer> references = DeleteDatasetCommand.getDatasetUsage(parentDataset.getRoot() .getChildren(), parentDataset.getPropertyActualValue(JRDesignDataset.PROPERTY_NAME).toString()); for (IDatasetContainer datasetRun : references) { List<MDatasetRun> datasetList = datasetRun.getDatasetRunList(); for (MDatasetRun actualDataset : datasetList) { c.add(new SetParameterName(actualDataset, oldValue.toString(), newValue.toString())); } } } } } return c; }
@Override public Object getPropertyValue(Object id) { JRDesignParameter jrParameter = (JRDesignParameter) getValue(); if (id.equals(JRDesignParameter.PROPERTY_DESCRIPTION)) return jrParameter.getDescription(); if (id.equals(JRDesignParameter.PROPERTY_FOR_PROMPTING)) return new Boolean(jrParameter.isForPrompting()); if (id.equals(JRDesignParameter.PROPERTY_DEFAULT_VALUE_EXPRESSION)) return ExprUtil.getExpression(jrParameter.getDefaultValueExpression()); if (id.equals(PROPERTY_MAP)) { return jrParameter.getPropertiesMap(); } if (id.equals(JRDesignParameter.PROPERTY_NESTED_TYPE_NAME)) return jrParameter.getNestedTypeName(); return super.getPropertyValue(id); }
@Override public void setPropertyValue(Object id, Object value) { JRDesignParameter jrParameter = (JRDesignParameter) getValue(); if (id.equals(JRDesignParameter.PROPERTY_DESCRIPTION)) jrParameter.setDescription((String) value); else if (id.equals(JRDesignParameter.PROPERTY_FOR_PROMPTING) && isMainDataset()) jrParameter.setForPrompting(((Boolean) value).booleanValue()); else if (id.equals(JRDesignParameter.PROPERTY_NESTED_TYPE_NAME)) jrParameter.setNestedTypeName((String) value); else if (id.equals(JRDesignParameter.PROPERTY_DEFAULT_VALUE_EXPRESSION)) jrParameter.setDefaultValueExpression(ExprUtil.setValues(jrParameter.getDefaultValueExpression(), value)); else if (id.equals(PROPERTY_MAP)) { JRPropertiesMap v = (JRPropertiesMap) value; String[] names = jrParameter.getPropertiesMap().getPropertyNames(); for (int i = 0; i < names.length; i++) { jrParameter.getPropertiesMap().removeProperty(names[i]); } names = v.getPropertyNames(); for (int i = 0; i < names.length; i++) jrParameter.getPropertiesMap().setProperty(names[i], v.getProperty(names[i])); this.getPropertyChangeSupport().firePropertyChange(PROPERTY_MAP, false, true); } super.setPropertyValue(id, value); }
/** * Creates the property descriptors. * * @param desc * the desc */ @Override public void createPropertyDescriptors(List<IPropertyDescriptor> desc, Map<String, Object> defaultsMap) { validator = new ParameterNameValidator(); validator.setTargetNode(this); JSSValidatedTextPropertyDescriptor nameD = new JSSValidatedTextPropertyDescriptor(JRDesignParameter.PROPERTY_NAME, Messages.common_name, validator); nameD.setDescription(Messages.MParameterSystem_name_description); desc.add(nameD); NClassTypePropertyDescriptor classD = new NClassTypePropertyDescriptor(JRDesignParameter.PROPERTY_VALUE_CLASS_NAME, Messages.common_class); classD.setDescription(Messages.MParameterSystem_class_description); desc.add(classD); classD.setHelpRefBuilder(new HelpReferenceBuilder( "net.sf.jasperreports.doc/docs/schema.reference.html?cp=0_1#parameter_class")); defaultsMap.put(JRDesignParameter.PROPERTY_VALUE_CLASS_NAME, "java.lang.String"); //$NON-NLS-1$ }
public void setPropertyValue(Object id, Object value) { JRDesignField jrField = (JRDesignField) getValue(); if (id.equals(JRDesignParameter.PROPERTY_NAME)) { if (!value.equals("")) { jrField.setName((String) value); } } else if (id.equals(JRDesignParameter.PROPERTY_VALUE_CLASS_NAME)){ jrField.setValueClassName((String) value); } else if (id.equals(JRDesignParameter.PROPERTY_DESCRIPTION)){ jrField.setDescription((String) value); } else if (id.equals(PROPERTY_MAP)) { JRPropertiesMap v = (JRPropertiesMap) value; String[] names = jrField.getPropertiesMap().getPropertyNames(); for (int i = 0; i < names.length; i++) { jrField.getPropertiesMap().removeProperty(names[i]); } names = v.getPropertyNames(); for (int i = 0; i < names.length; i++) jrField.getPropertiesMap().setProperty(names[i], v.getProperty(names[i])); this.getPropertyChangeSupport().firePropertyChange(PROPERTY_MAP, false, true); } }
protected boolean createInput(Composite sectionClient, JRDesignParameter p, Map<String, Object> params, boolean first) throws ClassNotFoundException { ParameterJasper pres = new ParameterJasper(p); // Use a custom control for the report maxcount instead of the integer standard one if (p.getName().equals(JRParameter.REPORT_MAX_COUNT)) { createControl(sectionClient, pres, new BooleanNumericInput(), p, first); return true; } for (IDataInput in : ReportControler.inputs) { if (in.isForType(pres.getValueClass())) { createControl(sectionClient, pres, in.getInstance(), p, first); return true; } } return false; }
private void createBParam(FormToolkit toolkit, CTabFolder tabFolder) { CTabItem bptab = new CTabItem(tabFolder, SWT.NONE); bptab.setText(Messages.ParametersDialog_built_in_parameters); ScrolledComposite scompo = new ScrolledComposite(tabFolder, SWT.V_SCROLL | SWT.H_SCROLL); scompo.setExpandHorizontal(true); scompo.setExpandVertical(true); Composite sectionClient = toolkit.createComposite(scompo); sectionClient.setLayout(new GridLayout(2, false)); for (JRParameter p : prompts) if (!p.isForPrompting() || p.isSystemDefined()) createInput(toolkit, sectionClient, (JRDesignParameter) p); sectionClient.pack(); scompo.setMinSize(sectionClient.getSize()); scompo.setContent(sectionClient); bptab.setControl(scompo); }
private void createUserParam(FormToolkit toolkit, CTabFolder tabFolder) { if (canShowParameters()) { CTabItem ptab = new CTabItem(tabFolder, SWT.NONE); ptab.setText(Messages.ParametersDialog_user_parameters); ScrolledComposite scompo = new ScrolledComposite(tabFolder, SWT.V_SCROLL | SWT.H_SCROLL); scompo.setExpandHorizontal(true); scompo.setExpandVertical(true); Composite sectionClient = toolkit.createComposite(scompo); sectionClient.setLayout(new GridLayout(2, false)); for (JRParameter p : prompts) if (p.isForPrompting() && !p.isSystemDefined()) createInput(toolkit, sectionClient, (JRDesignParameter) p); sectionClient.pack(); scompo.setMinSize(sectionClient.getSize()); scompo.setContent(sectionClient); ptab.setControl(scompo); } }
/** * Utility function to duplicate a parameter. All the parameter properties * and parameter default value expression are duplicated as well. */ public static JRDesignParameter cloneParameter(JRDesignParameter param) { JRDesignParameter newParam = new JRDesignParameter(); newParam.setName( param.getName() ); newParam.setForPrompting( param.isForPrompting() ); newParam.setSystemDefined( param.isSystemDefined() ); //newParam.setValueClass( param.getValueClass() ); newParam.setValueClassName( param.getValueClassName() ); newParam.setDescription( param.getDescription()); if (param.getDefaultValueExpression() != null) { newParam.setDefaultValueExpression( cloneExpression( (JRDesignExpression)param.getDefaultValueExpression()) ); } // Duplicate properties... replacePropertiesMap(param.getPropertiesMap(), newParam.getPropertiesMap()); return newParam; }
public ParameterNode(JasperDesign jd, JRDesignParameter parameter, Lookup doLkp) { super (Children.LEAF, new ProxyLookup(doLkp, Lookups.fixed(jd, parameter))); this.jd = jd; this.parameter = parameter; setDisplayName ( parameter.getName()); super.setName( parameter.getName() ); if (parameter.isSystemDefined()) { setIconBaseWithExtension("com/jaspersoft/ireport/designer/resources/parameter-16.png"); } else { setIconBaseWithExtension("com/jaspersoft/ireport/designer/resources/parameter-16.png"); } parameter.getEventSupport().addPropertyChangeListener(this); }
public void propertyChange(PropertyChangeEvent evt) { com.jaspersoft.ireport.designer.IReportManager.getInstance().notifyReportChange(); if (evt.getPropertyName() == null) return; if (evt.getPropertyName().equals( JRDesignParameter.PROPERTY_NAME )) { super.setName(getParameter().getName()); this.setDisplayName(getParameter().getName()); // update sorting of childrens... if (this.getParentNode() != null && this.getParentNode() instanceof ParametersNode) { SwingUtilities.invokeLater(new Runnable() { public void run() { ((ParametersNode)(ParameterNode.this.getParentNode())).updateSorting(); } }); } } // Update the sheet this.firePropertyChange(evt.getPropertyName(), evt.getOldValue(), evt.getNewValue() ); }
@Override public void setString(String value) { if (value == null || value.equals("")) { // set the default value... value = "net.sf.jasperreports.engine.JRDefaultScriptlet"; } if (scriptlet.getName().equals("REPORT")) { dataset.setScriptletClass(value); scriptlet.setValueClassName(value); } else { scriptlet.setValueClassName(value); JRDesignParameter p = (JRDesignParameter)dataset.getParametersMap().get(scriptlet.getName()+"_SCRIPTLET"); if (p!=null) { p.setValueClassName(value); } } }
@Override protected Transferable createTransferable(JComponent c) { String text = ""; if (c instanceof JList) { JList jList = (JList)c; if (jList.getSelectedValue() instanceof JRDesignParameter) { JRDesignParameter p = (JRDesignParameter) jList.getSelectedValue(); text = ((action == MOVE) ? "$P{" : "$P!{")+ p.getName() + "}"; } } return new StringSelection(text); }
private void jList1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jList1MouseClicked if (SwingUtilities.isLeftMouseButton(evt) && evt.getClickCount() == 2 && jList1.getSelectedValue() != null) { JRDesignParameter p = (JRDesignParameter)jList1.getSelectedValue(); JRParameterDialog pd = new JRParameterDialog(getReportQueryDialog(),getDataset().getParametersMap()); pd.setExpressionContext(new ExpressionContext(getDataset())); pd.setParameter(p); pd.setVisible(true); if (pd.getDialogResult() == JOptionPane.OK_OPTION) { JRDesignParameter pNew = pd.getParameter(); p.setName(pNew.getName()); p.setValueClassName(pNew.getValueClassName()); p.setDefaultValueExpression(pNew.getDefaultValueExpression()); jList1.updateUI(); } } }
private void createNewParameter() { if (getDataset() == null) return; JRParameterDialog dialog = new JRParameterDialog(getReportQueryDialog(), getDataset().getParametersMap()); dialog.setExpressionContext(new ExpressionContext(getDataset())); dialog.setVisible(true); if (dialog.getDialogResult() == JOptionPane.OK_OPTION) { JRDesignParameter p = dialog.getParameter(); try { getDataset().addParameter(p); } catch (JRException ex) { ex.printStackTrace(); } } }
@SuppressWarnings("unchecked") private void jButtonCopyFromMasterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCopyFromMasterActionPerformed javax.swing.table.DefaultTableModel model = (javax.swing.table.DefaultTableModel)jTable.getModel(); List reportParameters = IReportManager.getInstance().getActiveReport().getParametersList(); for (int i=0; i<reportParameters.size(); ++i) { JRDesignParameter jrParameter = (JRDesignParameter)reportParameters.get(i); if (jrParameter.isSystemDefined()) continue; // Check if a similar parameter already exists... if (!findParameter(parameters, jrParameter.getName())) { JRDesignGenericElementParameter parameter = new JRDesignGenericElementParameter(); parameter.setName(jrParameter.getName() ); JRDesignExpression exp = new JRDesignExpression(); exp.setText("$P{" + jrParameter.getName() + "}"); exp.setValueClassName( jrParameter.getValueClassName() ); parameter.setValueExpression(exp); parameters.add(parameter); model.addRow(new Object[]{parameter, Misc.getExpressionText(parameter.getValueExpression())}); } } jTable.updateUI(); }
@Override public Object createObject(Attributes atts) { JRDesignParameter parameter = (JRDesignParameter)digester.peek(); JRDesignExpression expression = new JRDesignExpression(); expression.setValueClassName(parameter.getValueClassName()); return expression; }
@Override public Object createObject(Attributes atts) { JRDesignParameter parameter = new JRDesignParameter(); setParameterAttributes(parameter, atts); return parameter; }
protected void setParameterAttributes(JRDesignParameter parameter, Attributes atts) { parameter.setName(atts.getValue(JRXmlConstants.ATTRIBUTE_name)); if (atts.getValue(JRXmlConstants.ATTRIBUTE_class) != null) { parameter.setValueClassName(atts.getValue(JRXmlConstants.ATTRIBUTE_class)); } String nestedType = atts.getValue(JRXmlConstants.ATTRIBUTE_nestedType); if (nestedType != null) { parameter.setNestedTypeName(nestedType); } String isForPrompting = atts.getValue(JRXmlConstants.ATTRIBUTE_isForPrompting); if (isForPrompting != null && isForPrompting.length() > 0) { parameter.setForPrompting(Boolean.valueOf(isForPrompting).booleanValue()); } ParameterEvaluationTimeEnum evaluationTime = ParameterEvaluationTimeEnum.byName(atts.getValue(JRXmlConstants.ATTRIBUTE_evaluationTime)); if (evaluationTime != null) { parameter.setEvaluationTime(evaluationTime); } }
public void addScriptlet(String name, Class<? extends JRAbstractScriptlet> type) { JRDesignScriptlet scriptlet = new JRDesignScriptlet(); scriptlet.setName(name); scriptlet.setValueClass(type); JRDesignParameter parameter = new JRDesignParameter(); parameter.setName(name + JRScriptlet.SCRIPTLET_PARAMETER_NAME_SUFFIX); parameter.setValueClass(scriptlet.getValueClass()); parameter.setSystemDefined(true); parameter.setForPrompting(false); scriptlets.add(scriptlet); parameters.add(parameter); }
public void setJrParameter(String prm) { if (jrDataset != null) this.jrParameter = (JRDesignParameter) jrDataset.getParametersMap().get(prm); if (this.jrParameter == null) { this.jrParameter = new JRDesignParameter(); this.jrParameter.setName(prm); } }
private int getParametrNameIndex() { List<JRParameter> parametersList = getValue().getJrDataset().getParametersList(); JRDesignParameter p = getValue().getJrParameter(); if (p != null) return parametersList.indexOf(p); return 0; }
@Override public void propertyChange(PropertyChangeEvent arg0) { MRoot mroot = new MRoot(null, null); mroot.setJasperConfiguration(jConfig); MReport mrep = new MReport(mroot, jConfig); MDataset mdts = new MDataset(mrep, newdataset, -1); MParameters<?> mprms = new MParameters<JRDesignDataset>(mdts, newdataset, JRDesignDataset.PROPERTY_PARAMETERS); MParameter mprm = new MParameter(mprms, (JRDesignParameter) arg0.getSource(), -1); List<Command> cmds = JaspersoftStudioPlugin.getPostSetValueManager().postSetValue(mprm, JRDesignParameter.PROPERTY_NAME, arg0.getNewValue(), arg0.getOldValue()); for (Command c : cmds) c.execute(); dataquery.setDataset(jConfig.getJasperDesign(), newdataset); }
public Image getColumnImage(Object element, int columnIndex) { JRDesignParameter field = (JRDesignParameter) element; switch (columnIndex) { case 1: if (!field.isSystemDefined()) return cblp.getCellEditorImage(field.isForPrompting()); } return null; }
public Image getColumnImage(Object element, int columnIndex) { switch (columnIndex) { case 0: if (element instanceof JRDesignField) return JaspersoftStudioPlugin.getInstance().getImage(MField.getIconDescriptor().getIcon16()); if (element instanceof JRDesignParameter) return JaspersoftStudioPlugin.getInstance().getImage(MParameter.getIconDescriptor().getIcon16()); if (element instanceof JRDesignVariable) return JaspersoftStudioPlugin.getInstance().getImage(MVariable.getIconDescriptor().getIcon16()); } return null; }
@Override public void run(final IProgressMonitor monitor) throws Exception { if (activeEditor != null) { getSettings().remove(DISCOVERED_FIELDS); getSettings().put(DATASET_QUERY_LANGUAGE, activeEditor.getQueryLanguage()); getSettings().put(DATASET_QUERY_TEXT, activeEditor.getQueryString()); if (activeEditor instanceof SimpleQueryWizardDataEditorComposite) getSettings().put(DATASET_PROPERTIES, ((SimpleQueryWizardDataEditorComposite) activeEditor).getDataset().getPropertiesMap()); UIUtils.getDisplay().asyncExec(new Runnable() { public void run() { monitor.setTaskName("Getting fields..."); } }); List<JRDesignField> fields = activeEditor.readFields(); if (fields != null && !fields.isEmpty()) { if (getSettings() != null) { getSettings().put(DISCOVERED_FIELDS, fields); } } List<JRDesignParameter> prms = activeEditor.readParameters(); if (prms != null && !prms.isEmpty()) { if (getSettings() != null) { getSettings().put(DISCOVERED_PARAMETERS, prms); } } } else { getSettings().remove(DATASET_QUERY_LANGUAGE); getSettings().remove(DATASET_QUERY_TEXT); getSettings().remove(DATASET_PROPERTIES); } }
public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) { super.createControls(parent, tabbedPropertySheetPage); parent.setLayout(new GridLayout(3, false)); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; createWidget4Property(parent, JRDesignParameter.PROPERTY_NAME).getControl().setLayoutData(gd); createWidget4Property(parent, JRDesignParameter.PROPERTY_VALUE_CLASS_NAME); }
public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) { super.createControls(parent, tabbedPropertySheetPage); parent.setLayout(new GridLayout(1, false)); rootComposite = getWidgetFactory().createComposite(parent); GridLayout rootLayout = new GridLayout(2,false); //rootLayout.horizontalSpacing = 0; rootLayout.marginHeight=0; rootLayout.marginWidth=0; //rootLayout.verticalSpacing=0; rootComposite.setLayout(rootLayout); GridData rootData = new GridData(GridData.FILL_BOTH); rootData.minimumHeight = 150; rootComposite.setLayoutData(rootData); cmp = getWidgetFactory().createComposite(rootComposite); GridLayout layout = new GridLayout(3, false); layout.marginWidth = 0; layout.marginHeight = 0; cmp.setLayout(layout); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; cmp.setLayoutData(gd); createWidget4Property(cmp, JRDesignParameter.PROPERTY_NESTED_TYPE_NAME); gd = new GridData(GridData.FILL_HORIZONTAL); createWidget4Property(rootComposite, JRDesignParameter.PROPERTY_DESCRIPTION).getControl().setLayoutData(gd); if (getElement() instanceof MParameter) { MParameter p = (MParameter) getElement(); if (p.isMainDataset()) createWidget4Property(rootComposite, JRDesignParameter.PROPERTY_FOR_PROMPTING); } createWidget4Property(rootComposite, JRDesignParameter.PROPERTY_DEFAULT_VALUE_EXPRESSION); }
@Override protected void initializeProvidedProperties() { super.initializeProvidedProperties(); addProvidedProperties(JRDesignParameter.PROPERTY_NESTED_TYPE_NAME, Messages.MParameter_nested_type_name); addProvidedProperties(JRDesignParameter.PROPERTY_DESCRIPTION, Messages.common_description); addProvidedProperties(JRDesignParameter.PROPERTY_FOR_PROMPTING, Messages.MParameter_is_for_prompting); addProvidedProperties(JRDesignParameter.PROPERTY_DEFAULT_VALUE_EXPRESSION, Messages.MParameter_default_value_expression); }
protected ParameterDialog(Shell parentShell, int indx, JRDesignParameter prm, Table table) { super(parentShell); this.prm = prm; this.indx = indx; this.table = table; setTitle(Messages.ParameterDialog_0); setDescription(""); //$NON-NLS-1$ setDefaultSize(600, 400); }
public void addParameters(ParameterSet set, JasperDesign jd) { for (JRDesignParameter p : set.getParameters()) { if (!jd.getParametersMap().containsKey(p)) try { jd.addParameter((JRParameter) p.clone()); } catch (JRException e) { e.printStackTrace(); } } }
/** * @param jContext * @param jrDataset * @param jrParameter */ public DeleteParameterCommand(JasperReportsConfiguration jContext, JRDesignDataset jrDataset, JRParameter jrParameter, Boolean canceled) { super(canceled); this.jContext = jContext; jd = jContext.getJasperDesign(); this.jrDataset = jrDataset; this.jrParameter = (JRDesignParameter) jrParameter; objectName = "$P{" + jrParameter.getName() + "}"; }