import org.simantics.spreadsheet.solver.formula.parser.ast.AstValue;
@SuppressWarnings("rawtypes")
-public class SpreadsheetCell implements SpreadsheetElement, SheetNode {
+public class SpreadsheetCell extends BinarySearch implements SpreadsheetElement, SheetNode {
private static final long serialVersionUID = 6616793596542239339L;
private int iterations = 0;
final private SpreadsheetLine line;
- final private int column;
int style;
- private Object content;
+ Object content;
final private Map<String, SheetNode> properties;
public SpreadsheetCell(SpreadsheetLine line, int column) {
+ super(column);
this.properties = createProperties();
this.line = line;
- this.column = column;
}
//All SpreadsheetCells have these properties - create them when object is created
public Object getContent() {
return content;
}
+
+ public Variant getContentVariant(SpreadsheetBook book) {
+
+ try {
+ Object content = evaluate(SpreadsheetEvaluationEnvironment.getInstance(book));
+ if(content == null) return Variant.ofInstance("");
+ if(content instanceof Variant) return (Variant)content;
+ if(content instanceof ExternalRefData) return ((ExternalRefData)content).getContent();
+ else return Variant.ofInstance(content);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ return Variant.ofInstance(t.toString());
+ }
+ }
+
+ public SpreadsheetLine getLine() {
+ return line;
+ }
public static SpreadsheetCell empty(SpreadsheetLine line, int column) {
SpreadsheetCell cell = new SpreadsheetCell(line, column);