From f6b44ed845d7004220ae41f1a9499b92ee5aa8d0 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Tue, 23 Jun 2020 10:25:51 +0800 Subject: [PATCH 1/4] =?UTF-8?q?REPORT-34091=20=E6=97=A0=E6=B3=95=E5=8F=96?= =?UTF-8?q?=E6=B6=88=E5=8B=BE=E9=80=89=E3=80=8C=E5=A1=AB=E6=8A=A5/?= =?UTF-8?q?=E5=88=86=E6=9E=90=E6=97=B6=E4=BF=9D=E7=95=99=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E7=94=A8=E4=BA=8E=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cellquick/CellFormulaQuickEditor.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java index ff8a74e57..2a903f1c2 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java @@ -20,8 +20,11 @@ import com.fr.grid.selection.CellSelection; import com.fr.quickeditor.CellQuickEditor; import com.fr.report.ReportHelper; import com.fr.report.cell.DefaultTemplateCellElement; +import com.fr.report.cell.TemplateCellElement; +import com.fr.report.elementcase.TemplateElementCase; import com.fr.stable.ColumnRow; import com.fr.stable.StringUtils; +import com.fr.web.core.A.S; import javax.swing.BorderFactory; import javax.swing.JComponent; @@ -56,6 +59,9 @@ public class CellFormulaQuickEditor extends CellQuickEditor { //默认值 private static final String DEFAULT_FORMULA = "="; + //正在编辑的单元格 + private TemplateCellElement editingCellElement; + private DocumentListener documentListener = new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { @@ -102,9 +108,11 @@ public class CellFormulaQuickEditor extends CellQuickEditor { formulaButton.setPreferredSize(new Dimension(20, formulaTextField.getPreferredSize().height)); formulaButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { - String text = formulaTextField.getText(); final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula(); - formulaPane.populate(BaseFormula.createFormulaBuilder().build(text)); + CellSelection cellSelection = (CellSelection)tc.getSelection(); + editingCellElement = tc.getEditingElementCase().getTemplateCellElement(cellSelection.getColumn(),cellSelection.getRow()); + BaseFormula baseFormula = (BaseFormula) editingCellElement.getValue(); + formulaPane.populate(baseFormula); formulaPane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { @Override public void doOk() { @@ -113,8 +121,8 @@ public class CellFormulaQuickEditor extends CellQuickEditor { formulaTextField.setText(DEFAULT_FORMULA); } else { formulaTextField.setText(fm.getContent()); + editingCellElement.setValue(fm); } - } }).setVisible(true); } From 33a7e468d322286a30e7d55105e32ad86193bcc1 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Tue, 23 Jun 2020 10:37:45 +0800 Subject: [PATCH 2/4] =?UTF-8?q?REPORT-34091=20=E5=8E=BB=E6=8E=89=E6=97=A0?= =?UTF-8?q?=E7=94=A8=E7=9A=84import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java index 2a903f1c2..aa2fe0662 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java @@ -9,7 +9,6 @@ import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.formula.FormulaFactory; import com.fr.design.formula.UIFormula; import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -21,10 +20,8 @@ import com.fr.quickeditor.CellQuickEditor; import com.fr.report.ReportHelper; import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.TemplateCellElement; -import com.fr.report.elementcase.TemplateElementCase; import com.fr.stable.ColumnRow; import com.fr.stable.StringUtils; -import com.fr.web.core.A.S; import javax.swing.BorderFactory; import javax.swing.JComponent; From 0b5471cc7044018bff293aedb3cb9a5bc439d77a Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Tue, 23 Jun 2020 14:00:10 +0800 Subject: [PATCH 3/4] =?UTF-8?q?REPORT-34091=20=E6=B7=BB=E5=8A=A0=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cellquick/CellFormulaQuickEditor.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java index aa2fe0662..5c31edd07 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java @@ -106,10 +106,15 @@ public class CellFormulaQuickEditor extends CellQuickEditor { formulaButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula(); - CellSelection cellSelection = (CellSelection)tc.getSelection(); - editingCellElement = tc.getEditingElementCase().getTemplateCellElement(cellSelection.getColumn(),cellSelection.getRow()); - BaseFormula baseFormula = (BaseFormula) editingCellElement.getValue(); - formulaPane.populate(baseFormula); + CellSelection cellSelection = (CellSelection) tc.getSelection(); + editingCellElement = tc.getEditingElementCase().getTemplateCellElement(cellSelection.getColumn(), cellSelection.getRow()); + Object object = editingCellElement.getValue(); + if (object instanceof BaseFormula) { + formulaPane.populate((BaseFormula) object); + } else { + String text = formulaTextField.getText(); + formulaPane.populate(BaseFormula.createFormulaBuilder().build(text)); + } formulaPane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { @Override public void doOk() { From 7f06d48e3e7e5614c29e02097f6c60bdfa1fafdb Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Tue, 23 Jun 2020 14:30:41 +0800 Subject: [PATCH 4/4] =?UTF-8?q?REPORT-34091=20=E5=BD=93=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E6=97=B6=E4=B9=9F=E4=BF=9D=E5=AD=98=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E7=9A=84=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java index 5c31edd07..3abd0f3aa 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java @@ -120,11 +120,12 @@ public class CellFormulaQuickEditor extends CellQuickEditor { public void doOk() { BaseFormula fm = formulaPane.update(); if (fm.getContent().length() <= 1) { + fm.setContent(DEFAULT_FORMULA); formulaTextField.setText(DEFAULT_FORMULA); } else { formulaTextField.setText(fm.getContent()); - editingCellElement.setValue(fm); } + editingCellElement.setValue(fm); } }).setVisible(true); }