+++ /dev/null
-package org.simantics.sysdyn.ui.properties;\r
-\r
-public class VariableCommentTab {\r
-\r
-}\r
import org.eclipse.swt.widgets.Text;\r
import org.simantics.browsing.ui.swt.widgets.StringPropertyFactory;\r
import org.simantics.browsing.ui.swt.widgets.impl.ReadFactory;\r
+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.db.Resource;\r
@SuppressWarnings("unchecked")\r
public void save() {\r
if(originalText.equals(textWidget.getText())) return;\r
- \r
- final String text = textWidget.getText();\r
- \r
+\r
+ final String text = textWidget.getText().trim();\r
+\r
SimanticsUI.getSession().asyncRequest(new WriteRequest() {\r
- \r
+\r
@Override\r
public void perform(WriteGraph graph) throws DatabaseException {\r
- \r
+\r
Triple triple = null;\r
Object object = null;\r
+ triple = (Triple) ((ReadFactoryImpl)readFactory).getIdentity(null);\r
+ if(triple == null) return;\r
\r
- if(readFactory instanceof DoublePropertyFactory) {\r
- DoublePropertyFactory factory = (DoublePropertyFactory)readFactory;\r
- triple = (Triple) factory.getIdentity(null);\r
- object = Double.parseDouble(text);\r
- } else if (readFactory instanceof StringPropertyFactory) {\r
- StringPropertyFactory factory = (StringPropertyFactory)readFactory;\r
- triple = (Triple) factory.getIdentity(null);\r
- object = text;\r
+ if(!text.equals("")) {\r
+ if(readFactory instanceof DoublePropertyFactory) {\r
+ object = Double.parseDouble(text);\r
+ } else if (readFactory instanceof StringPropertyFactory) {\r
+ object = text;\r
+ }\r
+ graph.claimValue(resource, graph.getResource((String)triple.second), object);\r
+ } else {\r
+ Resource relation = graph.getResource((String)triple.second);\r
+ if (graph.hasStatement(resource, relation))\r
+ graph.deny(resource, relation);\r
}\r
- \r
- if(triple == null || object == null) return;\r
- graph.claimValue(resource, graph.getResource((String)triple.second), object);\r
}\r
});\r
- \r
+\r
}\r
\r
public void addKeyListener(KeyListener listener) {\r
public void addVerifyListener(VerifyListener listener) {\r
this.textWidget.addVerifyListener(listener);\r
}\r
- \r
+\r
public void addFocusListener(FocusListener listener) {\r
this.textWidget.addFocusListener(listener);\r
}\r
public String perform(ReadGraph graph, Resource issue) throws DatabaseException {\r
\r
Double value = graph.getPossibleRelatedValue(issue, graph.getResource(propertyURI));\r
- return value.toString();\r
- \r
+ if (value != null)\r
+ return value.toString();\r
+ else\r
+ return "";\r
}\r
\r
}\r
public final Resource HasMinX;\r
public final Resource HasMinY;\r
public final Resource HasParameterFile;\r
+ public final Resource HasRangeEnd;\r
+ public final Resource HasRangeStart;\r
+ public final Resource HasRangeStep;\r
public final Resource HasResult;\r
public final Resource HasResultFile;\r
public final Resource HasStartTime;\r
public static final String HasMinX = "http://www.simantics.org/Sysdyn-1.0/HasMinX";\r
public static final String HasMinY = "http://www.simantics.org/Sysdyn-1.0/HasMinY";\r
public static final String HasParameterFile = "http://www.simantics.org/Sysdyn-1.0/HasParameterFile";\r
+ public static final String HasRangeEnd = "http://www.simantics.org/Sysdyn-1.0/HasRangeEnd";\r
+ public static final String HasRangeStart = "http://www.simantics.org/Sysdyn-1.0/HasRangeStart";\r
+ public static final String HasRangeStep = "http://www.simantics.org/Sysdyn-1.0/HasRangeStep";\r
public static final String HasResult = "http://www.simantics.org/Sysdyn-1.0/HasResult";\r
public static final String HasResultFile = "http://www.simantics.org/Sysdyn-1.0/HasResultFile";\r
public static final String HasStartTime = "http://www.simantics.org/Sysdyn-1.0/HasStartTime";\r
HasMinX = getResourceOrNull(graph, URIs.HasMinX);\r
HasMinY = getResourceOrNull(graph, URIs.HasMinY);\r
HasParameterFile = getResourceOrNull(graph, URIs.HasParameterFile);\r
+ HasRangeEnd = getResourceOrNull(graph, URIs.HasRangeEnd);\r
+ HasRangeStart = getResourceOrNull(graph, URIs.HasRangeStart);\r
+ HasRangeStep = getResourceOrNull(graph, URIs.HasRangeStep);\r
HasResult = getResourceOrNull(graph, URIs.HasResult);\r
HasResultFile = getResourceOrNull(graph, URIs.HasResultFile);\r
HasStartTime = getResourceOrNull(graph, URIs.HasStartTime);\r
\r
HasUnit <R L0.HasProperty\r
L0.HasRange L0.String\r
+ \r
+HasRangeStart <R L0.HasProperty\r
+ L0.HasRange L0.Double \r
+ \r
+HasRangeEnd <R L0.HasProperty\r
+ L0.HasRange L0.Double \r
+ \r
+HasRangeStep <R L0.HasProperty\r
+ L0.HasRange L0.Double \r
\r
IndependentVariable <T Variable\r
- \r
[HasType card "1"]\r
[HasUnit card "0..1"]\r
[HasExpression card "0..1"] \r
+ [HasRangeStart card "0..1"]\r
+ [HasRangeEnd card "0..1"]\r
+ [HasRangeStep card "0..1"]\r
+ [L0.HasDescription card "0..1"]\r
+ \r
\r
Auxiliary <T IndependentVariable\r
\r