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