1 package org.simantics.document.server.state;
3 import java.util.Collections;
6 import org.simantics.databoard.Bindings;
7 import org.simantics.databoard.binding.Binding;
8 import org.simantics.simulator.toolkit.StandardNodeManagerSupport;
9 import org.simantics.simulator.variable.exceptions.NoValueException;
10 import org.simantics.simulator.variable.exceptions.NodeManagerException;
12 public class StateNodeManagerSupport implements StandardNodeManagerSupport<StateNode> {
15 public Object getEngineValue(StateNode node) throws NodeManagerException {
16 if (node instanceof StatePropertyNode) {
17 return ((StatePropertyNode) node).getValue();
19 else throw new NoValueException();
23 public Binding getEngineBinding(StateNode node) throws NodeManagerException {
24 if (node instanceof StatePropertyNode) {
25 return Bindings.OBJECT;
27 else throw new NoValueException();
31 public void setEngineValue(StateNode node, Object value) throws NodeManagerException {
32 if (node instanceof StatePropertyNode) {
33 ((StatePropertyNode) node).setValue(value);
35 else throw new NodeManagerException();
39 public String getName(StateNode node) {
40 if (node instanceof StatePropertyNode) {
41 return ((StatePropertyNode) node).getName();
46 public Map<String, StateNode> getChildren(StateNode node) {
47 return Collections.emptyMap();
51 public Map<String, StateNode> getProperties(StateNode node) {
52 if (node instanceof StateRootNode) {
53 return ((StateRootNode) node).getProperties();
54 } else return Collections.emptyMap();