String str = (String)getCellEditorValue();
String cellName = SpreadsheetUtils.cellName(row, column);
- String expression = clientModel.getPossiblePropertyAt(cellName, ClientModel.CONTENT_EXPRESSION);
+ Object expressionO = clientModel.getPossiblePropertyAt(cellName, ClientModel.CONTENT_EXPRESSION);
+ String expression = null;
+ if(expressionO instanceof String) {
+ expression = (String)expressionO;
+ } else if(expressionO instanceof Variant) {
+ expression = ((Variant)expressionO).getValue().toString();
+ }
+
if(expression == null) {
Variant content = SpreadsheetUtils.getSafeClientVariant(clientModel, cellName, ClientModel.CONTENT);
if(content != null)
expression = "";
} else {
expression = "=" + expression;
- }
+ }
+ //Don't update if the expression hasn't changed
if (expression.equals(str))
return;
if (str.startsWith("=")) {
editor.edit(null, SpreadsheetUtils.cellName(row, column), ClientModel.CONTENT_EXPRESSION, str, Bindings.STRING, null);
+ //Update cell expression
+ clientModel.setProperty(cellName, ClientModel.CONTENT_EXPRESSION, str);
} else {
editor.edit(null, SpreadsheetUtils.cellName(row, column), Variant.ofInstance(str), null);
+ //Update cell expression
+ clientModel.setProperty(cellName, ClientModel.CONTENT_EXPRESSION, null); //If not an expression, then the expression property is null
}
}