]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/SpreadsheetMapping.java
Refactoring of simulator toolkit
[simantics/platform.git] / bundles / org.simantics.spreadsheet.graph / src / org / simantics / spreadsheet / graph / SpreadsheetMapping.java
1 package org.simantics.spreadsheet.graph;
2
3 import java.io.Serializable;
4
5 import org.simantics.spreadsheet.graph.synchronization.SheetLineComponent;
6 import org.simantics.structural.synchronization.utils.ComponentFactory;
7 import org.simantics.structural.synchronization.utils.MappingBase;
8 import org.simantics.structural.synchronization.utils.Solver;
9 import org.simantics.structural.synchronization.utils.StateUndoContextBase;
10
11 public class SpreadsheetMapping extends MappingBase<SheetLineComponent> implements Serializable {
12         
13     private static final long serialVersionUID = -7556699663877911393L;
14     
15     final SheetLineComponent configuration;
16         
17         public SpreadsheetMapping(SheetLineComponent configuration) {
18             super(configuration, true);
19                 this.configuration = configuration;
20         }
21
22         @Override
23         public SheetLineComponent getConfiguration() {
24                 return configuration;
25         }
26
27         @Override
28         public StateUndoContextBase createUndoContext() {
29                 return new StateUndoContextBase() {
30                         
31                         @Override
32                         public void saveState(Solver solver, int componentId, String uid) {
33                         }
34                         
35                         @Override
36                         public boolean loadState(Solver solver, int componentId, String uid) {
37                                 return false;
38                         }
39                 };
40         }
41
42         @Override
43         public ComponentFactory<SheetLineComponent> createComponentFactory() {
44                 return new ComponentFactory<SheetLineComponent>() {
45
46                         @Override
47                         public SheetLineComponent create(String uid) {
48                                 return new SheetLineComponent(uid);
49                         }
50                         
51                 };
52         }
53
54 }