From 1895b93f561dd38f0dcaa8e4a59210508613a2ea Mon Sep 17 00:00:00 2001 From: Marko Luukkainen Date: Mon, 16 Dec 2019 13:18:14 +0200 Subject: [PATCH] Support for custom property values. gitlab #18 Change-Id: I2c5a7803ef7ac5f7156676fd8c3252cf38c35108 --- .../interop/update/model/PropertyChange.java | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/org.simantics.interop.update/src/org/simantics/interop/update/model/PropertyChange.java b/org.simantics.interop.update/src/org/simantics/interop/update/model/PropertyChange.java index 947f516..54d2f76 100644 --- a/org.simantics.interop.update/src/org/simantics/interop/update/model/PropertyChange.java +++ b/org.simantics.interop.update/src/org/simantics/interop/update/model/PropertyChange.java @@ -16,6 +16,8 @@ public class PropertyChange { protected boolean selected = false; protected boolean visible = true; protected boolean enabled = true; + protected Object customValue = null; + public PropertyChange(GraphChanges changes, Resource left, Statement first, Resource right, Statement second) { if (first == null && second == null) @@ -89,18 +91,20 @@ public class PropertyChange { return; } Resource s = leftSubject; - //Resource s = changes.getComparable().getLeft(rightSubject); - //Resource s = pair.first.getSubject(); + Object value = null; + if (customValue != null) + value = customValue; + else if (graph.hasValue(pair.second.getObject())) { + value = graph.getValue(pair.second.getObject()); + } Resource pred = pair.second.getPredicate(); - if (graph.hasValue(pair.second.getObject())) { - Object value = graph.getValue(pair.second.getObject()); + if (value != null) { graph.deny(s, pred); graph.claimLiteral(s, pred, value); } else { graph.deny(s,pred); } applied = true; - } /** @@ -175,4 +179,12 @@ public class PropertyChange { return s; } + public Object getCustomValue() { + return customValue; + } + + public void setCustomValue(Object customValue) { + this.customValue = customValue; + } + } -- 2.45.2