]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Step property controls to game experiment tab (refs #3398)
authorlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Fri, 27 Apr 2012 09:00:22 +0000 (09:00 +0000)
committerlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Fri, 27 Apr 2012 09:00:22 +0000 (09:00 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@24831 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.ontology/graph.tg
org.simantics.sysdyn.ontology/graph/Sysdyn.pgraph
org.simantics.sysdyn.ontology/src/org/simantics/sysdyn/SysdynResource.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/newComponents/NewGameExperimentNodeHanlder.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/menu/GameStepDurationContribution.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/GameExperimentTab.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ResourceSelectionProcessor.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/DependencyFunction.java
org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynGameExperiment.java
org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Entity.java

index 4e7c067d7408bf97e58a236c153b720323e000d8..a9b8ca8a1e172c0616942215dbbb67db4204a4e7 100644 (file)
Binary files a/org.simantics.sysdyn.ontology/graph.tg and b/org.simantics.sysdyn.ontology/graph.tg differ
index 1fdfb7e1260d9fd1ec9a0d182f5f6a3e132595f3..54086f8a7641f8498cf7cb66c3e5140c363c535c 100644 (file)
@@ -269,6 +269,7 @@ SYSDYN.BasicExperiment <T SYSDYN.Experiment
 
 SYSDYN.GameExperiment <T SYSDYN.Experiment
     >-- SYSDYN.GameExperiment.stepDuration --> L0.Double <R L0.HasProperty : L0.FunctionalRelation
+    >-- SYSDYN.GameExperiment.stepLength --> L0.Double <R L0.HasProperty : L0.FunctionalRelation    
     @L0.assert SYSDYN.GameExperiment.stepDuration 1.0
 
 SYSDYN.SimulateOnChangeExperiment <T SYSDYN.Experiment
index f89c4fce121ed4120d74d6f266a883c01ca40665..d4ebd8ce13ec4404c754ddc316708117e0854f4b 100644 (file)
@@ -123,6 +123,8 @@ public class SysdynResource {
     public final Resource GameExperiment;\r
     public final Resource GameExperiment_stepDuration;\r
     public final Resource GameExperiment_stepDuration_Inverse;\r
+    public final Resource GameExperiment_stepLength;\r
+    public final Resource GameExperiment_stepLength_Inverse;\r
     public final Resource HasEquationOrEmpty;\r
     public final Resource HasEquationOrEmpty_Inverse;\r
     public final Resource HasHead;\r
@@ -471,6 +473,8 @@ public class SysdynResource {
         public static final String GameExperiment = "http://www.simantics.org/Sysdyn-1.1/GameExperiment";\r
         public static final String GameExperiment_stepDuration = "http://www.simantics.org/Sysdyn-1.1/GameExperiment/stepDuration";\r
         public static final String GameExperiment_stepDuration_Inverse = "http://www.simantics.org/Sysdyn-1.1/GameExperiment/stepDuration/Inverse";\r
+        public static final String GameExperiment_stepLength = "http://www.simantics.org/Sysdyn-1.1/GameExperiment/stepLength";\r
+        public static final String GameExperiment_stepLength_Inverse = "http://www.simantics.org/Sysdyn-1.1/GameExperiment/stepLength/Inverse";\r
         public static final String HasEquationOrEmpty = "http://www.simantics.org/Sysdyn-1.1/HasEquationOrEmpty";\r
         public static final String HasEquationOrEmpty_Inverse = "http://www.simantics.org/Sysdyn-1.1/HasEquationOrEmpty/Inverse";\r
         public static final String HasHead = "http://www.simantics.org/Sysdyn-1.1/HasHead";\r
@@ -829,6 +833,8 @@ public class SysdynResource {
         GameExperiment = getResourceOrNull(graph, URIs.GameExperiment);\r
         GameExperiment_stepDuration = getResourceOrNull(graph, URIs.GameExperiment_stepDuration);\r
         GameExperiment_stepDuration_Inverse = getResourceOrNull(graph, URIs.GameExperiment_stepDuration_Inverse);\r
+        GameExperiment_stepLength = getResourceOrNull(graph, URIs.GameExperiment_stepLength);\r
+        GameExperiment_stepLength_Inverse = getResourceOrNull(graph, URIs.GameExperiment_stepLength_Inverse);\r
         HasEquationOrEmpty = getResourceOrNull(graph, URIs.HasEquationOrEmpty);\r
         HasEquationOrEmpty_Inverse = getResourceOrNull(graph, URIs.HasEquationOrEmpty_Inverse);\r
         HasHead = getResourceOrNull(graph, URIs.HasHead);\r
index 7fc04c94bd8d960741bb6ff0f30b71dd0fa73e73..fb83a750304b4f6b908b83fee47406bba211c40f 100644 (file)
@@ -13,7 +13,10 @@ package org.simantics.sysdyn.ui.handlers.newComponents;
 \r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.sysdyn.manager.SysdynGameExperiment;\r
 \r
 /**\r
  * Handler for creating a new Game Experiment\r
@@ -25,6 +28,15 @@ public class NewGameExperimentNodeHanlder extends NewExperimentNodeHandler  {
     protected Resource getExperimentType(ReadGraph g) {\r
         return SysdynResource.getInstance(g).GameExperiment;\r
     }\r
+    \r
+    /**\r
+     * Override to do experiment-specific alterations\r
+     */\r
+    protected void configureExperiment(WriteGraph graph, Resource experiment) throws DatabaseException {\r
+       SysdynResource sr = SysdynResource.getInstance(graph);\r
+        graph.claimLiteral(experiment, sr.GameExperiment_stepDuration, SysdynGameExperiment.DEFAULT_STEP_DURATION);\r
+        graph.claimLiteral(experiment, sr.GameExperiment_stepLength, SysdynGameExperiment.DEFAULT_STEP_LENGTH);\r
+    }\r
 \r
     protected String getNameSuggestion() {\r
         return "Game Experiment";\r
index 978f3f88e749f4beac016253a23410f2efb8d0ce..4281055f17f59c4341a97a5b2595533857803b59 100644 (file)
@@ -20,19 +20,16 @@ import org.eclipse.swt.widgets.ToolBar;
 import org.eclipse.swt.widgets.ToolItem;\r
 import org.eclipse.ui.actions.CompoundContributionItem;\r
 import org.simantics.browsing.ui.swt.widgets.TrackedText;\r
-import org.simantics.browsing.ui.swt.widgets.impl.TextModifyListener;\r
-import org.simantics.browsing.ui.swt.widgets.impl.TrackedModifyEvent;\r
-import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
 import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupportImpl;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.common.request.WriteRequest;\r
-import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.management.ISessionContext;\r
 import org.simantics.project.IProject;\r
 import org.simantics.simulation.experiment.IExperiment;\r
 import org.simantics.simulation.project.IExperimentManager;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.sysdyn.manager.SysdynGameExperiment;\r
 import org.simantics.sysdyn.ui.properties.SysdynBasicColorProvider;\r
+import org.simantics.sysdyn.ui.properties.widgets.factories.DoublePropertyFactory;\r
+import org.simantics.sysdyn.ui.properties.widgets.factories.DoublePropertyModifier;\r
 import org.simantics.ui.SimanticsUI;\r
 import org.simantics.utils.ui.validators.DoubleValidator;\r
 \r
@@ -48,7 +45,7 @@ import org.simantics.utils.ui.validators.DoubleValidator;
  */\r
 public class GameStepDurationContribution extends CompoundContributionItem {\r
 \r
-       private TrackedText                             stepLength;\r
+       private TrackedText                             stepDuration;\r
        private int                     width           = 40;\r
     private ToolItem                           ti;\r
     \r
@@ -79,42 +76,25 @@ public class GameStepDurationContribution extends CompoundContributionItem {
         final SysdynGameExperiment game = (SysdynGameExperiment) active;\r
         \r
         // Create the text\r
-        WidgetSupport support = new WidgetSupportImpl(); // Dummy widget support for using tracked text\r
         \r
         ti = new ToolItem(parent, SWT.SEPARATOR, index);\r
         ti.setText("Step Duration");\r
         ti.setToolTipText("Step Duration");\r
         \r
-        stepLength = new TrackedText(parent, support, SWT.BORDER);\r
-        stepLength.getWidget().setText("" + game.getStepDuration());\r
-        \r
-        ResourceManager resourceManager = new LocalResourceManager(JFaceResources.getResources(), stepLength.getWidget());\r
-        stepLength.setColorProvider(new SysdynBasicColorProvider(resourceManager));\r
-        \r
-        stepLength.setInputValidator(new DoubleValidator());\r
+        ISessionContext context = SimanticsUI.getSessionContext();\r
+        WidgetSupportImpl support = new WidgetSupportImpl(); // Dummy widget support for using tracked text\r
+\r
+        stepDuration = new TrackedText(parent, support, SWT.BORDER);\r
+        ResourceManager resourceManager = new LocalResourceManager(JFaceResources.getResources(), stepDuration.getWidget());\r
+        stepDuration.setColorProvider(new SysdynBasicColorProvider(resourceManager));\r
+        stepDuration.setInputValidator(new DoubleValidator());\r
+        stepDuration.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.GameExperiment_stepDuration));\r
+        stepDuration.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.GameExperiment_stepDuration));\r
         \r
-        stepLength.addModifyListener(new TextModifyListener() {\r
-                       \r
-                       @Override\r
-                       public void modifyText(TrackedModifyEvent e) {\r
-                               final Double value = Double.parseDouble(stepLength.getText());\r
-                               game.setStepDuration(value);\r
-                               \r
-                               SimanticsUI.getSession().asyncRequest(new WriteRequest() {\r
-                                       \r
-                                       @Override\r
-                                       public void perform(WriteGraph graph) throws DatabaseException {\r
-                                               graph.claimLiteral(\r
-                                                               game.getResource(), \r
-                                                               SysdynResource.getInstance(graph).GameExperiment_stepDuration, \r
-                                                               value);\r
-                                       }\r
-                               });\r
-                       }\r
-               });\r
+        support.fireInput(context, game.getResource());\r
         \r
         ti.setWidth(width);\r
-        ti.setControl(stepLength.getWidget());\r
+        ti.setControl(stepDuration.getWidget());\r
 \r
     }\r
 \r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/GameExperimentTab.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/GameExperimentTab.java
new file mode 100644 (file)
index 0000000..d451715
--- /dev/null
@@ -0,0 +1,82 @@
+package org.simantics.sysdyn.ui.properties;\r
+\r
+import org.eclipse.jface.layout.GridDataFactory;\r
+import org.eclipse.jface.layout.GridLayoutFactory;\r
+import org.eclipse.jface.resource.JFaceResources;\r
+import org.eclipse.jface.resource.LocalResourceManager;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.custom.ScrolledComposite;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Label;\r
+import org.eclipse.ui.IWorkbenchSite;\r
+import org.simantics.browsing.ui.swt.widgets.StringPropertyFactory;\r
+import org.simantics.browsing.ui.swt.widgets.StringPropertyModifier;\r
+import org.simantics.browsing.ui.swt.widgets.TrackedText;\r
+import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
+import org.simantics.db.management.ISessionContext;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.sysdyn.ui.properties.widgets.factories.DoublePropertyFactory;\r
+import org.simantics.sysdyn.ui.properties.widgets.factories.DoublePropertyModifier;\r
+import org.simantics.utils.ui.validators.DoubleValidator;\r
+\r
+/**\r
+ * Tab for displaying game experiment properties\r
+ * \r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class GameExperimentTab extends LabelPropertyTabContributor {\r
+\r
+       @Override\r
+       public void createControls(Composite body, IWorkbenchSite site,\r
+               ISessionContext context, WidgetSupport support) {\r
+               \r
+        ScrolledComposite sc = new ScrolledComposite(body,  SWT.H_SCROLL | SWT.V_SCROLL);\r
+        GridDataFactory.fillDefaults().grab(true, true).applyTo(sc);\r
+        GridLayoutFactory.fillDefaults().applyTo(sc);\r
+        \r
+        Composite composite = new Composite(sc, SWT.NONE);\r
+        GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
+        GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(composite);\r
+        \r
+        // Label\r
+        Label label = new Label(composite, SWT.NONE);\r
+        label.setText("Name");\r
+        \r
+        TrackedText name = new TrackedText(composite, support, SWT.BORDER);\r
+        name.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasLabel));\r
+        name.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasLabel));\r
+        name.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasName));\r
+        name.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), name.getWidget())));\r
+\r
+        // Step duration (i.e. how many time units is one step in user's perspective)\r
+        label = new Label(composite, SWT.NONE);\r
+        label.setText("Step duration");\r
+        \r
+        TrackedText stepDuration = new TrackedText(composite, support, SWT.BORDER);\r
+        stepDuration.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.GameExperiment_stepDuration));\r
+        stepDuration.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.GameExperiment_stepDuration));\r
+        stepDuration.setInputValidator(new DoubleValidator());\r
+        stepDuration.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), stepDuration.getWidget())));\r
+        GridDataFactory.fillDefaults().hint(300, SWT.DEFAULT).applyTo(name.getWidget());\r
+\r
+        // Integrator step length (i.e. how long is a integration step in the simulator. This time is stepped until stepDuration is full)\r
+        label = new Label(composite, SWT.NONE);\r
+        label.setText("Integrator step length");\r
+        \r
+        TrackedText integratorStep = new TrackedText(composite, support, SWT.BORDER);\r
+        integratorStep.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.GameExperiment_stepLength));\r
+        integratorStep.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.GameExperiment_stepLength));\r
+        integratorStep.setInputValidator(new DoubleValidator());\r
+        integratorStep.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), integratorStep.getWidget())));\r
+        \r
+        // Scrolled composite settings\r
+        sc.setContent(composite);\r
+        sc.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));\r
+        sc.setExpandHorizontal(true);\r
+        sc.setExpandVertical(true);\r
+               \r
+       }\r
+\r
+}\r
index 1c28fa0172f992247fa8df1ea830b3922aae1b76..e17e65db969dfebdd8e3c76f0e4281675d44fb82 100644 (file)
@@ -285,7 +285,16 @@ public class ResourceSelectionProcessor implements SelectionProcessor<Object, Re
                                                                                0,\r
                                                                                r,\r
                                                                                "Experiment Properties"));\r
-\r
+                                       \r
+                                       // Game experiment\r
+                                       if (backend.isInstanceOf(r, sr.GameExperiment))\r
+                                               return Collections.singleton(\r
+                                                               new ComparableTabContributor(\r
+                                                                               new GameExperimentTab(),\r
+                                                                               0,\r
+                                                                               r,\r
+                                                                               "Experiment Properties"));\r
+                                       \r
                                        // Default experiment\r
                                        if (backend.isInstanceOf(r, simu.Experiment))\r
                                                return Collections.singleton(\r
index ed094c182959b334e64bddb14581f7651c23e10b..cce101fe435a31d0b46ed7dffc13a1da3b65c90d 100644 (file)
@@ -28,6 +28,7 @@ import org.simantics.issues.common.StandardIssue;
 import org.simantics.layer0.Layer0;\r
 import org.simantics.scl.reflection.annotations.SCLValue;\r
 import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.utils.datastructures.collections.CollectionUtils;\r
 \r
 /**\r
  * Evaluates issues related to Dependencies (arrows)\r
@@ -36,6 +37,9 @@ import org.simantics.sysdyn.SysdynResource;
  * \r
  */\r
 public class DependencyFunction {\r
+       \r
+       // Set containing the names of variables that can be used everywhere, like "time"\r
+       private static Set<String> GLOBAL_VARIABLES = CollectionUtils.toSet("time");\r
 \r
     /**\r
      * Evaluates dependency-related issues for a component.\r
@@ -124,7 +128,7 @@ public class DependencyFunction {
         // Check that all references have corresponding arrows\r
         if (references != null && dependencies != null) {\r
             for (String reference : references) {\r
-                if (!dependencies.contains(reference)) {\r
+                if (!dependencies.contains(reference) && !GLOBAL_VARIABLES.contains(reference)) {\r
                     Resource variable = null;\r
                     if ((variable = ValidationUtils.reach(graph, component, reference)) != null) {\r
                         if(isStock) {\r
@@ -241,7 +245,7 @@ public class DependencyFunction {
         if (references != null && dependencies != null) {\r
             for (String reference : references) {\r
                 // If dependencies does not contain reference and the reference\r
-// is not reachable from component, add the name\r
+               // is not reachable from component, add the name\r
                 if (!dependencies.contains(reference) && ValidationUtils.reach(graph, component, reference) == null) {\r
                     result.add(reference);\r
                 }\r
index 6721ad51f48ceb054a8dfb7ce6f1ce7dd1d6ee42..673bf856793a0fee898accf09e3b78bfade5b498 100644 (file)
@@ -16,16 +16,21 @@ import java.util.ArrayList;
 import java.util.HashMap;\r
 \r
 import org.eclipse.core.runtime.IProgressMonitor;\r
+import org.simantics.db.AsyncReadGraph;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.procedure.AsyncListener;\r
+import org.simantics.db.request.Read;\r
 import org.simantics.modelica.IModelicaMonitor;\r
 import org.simantics.modelica.SimulationLocation;\r
 import org.simantics.modelica.data.DataSet;\r
 import org.simantics.modelica.data.SimulationResult;\r
 import org.simantics.modelica.fmi.FMUControlJNI;\r
 import org.simantics.modelica.fmi.FMUJNIException;\r
+import org.simantics.simulation.experiment.ExperimentState;\r
 import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.utils.datastructures.Pair;\r
 \r
 /**\r
  * Game experiment\r
@@ -37,8 +42,11 @@ public class SysdynGameExperiment extends SysdynExperiment {
        private FMUControlJNI control;\r
        private String[] subscription;\r
        private HashMap<String, ArrayList<Double>> results;\r
-       private double stepLength = 0.1;\r
-       private double stepDuration = 1.0;\r
+       private double stepLength = DEFAULT_STEP_LENGTH;\r
+       private double stepDuration = DEFAULT_STEP_DURATION;\r
+       \r
+       public static double DEFAULT_STEP_DURATION = 1.0;\r
+       public static double DEFAULT_STEP_LENGTH        = 0.1;\r
        \r
        public SysdynGameExperiment(Resource experiment, Resource model) {\r
                super(experiment, model);\r
@@ -58,12 +66,6 @@ public class SysdynGameExperiment extends SysdynExperiment {
        \r
        public void setStepLength(double stepLength) {\r
                this.stepLength = stepLength;\r
-               if(control != null) {\r
-                       try {\r
-                               control.setStepLength(this.stepLength);\r
-                       } catch (FMUJNIException e) {\r
-                       }\r
-               }\r
        }\r
 \r
        @Override\r
@@ -75,11 +77,37 @@ public class SysdynGameExperiment extends SysdynExperiment {
                \r
                results = new HashMap<String, ArrayList<Double>>();\r
                \r
-               try {\r
-                       stepDuration = g.getPossibleRelatedValue(experiment, SysdynResource.getInstance(g).GameExperiment_stepDuration);\r
-               } catch (DatabaseException e) {\r
-                       stepDuration = 1.0;\r
-               }\r
+               g.asyncRequest(new Read<Pair<Double, Double>>() {\r
+\r
+                       @Override\r
+                       public Pair<Double, Double> perform(ReadGraph graph)\r
+                                       throws DatabaseException {\r
+                               SysdynResource sr = SysdynResource.getInstance(graph);\r
+                               Double stepDuration = graph.getPossibleRelatedValue(experiment, sr.GameExperiment_stepDuration);\r
+                               Double stepLength =graph.getPossibleRelatedValue(experiment, sr.GameExperiment_stepLength);\r
+                               return new Pair<Double, Double>(stepDuration, stepLength);\r
+                       }\r
+               }, new AsyncListener<Pair<Double, Double>>() {\r
+\r
+                       @Override\r
+                       public void execute(AsyncReadGraph graph,\r
+                                       Pair<Double, Double> result) {\r
+                               setStepDuration(result.first != null ? result.first : DEFAULT_STEP_DURATION);\r
+                               setStepLength(result.second != null ? result.second : DEFAULT_STEP_LENGTH);\r
+                       }\r
+\r
+                       @Override\r
+                       public void exception(AsyncReadGraph graph, Throwable throwable) {\r
+                               throwable.printStackTrace();\r
+                               setStepDuration(DEFAULT_STEP_DURATION);\r
+                               setStepLength(DEFAULT_STEP_LENGTH);\r
+                       }\r
+\r
+                       @Override\r
+                       public boolean isDisposed() {\r
+                               return getState().equals(ExperimentState.DISPOSED);\r
+                       }\r
+               });\r
        }\r
 \r
        @Override\r
@@ -159,7 +187,10 @@ public class SysdynGameExperiment extends SysdynExperiment {
                if(duration <= 0.0)\r
                        duration = stepDuration;\r
                \r
+               \r
                try {\r
+                       control.setStepLength(stepLength); // Set step length each time in case there has been changes\r
+\r
                        double time = control.getTime();\r
                        double eTime = time + duration;\r
                        double[] results = new double[subscription.length];\r
index 433848f6b2ff7c98c7f339b5f7fd6bac7a7ee1a9..ec61ed05b5cbdad7e16f574eb2cd482c673ba1c0 100644 (file)
@@ -13,6 +13,7 @@ package org.simantics.sysdyn.representation;
 \r
 import org.simantics.layer0.Layer0;\r
 import org.simantics.objmap.annotations.GraphType;\r
+import org.simantics.sysdyn.representation.visitors.IElementVisitorVoid;\r
 \r
 /**\r
  * Dummy class representing any entity.\r
@@ -20,6 +21,10 @@ import org.simantics.objmap.annotations.GraphType;
  *\r
  */\r
 @GraphType(Layer0.URIs.Entity)\r
-public class Entity {\r
+public class Entity implements IElement {\r
+\r
+       @Override\r
+       public void accept(IElementVisitorVoid v) {\r
+       }\r
 \r
 }\r