]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Switch to Databoard 0.6.0
authorkalajainen <kalajainen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 7 Dec 2010 12:31:57 +0000 (12:31 +0000)
committerkalajainen <kalajainen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 7 Dec 2010 12:31:57 +0000 (12:31 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@18967 ac1ea38d-2e2b-0410-8846-a27921b304fc

14 files changed:
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/ComponentNameSynchronizer.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/connections/DependencyConnectionFactory.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ExportModelHandler.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ImportModelHandler.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ShowModuleHandler.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/DefaultVariable.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/HistoryRealizationVirtualGraph.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/EnumerationTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ReferenceRow.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/factories/DoublePropertyModifier.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/factories/VariableNamePropertyModifier.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/property/OperationModelLabels.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/property/OperationVariableLabels.java

index dada9f99e7fbc3ea2f8def7115be8ef0d1e04b03..7e08e26d8e9b099338b3db87424892d24ad940cb 100644 (file)
@@ -11,7 +11,7 @@
  *******************************************************************************/\r
 package org.simantics.sysdyn.ui.elements2;\r
 \r
-import org.simantics.databoard.binding.java.StringBindingDefault;\r
+import org.simantics.databoard.Bindings;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.Session;\r
 import org.simantics.db.exception.DatabaseException;\r
@@ -50,7 +50,7 @@ public class ComponentNameSynchronizer extends ResourceSynchronizer {
                        try {\r
                                l0 = Layer0.getInstance(session);\r
                    ModelingResources mr = session.getService(ModelingResources.class);\r
-                   return queue.offer(new RelatedPropertyModification(object, mr.ElementToComponent, l0.HasName, l0.String, newValue, StringBindingDefault.INSTANCE), null);\r
+                   return queue.offer(new RelatedPropertyModification(object, mr.ElementToComponent, l0.HasName, l0.String, newValue, Bindings.STRING), null);\r
                        } catch (DatabaseException e) {\r
                                e.printStackTrace();\r
                        }\r
index 2f7a6713bffdb1cae46c75ea0a6bd52d72a9918b..71eb30f693a20304c13125522f7d3a059cf26ee1 100644 (file)
@@ -15,7 +15,7 @@ import java.util.HashMap;
 import java.util.concurrent.ConcurrentSkipListMap;\r
 import java.util.concurrent.atomic.AtomicInteger;\r
 \r
-import org.simantics.databoard.binding.java.StringBindingDefault;\r
+import org.simantics.databoard.Bindings;\r
 import org.simantics.db.AsyncReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.exception.DatabaseException;\r
@@ -115,7 +115,7 @@ public class DependencyConnectionFactory extends ElementFactoryAdapter {
                                                                                return;\r
                                                                        }\r
                                                                        \r
-                                                                       graph.forPossibleRelatedValue(property, l0.HasName, StringBindingDefault.INSTANCE, new AsyncProcedure<String>() {\r
+                                                                       graph.forPossibleRelatedValue(property, l0.HasName, Bindings.STRING, new AsyncProcedure<String>() {\r
 \r
                                                                                @Override\r
                                                                                public void exception(AsyncReadGraph graph, Throwable throwable) {\r
index 9dbd3d1c74edb39beb79839a73a4c1efd34bef5f..51ec94663d8bd9bc14830d37619227ac725db37d 100644 (file)
@@ -26,10 +26,7 @@ import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.handlers.HandlerUtil;\r
 import org.simantics.databoard.Bindings;\r
 import org.simantics.databoard.Files;\r
-import org.simantics.databoard.binding.error.BindingException;\r
 import org.simantics.databoard.binding.error.RuntimeBindingConstructionException;\r
-import org.simantics.databoard.binding.java.StringBindingDefault;\r
-import org.simantics.databoard.serialization.SerializationException;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.common.primitiverequest.PossibleRelatedValue;\r
@@ -62,7 +59,7 @@ public class ExportModelHandler extends AbstractHandler {
                                        if (!graph.hasStatement(model, Layer0.getInstance(graph).PartOf))\r
                                                return null;\r
                                        Layer0 l0 = Layer0.getInstance(graph);\r
-                                       String name = graph.syncRequest(new PossibleRelatedValue<String>(model, l0.HasName, StringBindingDefault.INSTANCE ));\r
+                                       String name = graph.syncRequest(new PossibleRelatedValue<String>(model, l0.HasName, Bindings.STRING ));\r
                                        return name;\r
                                        \r
                                }\r
@@ -89,7 +86,7 @@ public class ExportModelHandler extends AbstractHandler {
                        @Override\r
                        public void run(ReadGraph graph) throws DatabaseException {\r
                                Layer0 l0 = Layer0.getInstance(graph);\r
-                               String name = graph.syncRequest(new PossibleRelatedValue<String>(model, l0.HasName, StringBindingDefault.INSTANCE ));\r
+                               String name = graph.syncRequest(new PossibleRelatedValue<String>(model, l0.HasName, Bindings.STRING ));\r
                                ArrayList<Pair<Resource, String>> roots = new ArrayList<Pair<Resource, String>>();\r
                                roots.add(Pair.make(model, name));\r
                                TransferableGraph1 tg = graph.syncRequest(new TransferableGraphRequest(roots, model));\r
@@ -100,10 +97,6 @@ public class ExportModelHandler extends AbstractHandler {
                                        e.printStackTrace();\r
                                } catch (IOException e) {\r
                                        e.printStackTrace();\r
-                               } catch (SerializationException e) {\r
-                                       e.printStackTrace();\r
-                               } catch (BindingException e) {\r
-                                       e.printStackTrace();\r
                                }\r
 \r
                                \r
index 4ef70cf2cd6dfa37137a2c0590bf11ac42a09506..12aff6722f84d6179ea328284259c2a8fcd04d27 100644 (file)
@@ -56,8 +56,6 @@ public class ImportModelHandler extends AbstractHandler {
                        e.printStackTrace();\r
                } catch (IOException e) {\r
                        e.printStackTrace();\r
-               } catch (SerializationException e) {\r
-                       e.printStackTrace();\r
                }\r
                if(tg == null) return null;\r
                \r
index 4ecf3b8f490aea20d09e68f2579d59ef99d19859..4da75f8280ac29c9eb06ec2b6e692862cc803902 100644 (file)
@@ -18,7 +18,7 @@ import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.ui.PartInitException;\r
 import org.eclipse.ui.PlatformUI;\r
 import org.eclipse.ui.handlers.HandlerUtil;\r
-import org.simantics.databoard.binding.java.StringBindingDefault;\r
+import org.simantics.databoard.Bindings;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.common.request.ReadRequest;\r
@@ -65,8 +65,8 @@ public class ShowModuleHandler extends AbstractHandler {
 \r
                 DiagramResource dr = DiagramResource.getInstance(graph);\r
                                Resource runtime = viewer.getRuntime();\r
-                               String uri = graph.getPossibleRelatedValue(runtime, dr.HasVariable, StringBindingDefault.INSTANCE);\r
-                               String currentRVI = graph.getPossibleRelatedValue(runtime, dr.HasRVI, StringBindingDefault.INSTANCE);\r
+                               String uri = graph.getPossibleRelatedValue(runtime, dr.HasVariable, Bindings.STRING);\r
+                               String currentRVI = graph.getPossibleRelatedValue(runtime, dr.HasRVI, Bindings.STRING);\r
                                Variable variable = Variables.getVariable(graph, uri);\r
                                Resource model = Variables.getModel(graph, variable);\r
                                final String modelURI = graph.getURI(model);\r
@@ -85,7 +85,7 @@ public class ShowModuleHandler extends AbstractHandler {
                                        \r
                                        if(diagram == null) return;\r
                                        \r
-                                       String finalRvi = currentRVI + "/" + graph.getPossibleRelatedValue(component, l0.HasName, StringBindingDefault.INSTANCE);\r
+                                       String finalRvi = currentRVI + "/" + graph.getPossibleRelatedValue(component, l0.HasName, Bindings.STRING);\r
                                        \r
                                        // This is ugly but it has to be done like this because WorkModel example has too PartOfs\r
                                        Resource rootLibrary = graph.getPossibleObject(model, l0.PartOf);\r
index 54608589c37aca2e93a0577ef9d85d6b252e34e8..ad5bd59b10dfbd39a3d035aea257c0d3dac2d31a 100644 (file)
@@ -14,10 +14,11 @@ package org.simantics.sysdyn.ui.project;
 import java.util.List;\r
 \r
 import org.simantics.databoard.binding.Binding;\r
-import org.simantics.databoard.binding.java.DoubleBindingDefault;\r
-import org.simantics.databoard.binding.java.StringBindingDefault;\r
-import org.simantics.databoard.binding.mutable.MutableDouble;\r
-import org.simantics.databoard.type.DataType;\r
+import org.simantics.databoard.Bindings;\r
+import org.simantics.databoard.Bindings;\r
+import org.simantics.databoard.Datatypes;\r
+import org.simantics.databoard.primitives.MutableDouble;\r
+import org.simantics.databoard.type.Datatype;\r
 import org.simantics.databoard.type.DoubleType;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
@@ -56,7 +57,7 @@ public class DefaultVariable extends ResourceVariable {
 \r
        @Override\r
        public <T> T getValue(ReadGraph graph, Binding binding) throws DatabaseException {\r
-               if(!DoubleBindingDefault.INSTANCE.equals(binding)) return null;\r
+               if(!Bindings.DOUBLE.equals(binding)) return null;\r
                return getValue(graph);\r
        }\r
        \r
@@ -64,7 +65,7 @@ public class DefaultVariable extends ResourceVariable {
        public void setValue(WriteGraph graph, Object object, Binding binding) throws DatabaseException {\r
                Layer0 l0 = Layer0.getInstance(graph);\r
                SysdynResource sr = SysdynResource.getInstance(graph);\r
-//             if(!DoubleBindingDefault.INSTANCE.equals(binding)) return;\r
+//             if(!Bindings.DOUBLE.equals(binding)) return;\r
 //             if(!MutableDoubleBinding.INSTANCE.equals(binding)) return;\r
                Resource represents = graph.getPossibleObject(resource, l0.Represents);\r
                if(represents == null) return;\r
@@ -76,14 +77,14 @@ public class DefaultVariable extends ResourceVariable {
                if(expression == null) return;\r
                if(!graph.isInstanceOf(expression, sr.ParameterExpression)) return;\r
                Double value = new Double(((MutableDouble)object).doubleValue());\r
-               graph.claimLiteral(expression, sr.HasEquation, value.toString(), StringBindingDefault.INSTANCE);\r
+               graph.claimLiteral(expression, sr.HasEquation, value.toString(), Bindings.STRING);\r
        }\r
        \r
        @SuppressWarnings("unchecked")\r
        @Override\r
        public <T> T getInterface(ReadGraph graph, Class<T> clazz)\r
                        throws DatabaseException {\r
-               if(DataType.class.equals(clazz)) return (T)DoubleType.INSTANCE;\r
+               if(Datatype.class.equals(clazz)) return (T)Datatypes.DOUBLE;\r
                return super.getInterface(graph, clazz);\r
        }\r
 }\r
index 6c557969f3eac28d3ac9cc5b773d1d65d63a9db7..7fcc060cece56e7ad021b34e496074c782f186ad 100644 (file)
@@ -14,7 +14,7 @@ package org.simantics.sysdyn.ui.project;
 import java.util.Collection;\r
 import java.util.HashSet;\r
 \r
-import org.simantics.databoard.binding.java.StringBindingDefault;\r
+import org.simantics.databoard.Bindings;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.Session;\r
@@ -69,7 +69,7 @@ public class HistoryRealizationVirtualGraph extends RealizationVirtualGraph {
             public void add(ReadGraph graph, final Resource run) throws DatabaseException {\r
 \r
                final Layer0 l0 = Layer0.getInstance(graph);\r
-                final String experimentName = graph.getPossibleRelatedValue(run, l0.HasName, StringBindingDefault.INSTANCE);\r
+                final String experimentName = graph.getPossibleRelatedValue(run, l0.HasName, Bindings.STRING);\r
 \r
                 RuntimeValuations vs = graph.getService(RuntimeValuations.class);\r
                 if(vs.supports(experimentName)) {\r
@@ -81,7 +81,7 @@ public class HistoryRealizationVirtualGraph extends RealizationVirtualGraph {
                             HashSet<Pair<String, Resource>> result = new HashSet<Pair<String, Resource>>();\r
                             Resource configuration = graph.getPossibleObject(model, SimulationResource.getInstance(graph).HasConfiguration);\r
                             for(Resource part : graph.getObjects(configuration, l0.ConsistsOf)) {\r
-                                String partName = graph.getPossibleRelatedValue(part, l0.HasName, StringBindingDefault.INSTANCE);\r
+                                String partName = graph.getPossibleRelatedValue(part, l0.HasName, Bindings.STRING);\r
                                 result.add(new Pair<String, Resource>(partName, part));\r
                             }\r
                             return result;\r
index 41f43da3f44e31393113d241c3fdc2bc4bf8d81f..191d715be99de66cec11d9110e0fabf1ebb0e6a9 100644 (file)
@@ -21,7 +21,7 @@ import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.PartInitException;\r
 import org.osgi.service.prefs.BackingStoreException;\r
 import org.simantics.databoard.accessor.Accessor;\r
-import org.simantics.databoard.binding.java.StringBindingDefault;\r
+import org.simantics.databoard.Bindings;\r
 import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
@@ -129,7 +129,7 @@ public class SysdynProject extends AbstractProjectFeature {
                 Resource diagram = OrderedSetUtils.create(g, sr.ConfigurationDiagram);\r
                 GraphLayer l = new GraphLayerUtil(g).createLayer(DiagramConstants.DEFAULT_LAYER_NAME, true);\r
                 g.claim(diagram, mu.dr.HasLayer, l.getLayer());\r
-                g.claimLiteral(diagram, l0.HasName, "Diagrammi", StringBindingDefault.INSTANCE);\r
+                g.claimLiteral(diagram, l0.HasName, "Diagrammi", Bindings.STRING);\r
 \r
                 Resource conf = GraphUtils.create2(g,\r
                         sr.Configuration,\r
index ffabdef0090d206519974345363e86cf21b09e33..0e43aba7758fcbc7f866d32dd7ced149b7040a57 100644 (file)
@@ -28,7 +28,7 @@ import org.simantics.browsing.ui.swt.widgets.TrackedText;
 import org.simantics.browsing.ui.swt.widgets.impl.ReadFactoryImpl;\r
 import org.simantics.browsing.ui.swt.widgets.impl.Widget;\r
 import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
-import org.simantics.databoard.binding.java.StringBindingDefault;\r
+import org.simantics.databoard.Bindings;\r
 import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
@@ -79,7 +79,7 @@ public class EnumerationTab extends PropertyTabContributorImpl {
                                List<Pair<String, Object>> result = new ArrayList<Pair<String, Object>>();\r
                                for(Resource r : resourceList) {\r
                                        result.add(new Pair<String, Object>( \r
-                                                       (String)graph.getRelatedValue(r, Layer0.getInstance(graph).HasName, StringBindingDefault.INSTANCE)\r
+                                                       (String)graph.getRelatedValue(r, Layer0.getInstance(graph).HasName, Bindings.STRING)\r
                                                        , r));\r
                                }\r
                                return result;\r
index 70d37cc5de6a24f9e3fc60f3f45c8a6774059fd8..d3ad27189b538d0911c0de9d316fedc6439b0c47 100644 (file)
@@ -11,7 +11,7 @@
  *******************************************************************************/\r
 package org.simantics.sysdyn.ui.properties.widgets;\r
 \r
-import org.simantics.databoard.binding.java.StringBindingDefault;\r
+import org.simantics.databoard.Bindings;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
@@ -78,7 +78,7 @@ public class ReferenceRow {
                         valueResource = graph.getPossibleObject(dependency, sr.HasHead);\r
                     if(!graph.isInstanceOf(valueResource, sr.Variable))\r
                         return "";\r
-                    return (String)graph.getRelatedValue(valueResource, l0.HasName, StringBindingDefault.INSTANCE);\r
+                    return (String)graph.getRelatedValue(valueResource, l0.HasName, Bindings.STRING);\r
                 }\r
             });\r
         } catch (DatabaseException e) {\r
index 34459fef380a5d31057a52ee0a84653736b8b28e..58dc654e3dd235747739e20e0ce85f2b63702e82 100644 (file)
@@ -12,7 +12,7 @@
 package org.simantics.sysdyn.ui.properties.widgets.factories;\r
 \r
 import org.simantics.browsing.ui.swt.widgets.impl.TextModifyListenerImpl;\r
-import org.simantics.databoard.binding.java.DoubleBindingDefault;\r
+import org.simantics.databoard.Bindings;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
 import org.simantics.db.exception.DatabaseException;\r
@@ -32,7 +32,7 @@ public class DoublePropertyModifier extends TextModifyListenerImpl<Resource> {
                if(graph.hasStatement(input, graph.getResource(propertyURI)))\r
                        graph.deny(input, graph.getResource(propertyURI));\r
        } else {\r
-               graph.claimLiteral(input, graph.getResource(propertyURI), Double.parseDouble(text), DoubleBindingDefault.INSTANCE);\r
+               graph.claimLiteral(input, graph.getResource(propertyURI), Double.parseDouble(text), Bindings.DOUBLE);\r
        }\r
     }\r
 \r
index 4025beb84694601b3b62f142b62331b34b260942..c6320dfde55eeb0f7896fece3baeef72d3517b6e 100644 (file)
@@ -12,7 +12,7 @@
 package org.simantics.sysdyn.ui.properties.widgets.factories;\r
 \r
 import org.simantics.browsing.ui.swt.widgets.impl.TextModifyListenerImpl;\r
-import org.simantics.databoard.binding.java.StringBindingDefault;\r
+import org.simantics.databoard.Bindings;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
 import org.simantics.db.exception.DatabaseException;\r
@@ -39,6 +39,6 @@ public class VariableNamePropertyModifier extends TextModifyListenerImpl<Resourc
                // TODO: add enumerations to the variable\r
                String originalName = graph.getRelatedValue(variable, Layer0.getInstance(graph).HasName);\r
                VariableNameUtils.renameInEquations(graph, variable, originalName, text);\r
-               graph.claimLiteral(variable, graph.getResource(propertyURI), text, StringBindingDefault.INSTANCE);\r
+               graph.claimLiteral(variable, graph.getResource(propertyURI), text, Bindings.STRING);\r
        }\r
 }\r
index caa0de80a5616df1eba3d6ed7faf7025467a4d13..04667c43a1a875699a9886f7978655ff503dddab 100644 (file)
@@ -15,7 +15,7 @@ import java.util.Map;
 \r
 import org.simantics.browsing.ui.common.ColumnKeys;\r
 import org.simantics.browsing.ui.graph.contributor.labeler.ColumnLabelerContributor;\r
-import org.simantics.databoard.binding.java.StringBindingDefault;\r
+import org.simantics.databoard.Bindings;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.utils.datastructures.ArrayMap;\r
@@ -25,7 +25,7 @@ public class OperationModelLabels extends ColumnLabelerContributor<OperationMode
     @Override\r
     public Map<String, String> getLabel(ReadGraph graph, OperationModelNode model) throws DatabaseException {\r
 \r
-        String label = model.data.getPropertyValue(graph, "Name", StringBindingDefault.INSTANCE);\r
+        String label = model.data.getPropertyValue(graph, "Name", Bindings.STRING);\r
 \r
         return new ArrayMap<String, String>(new String[] { ColumnKeys.SINGLE } , new String[] { label });\r
 \r
index 7a2210dc764c2afb7b0f626357a8dec5a67eec12..bdcd46d9ebf1a68ca2ee8a91780e4c2b1acd6f60 100644 (file)
@@ -15,7 +15,7 @@ import java.util.Map;
 \r
 import org.simantics.browsing.ui.common.ColumnKeys;\r
 import org.simantics.browsing.ui.graph.contributor.labeler.ColumnLabelerContributor;\r
-import org.simantics.databoard.binding.java.StringBindingDefault;\r
+import org.simantics.databoard.Bindings;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.layer0.variable.Variable;\r
@@ -26,7 +26,7 @@ public class OperationVariableLabels extends ColumnLabelerContributor<Variable>
     @Override\r
     public Map<String, String> getLabel(ReadGraph graph, Variable variable) throws DatabaseException {\r
 \r
-        String label = variable.getPropertyValue(graph, "Name", StringBindingDefault.INSTANCE);\r
+        String label = variable.getPropertyValue(graph, "Name", Bindings.STRING);\r
 \r
         return new ArrayMap<String, String>(new String[] { ColumnKeys.SINGLE } , new String[] { label });\r
 \r