]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/synchronization/LinesCommandBuilder.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.spreadsheet.graph / src / org / simantics / spreadsheet / graph / synchronization / LinesCommandBuilder.java
index 37a6513f8a270147d72e74a9cf38866d5558454a..be7f25c9e9ef324b83babd23fdfb82e59d43aadb 100644 (file)
@@ -1,72 +1,72 @@
-package org.simantics.spreadsheet.graph.synchronization;\r
-\r
-import org.simantics.spreadsheet.graph.SpreadsheetBook;\r
-import org.simantics.spreadsheet.graph.SpreadsheetLines;\r
-import org.simantics.structural.synchronization.base.CommandBuilder;\r
-import org.simantics.structural.synchronization.base.Solver;\r
-\r
-public class LinesCommandBuilder implements CommandBuilder {\r
-       \r
-       private final boolean update;\r
-    private String name;\r
-       int[] keys;\r
-       \r
-       public LinesCommandBuilder(String name, boolean update) {\r
-               this.name = name;\r
-               this.update = update;\r
-       }\r
-\r
-       @Override\r
-       public void apply(Solver solver) {\r
-//         if (update)\r
-//             return;\r
-               \r
-               SpreadsheetBook book = solver.getConcreteSolver();\r
-               SpreadsheetLines node = book.ensureSubprocess(name);\r
-               node.setKeys(keys);\r
-               \r
-//             String path = name.substring(0, name.lastIndexOf("/"));\r
-//             String lineName = name.substring(name.lastIndexOf("/")+1);\r
-//             int row = Integer.parseInt(lineName.substring(3));\r
-//             \r
-               \r
-//             SpreadsheetLine line = node.lines.get(-row);\r
-//             if(line == null) {\r
-//                     line = new SpreadsheetLine(node, row);\r
-//                     node.lines.put(-row, line);\r
-//             }\r
-//             \r
-//             for(int i=0;i<bean.cells.length;i++) {\r
-//                     \r
-//                     LineContentBeanCell cell = bean.cells[i];\r
-//                     \r
-//                     try {\r
-//                             \r
-//                             if(ExcelFormula.BINDING.type().equals(cell.content.getBinding().type())) {\r
-//                                     ExcelFormula formula = (ExcelFormula)cell.content.getValue(ExcelFormula.BINDING);\r
-//                                     SheetFormulaParser p = new SheetFormulaParser(new StringReader(formula.expression));\r
-//                                     AstValue v = p.relation();\r
-//                                     line.cells.add(new SpreadsheetCell(line, i, new SpreadsheetFormula(v, formula.expression), 0));\r
-//                             } else {\r
-//                                     line.cells.add(new SpreadsheetCell(line, i, cell.content.getValue(), 0));\r
-//                             }\r
-//                     } catch (Throwable e) {\r
-//                             line.cells.add(new SpreadsheetCell(line, i, cell.content.getValue(), 0));\r
-//                             try {\r
-//                                     new Exception("failed: " + ((ExcelFormula)(cell.content.getValue(ExcelFormula.BINDING))).expression, e).printStackTrace();\r
-//                             } catch (AdaptException e1) {\r
-//                                     e1.printStackTrace();\r
-//                             }\r
-//                     }\r
-//                     \r
-//             }\r
-               \r
-       }\r
-\r
-       @SuppressWarnings("unchecked")\r
-       @Override\r
-       public <T> T getConcrete() {\r
-               return (T)this;\r
-       }\r
-       \r
+package org.simantics.spreadsheet.graph.synchronization;
+
+import org.simantics.spreadsheet.graph.SpreadsheetBook;
+import org.simantics.spreadsheet.graph.SpreadsheetLines;
+import org.simantics.structural.synchronization.base.CommandBuilder;
+import org.simantics.structural.synchronization.base.Solver;
+
+public class LinesCommandBuilder implements CommandBuilder {
+       
+       private final boolean update;
+    private String name;
+       int[] keys;
+       
+       public LinesCommandBuilder(String name, boolean update) {
+               this.name = name;
+               this.update = update;
+       }
+
+       @Override
+       public void apply(Solver solver) {
+//         if (update)
+//             return;
+               
+               SpreadsheetBook book = solver.getConcreteSolver();
+               SpreadsheetLines node = book.ensureSubprocess(name);
+               node.setKeys(keys);
+               
+//             String path = name.substring(0, name.lastIndexOf("/"));
+//             String lineName = name.substring(name.lastIndexOf("/")+1);
+//             int row = Integer.parseInt(lineName.substring(3));
+//             
+               
+//             SpreadsheetLine line = node.lines.get(-row);
+//             if(line == null) {
+//                     line = new SpreadsheetLine(node, row);
+//                     node.lines.put(-row, line);
+//             }
+//             
+//             for(int i=0;i<bean.cells.length;i++) {
+//                     
+//                     LineContentBeanCell cell = bean.cells[i];
+//                     
+//                     try {
+//                             
+//                             if(ExcelFormula.BINDING.type().equals(cell.content.getBinding().type())) {
+//                                     ExcelFormula formula = (ExcelFormula)cell.content.getValue(ExcelFormula.BINDING);
+//                                     SheetFormulaParser p = new SheetFormulaParser(new StringReader(formula.expression));
+//                                     AstValue v = p.relation();
+//                                     line.cells.add(new SpreadsheetCell(line, i, new SpreadsheetFormula(v, formula.expression), 0));
+//                             } else {
+//                                     line.cells.add(new SpreadsheetCell(line, i, cell.content.getValue(), 0));
+//                             }
+//                     } catch (Throwable e) {
+//                             line.cells.add(new SpreadsheetCell(line, i, cell.content.getValue(), 0));
+//                             try {
+//                                     new Exception("failed: " + ((ExcelFormula)(cell.content.getValue(ExcelFormula.BINDING))).expression, e).printStackTrace();
+//                             } catch (AdaptException e1) {
+//                                     e1.printStackTrace();
+//                             }
+//                     }
+//                     
+//             }
+               
+       }
+
+       @SuppressWarnings("unchecked")
+       @Override
+       public <T> T getConcrete() {
+               return (T)this;
+       }
+       
 }
\ No newline at end of file