]> gerrit.simantics Code Review - simantics/platform.git/blob
56985d16c948c6754551484294381184e2eb1b62
[simantics/platform.git] /
1 package org.simantics.spreadsheet.graph;
2
3 import java.util.Collections;
4 import java.util.Set;
5
6 import org.simantics.layer0.Layer0;
7 import org.simantics.simulator.toolkit.StandardNodeManager;
8 import org.simantics.simulator.variable.exceptions.NodeManagerException;
9 import org.simantics.spreadsheet.resource.SpreadsheetResource;
10 import org.simantics.structural.stubs.StructuralResource2;
11
12 @SuppressWarnings("rawtypes")
13 public class SpreadsheetNodeManager extends StandardNodeManager<SheetNode, SpreadsheetBook> {
14
15     public SpreadsheetNodeManager(SpreadsheetRealm realm) {
16         super(realm, realm.getEngine());
17     }
18
19     static final Set<String> COMPONENT_CLASS = Collections.singleton(StructuralResource2.URIs.Component);
20
21     @Override
22     public Set<String> getClassifications(SheetNode node) throws NodeManagerException {
23         checkThreadAccess();
24         if(isRoot(node))
25             return COMPONENT_CLASS;
26         else
27             return Collections.emptySet();
28     }
29
30     @Override
31     public String getPropertyURI(SheetNode parent, SheetNode property) {
32         if(property instanceof SpreadsheetCellContent) {
33             return SpreadsheetResource.URIs.Cell_content;
34         } else if(property instanceof SpreadsheetTypeNode) {
35             return Layer0.URIs.typeURI;
36         } else if(property instanceof SpreadsheetCellContentExpression) {
37             return Layer0.URIs.SCLValue_expression;
38         } else if (property instanceof SpreadsheetCellStyle) {
39             return SpreadsheetResource.URIs.Cell_style;
40         } else if (property instanceof SpreadsheetCellEditable){
41             return SpreadsheetResource.URIs.Cell_editable;
42         } else {
43             return null;
44         }
45     }
46
47 }