1 package org.simantics.sysdyn.ui.properties.widgets.factories;
\r
3 import org.simantics.browsing.ui.swt.widgets.impl.ReadFactoryImpl;
\r
4 import org.simantics.db.ReadGraph;
\r
5 import org.simantics.db.Resource;
\r
6 import org.simantics.db.exception.DatabaseException;
\r
7 import org.simantics.utils.datastructures.Triple;
\r
9 public class DoublePropertyFactory extends ReadFactoryImpl<Resource, String> {
\r
11 final private String propertyURI;
\r
13 public DoublePropertyFactory(String propertyURI) {
\r
14 this.propertyURI = propertyURI;
\r
18 public Object getIdentity(Object inputContents) {
\r
19 return new Triple<Resource, String, Object>((Resource)inputContents, propertyURI, getClass());
\r
23 public String perform(ReadGraph graph, Resource issue) throws DatabaseException {
\r
25 Double value = graph.getPossibleRelatedValue(issue, graph.getResource(propertyURI));
\r
27 return value.toString();
\r