]> gerrit.simantics Code Review - simantics/platform.git/blob
cd1a6f36ae5e5943f2d6aba88264c3fe71ef155a
[simantics/platform.git] /
1 package org.simantics.spreadsheet.graph.synchronization;
2
3 import org.simantics.spreadsheet.graph.SpreadsheetBook;
4 import org.simantics.spreadsheet.graph.SpreadsheetLines;
5 import org.simantics.structural.synchronization.utils.CommandBuilder;
6 import org.simantics.structural.synchronization.utils.Solver;
7
8 public class LinesCommandBuilder implements CommandBuilder {
9         
10         private final boolean update;
11     private String name;
12         int[] keys;
13         
14         public LinesCommandBuilder(String name, boolean update) {
15                 this.name = name;
16                 this.update = update;
17         }
18
19         @Override
20         public void apply(Solver solver) {
21 //          if (update)
22 //              return;
23                 
24                 SpreadsheetBook book = solver.getConcreteSolver();
25                 SpreadsheetLines node = book.ensureSubprocess(name);
26                 node.setKeys(keys);
27                 
28 //              String path = name.substring(0, name.lastIndexOf("/"));
29 //              String lineName = name.substring(name.lastIndexOf("/")+1);
30 //              int row = Integer.parseInt(lineName.substring(3));
31 //              
32                 
33 //              SpreadsheetLine line = node.lines.get(-row);
34 //              if(line == null) {
35 //                      line = new SpreadsheetLine(node, row);
36 //                      node.lines.put(-row, line);
37 //              }
38 //              
39 //              for(int i=0;i<bean.cells.length;i++) {
40 //                      
41 //                      LineContentBeanCell cell = bean.cells[i];
42 //                      
43 //                      try {
44 //                              
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));
50 //                              } else {
51 //                                      line.cells.add(new SpreadsheetCell(line, i, cell.content.getValue(), 0));
52 //                              }
53 //                      } catch (Throwable e) {
54 //                              line.cells.add(new SpreadsheetCell(line, i, cell.content.getValue(), 0));
55 //                              try {
56 //                                      new Exception("failed: " + ((ExcelFormula)(cell.content.getValue(ExcelFormula.BINDING))).expression, e).printStackTrace();
57 //                              } catch (AdaptException e1) {
58 //                                      e1.printStackTrace();
59 //                              }
60 //                      }
61 //                      
62 //              }
63                 
64         }
65
66         @SuppressWarnings("unchecked")
67         @Override
68         public <T> T getConcrete() {
69                 return (T)this;
70         }
71         
72 }