]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeViewerPropertyInfo.java
Added editable unit for derived properties
[simantics/platform.git] / bundles / org.simantics.modeling.ui / src / org / simantics / modeling / ui / componentTypeEditor / ComponentTypeViewerPropertyInfo.java
index 57ba4c462e09f7c0000846e38a3b19be982dcc4a..c5e77383f4be7330063696ca84807d28d3a6d3f7 100644 (file)
@@ -4,6 +4,7 @@ import org.simantics.databoard.annotations.Optional;
 import org.simantics.databoard.type.NumberType;
 import org.simantics.db.Resource;
 import org.simantics.utils.strings.AlphanumComparator;
+import org.simantics.utils.strings.StringUtils;
 
 public class ComponentTypeViewerPropertyInfo implements Comparable<ComponentTypeViewerPropertyInfo> {
     public Resource resource;
@@ -135,6 +136,16 @@ public class ComponentTypeViewerPropertyInfo implements Comparable<ComponentType
             return false;
         return true;
     }
-    
-    
+
+    public String unitString() {
+        String result = numberType == null ? null : numberType.getUnit();
+        if (result == null)
+            result = unit;
+        return StringUtils.safeString(result);
+    }
+
+    public String rangeString() {
+        return StringUtils.safeString(numberType == null ? null : numberType.getRangeStr());
+    }
+
 }
\ No newline at end of file