1 package org.simantics.spreadsheet.graph.synchronization;
3 import org.simantics.spreadsheet.graph.SpreadsheetBook;
4 import org.simantics.spreadsheet.graph.SpreadsheetLines;
5 import org.simantics.structural.synchronization.base.CommandBuilder;
6 import org.simantics.structural.synchronization.base.Solver;
8 public class LinesCommandBuilder implements CommandBuilder {
10 private final boolean update;
14 public LinesCommandBuilder(String name, boolean update) {
20 public void apply(Solver solver) {
24 SpreadsheetBook book = solver.getConcreteSolver();
25 SpreadsheetLines node = book.ensureSubprocess(name);
28 // String path = name.substring(0, name.lastIndexOf("/"));
29 // String lineName = name.substring(name.lastIndexOf("/")+1);
30 // int row = Integer.parseInt(lineName.substring(3));
33 // SpreadsheetLine line = node.lines.get(-row);
35 // line = new SpreadsheetLine(node, row);
36 // node.lines.put(-row, line);
39 // for(int i=0;i<bean.cells.length;i++) {
41 // LineContentBeanCell cell = bean.cells[i];
45 // if(ExcelFormula.BINDING.type().equals(cell.content.getBinding().type())) {
46 // ExcelFormula formula = (ExcelFormula)cell.content.getValue(ExcelFormula.BINDING);
47 // SheetFormulaParser p = new SheetFormulaParser(new StringReader(formula.expression));
48 // AstValue v = p.relation();
49 // line.cells.add(new SpreadsheetCell(line, i, new SpreadsheetFormula(v, formula.expression), 0));
51 // line.cells.add(new SpreadsheetCell(line, i, cell.content.getValue(), 0));
53 // } catch (Throwable e) {
54 // line.cells.add(new SpreadsheetCell(line, i, cell.content.getValue(), 0));
56 // new Exception("failed: " + ((ExcelFormula)(cell.content.getValue(ExcelFormula.BINDING))).expression, e).printStackTrace();
57 // } catch (AdaptException e1) {
58 // e1.printStackTrace();
66 @SuppressWarnings("unchecked")
68 public <T> T getConcrete() {