|
|
|
@ -1064,13 +1064,14 @@ public class CellDSColumnEditor extends CellQuickEditor {
|
|
|
|
|
public class JFormulaField extends JPanel { |
|
|
|
|
private CellElement cellElement; |
|
|
|
|
private FormulaTextField formulaTextField; |
|
|
|
|
private String defaultValue; |
|
|
|
|
private BaseFormula defaultFormula; |
|
|
|
|
|
|
|
|
|
public JFormulaField(String defaultValue) { |
|
|
|
|
|
|
|
|
|
this.defaultValue = defaultValue; |
|
|
|
|
this.defaultFormula = BaseFormula.createFormulaBuilder().build(defaultValue); |
|
|
|
|
formulaTextField = new FormulaTextField(); |
|
|
|
|
formulaTextField.setText(defaultValue); |
|
|
|
|
formulaTextField.setValue(defaultFormula); |
|
|
|
|
|
|
|
|
|
JPanel textFieldPane = new JPanel(new BorderLayout()); |
|
|
|
|
textFieldPane.add(formulaTextField, BorderLayout.CENTER); |
|
|
|
|
textFieldPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); |
|
|
|
@ -1101,7 +1102,6 @@ public class CellDSColumnEditor extends CellQuickEditor {
|
|
|
|
|
public void populateFormula(BaseFormula baseFormula) { |
|
|
|
|
|
|
|
|
|
this.formulaTextField.setValue(baseFormula); |
|
|
|
|
this.formulaTextField.setText(baseFormula.getContent()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public BaseFormula getFormula() { |
|
|
|
@ -1145,9 +1145,8 @@ public class CellDSColumnEditor extends CellQuickEditor {
|
|
|
|
|
public void doOk() { |
|
|
|
|
BaseFormula valueFormula = formulaPane.update(); |
|
|
|
|
if (valueFormula.getContent().length() <= 1) { |
|
|
|
|
formulaTextField.setText(defaultValue); |
|
|
|
|
formulaTextField.setValue(defaultFormula); |
|
|
|
|
} else { |
|
|
|
|
formulaTextField.setText(valueFormula.getPureContent()); |
|
|
|
|
formulaTextField.setValue(valueFormula); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1165,6 +1164,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; |
|
|
|
|
|
|
|
|
@ -1187,6 +1187,8 @@ public class CellDSColumnEditor extends CellQuickEditor {
|
|
|
|
|
BaseFormula valueFormula = dSColumn.getResultObject(); |
|
|
|
|
if (valueFormula != null) { |
|
|
|
|
formulaField.populateFormula(valueFormula); |
|
|
|
|
} else { |
|
|
|
|
formulaField.populateFormula(DEFAULT_FORMULA); |
|
|
|
|
} |
|
|
|
|
formulaField.populateElement(cellElement); |
|
|
|
|
|
|
|
|
|