Browse Source

Pull request #1764: REPORT-34091 无法取消勾选「填报/分析时保留公式用于计算

Merge in DESIGN/design from ~HENRY.WANG/design:release/10.0 to release/10.0

* commit '7f06d48e3e7e5614c29e02097f6c60bdfa1fafdb':
  REPORT-34091 当公式为空时也保存按钮的状态
  REPORT-34091 添加判断
  REPORT-34091 去掉无用的import
  REPORT-34091 无法取消勾选「填报/分析时保留公式用于计算
feature/big-screen
Henry.Wang 4 years ago
parent
commit
4eca831155
  1. 17
      designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java

17
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;
@ -20,6 +19,7 @@ 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.stable.ColumnRow;
import com.fr.stable.StringUtils;
@ -56,6 +56,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,19 +105,27 @@ 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();
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() {
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);
}
}).setVisible(true);
}

Loading…
Cancel
Save