protected void initSheetProperties() { spParameterName = new SheetProperty( "parameterName", I18n.getString("crosstabParameterDialog.label1", "Parameter name"), SheetProperty.TEXT); spParameterName.setShowResetButton(false); spParameterDescription = new SheetProperty( "parameterDescription", I18n.getString("jRParameterDialog.label4", "Parameter Description"), SheetProperty.TEXT); spParameterDescription.setShowResetButton(false); spParameterDefaultValueExpression = new ExpressionSheetProperty( "parameterDefaultValueExpression", it.businesslogic.ireport.util.I18n.getString( "jRParameterDialog.label3", "Default Value Expression")); spParameterDefaultValueExpression.setShowResetButton(false); spParameterProperties = new PropertiesSheetProperty( "parameterProperties", it.businesslogic.ireport.util.I18n.getString( "parameterProperties", "Parameter Properties")); spParameterProperties.setShowResetButton(false); spParameterClassType = new ComboBoxSheetProperty( "parameterClassType", it.businesslogic.ireport.util.I18n.getString( "jRParameterDialog.label2", "Parameter Class Type")); spParameterClassType.setShowResetButton(false); JComboBox classTypeCombo = (JComboBox) spParameterClassType.getEditor(); classTypeCombo.setEditable(true); classTypeCombo.addItem("java.lang.Boolean"); classTypeCombo.addItem("java.lang.Byte"); classTypeCombo.addItem("java.util.Date"); classTypeCombo.addItem("java.sql.Timestamp"); classTypeCombo.addItem("java.sql.Time"); classTypeCombo.addItem("java.lang.Double"); classTypeCombo.addItem("java.lang.Float"); classTypeCombo.addItem("java.lang.Integer"); classTypeCombo.addItem("java.lang.Long"); classTypeCombo.addItem("java.lang.Short"); classTypeCombo.addItem("java.math.BigDecimal"); classTypeCombo.addItem("java.lang.Number"); classTypeCombo.addItem("java.lang.String"); classTypeCombo.addItem("java.util.Collection"); classTypeCombo.addItem("java.util.List"); classTypeCombo.addItem("java.lang.Object"); classTypeCombo.addItem("java.io.InputStream"); classTypeCombo.addItem("net.sf.jasperreports.engine.JREmptyDataSource"); spParameterIsForPrompting = new SheetProperty( "parameterIsForPrompting", it.businesslogic.ireport.util.I18n.getString( "jRParameterDialog.checkBoxIsForPrompting", "Use as a Prompt"), SheetProperty.BOOLEAN); spParameterIsForPrompting.setShowResetButton(false); spFieldName = new SheetProperty( "fieldName", I18n.getString("jRFieldDialog.label1", "Field name"), SheetProperty.TEXT); spFieldName.setShowResetButton(false); spFieldDescription = new SheetProperty( "fieldDescription", I18n.getString("jRFieldDialog.label4", "Field Description"), SheetProperty.TEXT); spFieldDescription.setShowResetButton(false); spFieldClassType = new ComboBoxSheetProperty( "fieldClassType", it.businesslogic.ireport.util.I18n.getString( "jRFieldDialog.label2", "Field Class Type")); spFieldClassType.setShowResetButton(false); classTypeCombo = (JComboBox) spFieldClassType.getEditor(); classTypeCombo.setEditable(true); classTypeCombo.addItem("java.lang.Boolean"); classTypeCombo.addItem("java.lang.Byte"); classTypeCombo.addItem("java.util.Date"); classTypeCombo.addItem("java.sql.Timestamp"); classTypeCombo.addItem("java.sql.Time"); classTypeCombo.addItem("java.lang.Double"); classTypeCombo.addItem("java.lang.Float"); classTypeCombo.addItem("java.lang.Integer"); classTypeCombo.addItem("java.lang.Long"); classTypeCombo.addItem("java.lang.Short"); classTypeCombo.addItem("java.math.BigDecimal"); classTypeCombo.addItem("java.lang.Number"); classTypeCombo.addItem("java.lang.String"); classTypeCombo.addItem("java.util.Collection"); classTypeCombo.addItem("java.util.List"); spFieldProperties = new PropertiesSheetProperty( "fieldProperties", it.businesslogic.ireport.util.I18n.getString("fieldProperties", "Field Properties")); spFieldProperties.setShowResetButton(false); spVariableName = new SheetProperty( "variableName", I18n.getString("jRVariableDialog.label1", "Variable name"), SheetProperty.TEXT); spVariableName.setShowResetButton(false); spVariableClassType = new ComboBoxSheetProperty( "variableClassType", it.businesslogic.ireport.util.I18n.getString( "jRVariableDialog.label5", "Variable Class Type")); spVariableClassType.setShowResetButton(false); classTypeCombo = (JComboBox) spVariableClassType.getEditor(); classTypeCombo.setEditable(true); classTypeCombo.addItem("java.lang.Boolean"); classTypeCombo.addItem("java.lang.Byte"); classTypeCombo.addItem("java.util.Date"); classTypeCombo.addItem("java.sql.Timestamp"); classTypeCombo.addItem("java.sql.Time"); classTypeCombo.addItem("java.lang.Double"); classTypeCombo.addItem("java.lang.Float"); classTypeCombo.addItem("java.lang.Integer"); classTypeCombo.addItem("java.lang.Long"); classTypeCombo.addItem("java.lang.Short"); classTypeCombo.addItem("java.math.BigDecimal"); classTypeCombo.addItem("java.lang.Number"); classTypeCombo.addItem("java.lang.String"); classTypeCombo.addItem("java.util.Collection"); classTypeCombo.addItem("java.util.List"); classTypeCombo.addItem("java.lang.Object"); classTypeCombo.addItem("java.io.InputStream"); classTypeCombo.addItem("net.sf.jasperreports.engine.JREmptyDataSource"); spVariableCalculationType = new SheetProperty( "variableCalculationType", it.businesslogic.ireport.util.I18n.getString( "jRVariableDialog.label2", "Calculation Type"), SheetProperty.COMBOBOX); Vector tags = new Vector(); tags.add(new Tag("Nothing", I18n.getString("variable.calculationType.Nothing", "Nothing"))); tags.add(new Tag("Count", I18n.getString("variable.calculationType.Count", "Count"))); tags.add( new Tag( "DistinctCount", I18n.getString("variable.calculationType.DistinctCount", "Distinct count"))); tags.add(new Tag("Sum", I18n.getString("variable.calculationType.Sum", "Sum"))); tags.add(new Tag("Average", I18n.getString("variable.calculationType.Average", "Average"))); tags.add(new Tag("Lowest", I18n.getString("variable.calculationType.Lowest", "Lowest"))); tags.add(new Tag("Highest", I18n.getString("variable.calculationType.Highest", "Highest"))); tags.add( new Tag( "StandardDeviation", I18n.getString("variable.calculationType.StandardDeviation", "Standard deviation"))); tags.add(new Tag("Variance", I18n.getString("variable.calculationType.Variance", "Variance"))); tags.add(new Tag("System", I18n.getString("variable.calculationType.System", "System"))); tags.add(new Tag("First", I18n.getString("variable.calculationType.First", "First"))); spVariableCalculationType.setTags(tags); spVariableCalculationType.setDefaultValue("Now"); spVariableCalculationType.setShowResetButton(false); spVariableResetType = new it.businesslogic.ireport.gui.sheet.SheetProperty( "variableResetType", it.businesslogic.ireport.util.I18n.getString("jRVariableDialog.label7", "Reset Type"), it.businesslogic.ireport.gui.sheet.SheetProperty.COMBOBOX); spVariableResetType.setShowResetButton(false); tags = new Vector(); tags.add( new Tag("None", it.businesslogic.ireport.util.I18n.getString("resetType.None", "None"))); tags.add( new Tag( "Report", it.businesslogic.ireport.util.I18n.getString("resetType.Report", "Report"))); tags.add( new Tag("Page", it.businesslogic.ireport.util.I18n.getString("resetType.Page", "Page"))); tags.add( new Tag( "Column", it.businesslogic.ireport.util.I18n.getString("resetType.Column", "Column"))); tags.add( new Tag("Group", it.businesslogic.ireport.util.I18n.getString("resetType.Group", "Group"))); spVariableResetType.setTags(tags); spVariableResetType.setDefaultValue("Report"); spVariableResetGroup = new ComboBoxSheetProperty( "variableResetGroup", it.businesslogic.ireport.util.I18n.getString("jRVariableDialog.label6", "Reset Group")); spVariableResetGroup.setShowResetButton(false); spVariableIncrementType = new SheetProperty( "variableIncrementType", it.businesslogic.ireport.util.I18n.getString( "gui.elementpropertiessheet.textfieldEvaluationTime", "Eval. time"), SheetProperty.COMBOBOX); tags = new Vector(); tags.add( new Tag( "None", it.businesslogic.ireport.util.I18n.getString("incrementType.None", "None"))); tags.add( new Tag( "Report", it.businesslogic.ireport.util.I18n.getString("incrementType.Report", "Report"))); tags.add( new Tag( "Page", it.businesslogic.ireport.util.I18n.getString("incrementType.Page", "Page"))); tags.add( new Tag( "Column", it.businesslogic.ireport.util.I18n.getString("incrementType.Column", "Column"))); tags.add( new Tag( "Group", it.businesslogic.ireport.util.I18n.getString("incrementType.Group", "Group"))); spVariableIncrementType.setShowResetButton(false); spVariableIncrementType.setTags(tags); spVariableIncrementType.setDefaultValue("None"); spVariableIncrementGroup = new ComboBoxSheetProperty( "variableIncrementGroup", it.businesslogic.ireport.util.I18n.getString( "jRVariableDialog.label10", "Increment Group")); spVariableIncrementGroup.setShowResetButton(false); spVariableIncrementerClass = new SheetProperty( "variableIncrementerClass", I18n.getString("jRVariableDialog.label8", "Custom Incrementer Factory Class"), SheetProperty.TEXT); spVariableIncrementerClass.setShowResetButton(false); spVariableExpression = new ExpressionSheetProperty( "variableExpression", it.businesslogic.ireport.util.I18n.getString( "jRVariableDialog.label3", "Variable Expression")); spVariableExpression.setShowResetButton(false); spVariableInitialValueExpression = new ExpressionSheetProperty( "variableInitialValueExpression", it.businesslogic.ireport.util.I18n.getString( "jRVariableDialog.label4", "Initial Value Expression")); spVariableInitialValueExpression.setShowResetButton(false); }
/** This methos is called when a property changes... */ public void sheetPropertyValueChanged(SheetPropertyValueChangedEvent evt) { if (isInit()) return; try { setInit(true); // System.out.println("Changed: " + evt.getPropertyName()); // if (isNullItem((SheetProperty)evt.getSource())) return; // removeNullItem( (SheetProperty)evt.getSource() ); Vector selectedElements = getSelection(); Vector modified_parameters = new Vector(); Vector original_parameters = new Vector(); Vector modified_fields = new Vector(); Vector original_fields = new Vector(); Vector modified_variables = new Vector(); Vector original_variables = new Vector(); for (int i = 0; i < selectedElements.size(); ++i) { Object object = selectedElements.elementAt(i); if (object instanceof JRParameter) { JRParameter param = (JRParameter) object; if (param.isBuiltin()) continue; JRParameter originalParam = param.cloneMe(); if (applyNewParameterProperty( param, evt.getPropertyName(), evt.getOldValue(), evt.getNewValue())) { modified_parameters.add(object); original_parameters.add(originalParam); } } else if (object instanceof JRField) { JRField field = (JRField) object; JRField originalField = field.cloneMe(); if (applyNewFieldProperty( field, evt.getPropertyName(), evt.getOldValue(), evt.getNewValue())) { modified_fields.add(object); original_fields.add(originalField); } } else if (object instanceof JRVariable) { JRVariable variable = (JRVariable) object; JRVariable originalVariable = variable.cloneMe(); if (applyNewVariableProperty( variable, evt.getPropertyName(), evt.getOldValue(), evt.getNewValue())) { modified_variables.add(object); original_variables.add(originalVariable); } } // don't listen to these events... for (int k = 0; k < modified_parameters.size(); ++k) { JRParameter param = (JRParameter) modified_parameters.get(k); JRParameter oldParam = (JRParameter) original_parameters.get(k); SubDataset sd = Misc.getObjectSubDataset(getJrf().getReport(), param); sd.fireSubDatasetObjectChangedListenerSubDatasetObjectChanged( new it.businesslogic.ireport.gui.event.SubDatasetObjectChangedEvent( sd, it.businesslogic.ireport.gui.event.SubDatasetObjectChangedEvent.PARAMETER, it.businesslogic.ireport.gui.event.SubDatasetObjectChangedEvent.MODIFIED, oldParam, param)); } for (int k = 0; k < modified_fields.size(); ++k) { JRField field = (JRField) modified_fields.get(k); JRField oldField = (JRField) original_fields.get(k); SubDataset sd = Misc.getObjectSubDataset(getJrf().getReport(), field); sd.fireSubDatasetObjectChangedListenerSubDatasetObjectChanged( new it.businesslogic.ireport.gui.event.SubDatasetObjectChangedEvent( sd, it.businesslogic.ireport.gui.event.SubDatasetObjectChangedEvent.FIELD, it.businesslogic.ireport.gui.event.SubDatasetObjectChangedEvent.MODIFIED, oldField, field)); } for (int k = 0; k < modified_variables.size(); ++k) { JRVariable variable = (JRVariable) modified_variables.get(k); JRVariable oldVariable = (JRVariable) original_variables.get(k); SubDataset sd = Misc.getObjectSubDataset(getJrf().getReport(), variable); sd.fireSubDatasetObjectChangedListenerSubDatasetObjectChanged( new it.businesslogic.ireport.gui.event.SubDatasetObjectChangedEvent( sd, it.businesslogic.ireport.gui.event.SubDatasetObjectChangedEvent.VARIABLE, it.businesslogic.ireport.gui.event.SubDatasetObjectChangedEvent.MODIFIED, oldVariable, variable)); } } getJrf().getReport().incrementReportChanges(); } finally { setInit(false); } }