Browse Source

REPORT-37487 数据列右侧属性面板高级部分功能出现问题

右侧面板,显示值为空时,重置为 =$$$
双击数据源高级中,不会重置。
feature/big-screen
Harrison 4 years ago
parent
commit
3b5adce5d3
  1. 11
      designer-base/src/main/java/com/fr/design/formula/FormulaTextField.java
  2. 6
      designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java
  3. 20
      designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

11
designer-base/src/main/java/com/fr/design/formula/FormulaTextField.java

@ -18,8 +18,6 @@ public class FormulaTextField extends DictionaryTextField<BaseFormula> {
private static final String EMPTY_STRING = "=";
private static final BaseFormula EMPTY_FORMULA = BaseFormula.createFormulaBuilder().build(EMPTY_STRING);
public FormulaTextField() {
}
@ -64,10 +62,10 @@ public class FormulaTextField extends DictionaryTextField<BaseFormula> {
@Override
public void setValue(BaseFormula value) {
this.value = value;
if (this.value == null) {
this.value = createDefault();
if (value == null) {
value = createDefault();
}
this.value = value;
}
/**
@ -94,7 +92,8 @@ public class FormulaTextField extends DictionaryTextField<BaseFormula> {
if (StringUtils.isNotEmpty(text)) {
return BaseFormula.createFormulaBuilder().build(text);
} else {
return EMPTY_FORMULA;
//防止默认值被修改, 每一次创建都是不一样的。
return BaseFormula.createFormulaBuilder().build(EMPTY_STRING);
}
}
}

6
designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java

@ -410,10 +410,10 @@ public class DSColumnAdvancedPane extends BasicPane {
private static class JFormulaField extends JPanel {
private CellElement cellElement;
private FormulaTextField formulaTextField;
private BaseFormula defaultFormula;
private String defaultValue;
public JFormulaField(String defaultValue) {
this.defaultFormula = BaseFormula.createFormulaBuilder().build(defaultValue);
this.defaultValue = defaultValue;
this.setLayout(FRGUIPaneFactory.createBoxFlowLayout());
UILabel bottomLabel = new UILabel("=");
@ -421,6 +421,7 @@ public class DSColumnAdvancedPane extends BasicPane {
this.add(bottomLabel);
formulaTextField = new FormulaTextField(24);
this.add(formulaTextField);
BaseFormula defaultFormula = BaseFormula.createFormulaBuilder().build(this.defaultValue);
formulaTextField.setValueAndText(defaultFormula, true);
UIButton bottomFrmulaButton = new UIButton("...");
@ -480,6 +481,7 @@ public class DSColumnAdvancedPane extends BasicPane {
public void doOk() {
BaseFormula valueFormula = formulaPane.update();
if (valueFormula.getContent().length() <= 1) {
BaseFormula defaultFormula = BaseFormula.createFormulaBuilder().build(defaultValue);
formulaTextField.setValueAndText(defaultFormula, true);
} else {
formulaTextField.setValueAndText(valueFormula, true);

20
designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

@ -646,7 +646,6 @@ public class CellDSColumnEditor extends CellQuickEditor {
*/
public class ResultSetSortConfigPane extends JPanel {
private static final String DEFAULT_VALUE = "=";
private final BaseFormula DEFAULT_FORMULA = BaseFormula.createFormulaBuilder().build();
private JPanel contentPane;
private UIButtonGroup sortTypePane;
private JFormulaField formulaField;
@ -723,7 +722,8 @@ public class CellDSColumnEditor extends CellQuickEditor {
}
BaseFormula baseFormula = dSColumn.getSortFormulaObject();
if (baseFormula == null) {
this.formulaField.populateFormula(DEFAULT_FORMULA);
BaseFormula defaultFormula = BaseFormula.createFormulaBuilder().build();
this.formulaField.populateFormula(defaultFormula);
} else {
this.formulaField.populateFormula(baseFormula);
}
@ -1064,11 +1064,12 @@ public class CellDSColumnEditor extends CellQuickEditor {
public class JFormulaField extends JPanel {
private CellElement cellElement;
private FormulaTextField formulaTextField;
private BaseFormula defaultFormula;
private String defaultValue;
public JFormulaField(String defaultValue) {
this.defaultFormula = BaseFormula.createFormulaBuilder().build(defaultValue);
this.defaultValue = defaultValue;
BaseFormula defaultFormula = BaseFormula.createFormulaBuilder().build(this.defaultValue);
formulaTextField = new FormulaTextField();
formulaTextField.setValueAndText(defaultFormula, false);
@ -1145,6 +1146,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
public void doOk() {
BaseFormula valueFormula = formulaPane.update();
if (valueFormula.getContent().length() <= 1) {
BaseFormula defaultFormula = BaseFormula.createFormulaBuilder().build(defaultValue);
formulaTextField.setValueAndText(defaultFormula, false);
} else {
formulaTextField.setValueAndText(valueFormula, false);
@ -1164,8 +1166,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
*/
public class CustomValuePane extends JPanel {
private static final String DEFAULT_VALUE = "=$$$";
private final BaseFormula DEFAULT_FORMULA = BaseFormula.createFormulaBuilder().build(DEFAULT_VALUE);
private JFormulaField formulaField;
public CustomValuePane() {
@ -1188,7 +1189,8 @@ public class CellDSColumnEditor extends CellQuickEditor {
if (valueFormula != null) {
formulaField.populateFormula(valueFormula);
} else {
formulaField.populateFormula(DEFAULT_FORMULA);
BaseFormula defaultFormula = BaseFormula.createFormulaBuilder().build(DEFAULT_VALUE);
formulaField.populateFormula(defaultFormula);
}
formulaField.populateElement(cellElement);
@ -1201,7 +1203,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
Object value = cellElement.getValue();
if (value instanceof DSColumn) {
DSColumn dSColumn = (DSColumn) (cellElement.getValue());
dSColumn.setResultObject(this.formulaField.getFormula());
dSColumn.setResultObject(StringUtils.isEmpty(this.formulaField.getFormulaText()) ? null : this.formulaField.getFormula());
}
}
}

Loading…
Cancel
Save