|
|
|
@ -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()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|