]> gerrit.simantics Code Review - simantics/sysdyn.git/blob
5a2f5a72f7f796a632aec61dab93bb1ea34b297b
[simantics/sysdyn.git] /
1 package org.simantics.sysdyn.ui.properties.widgets.factories;\r
2 \r
3 import org.simantics.browsing.ui.swt.widgets.impl.TextModifyListenerImpl;\r
4 import org.simantics.databoard.binding.java.DoubleBindingDefault;\r
5 import org.simantics.db.Resource;\r
6 import org.simantics.db.WriteGraph;\r
7 import org.simantics.db.exception.DatabaseException;\r
8 import org.simantics.db.management.ISessionContext;\r
9 \r
10 public class DoublePropertyModifier extends TextModifyListenerImpl<Resource> {\r
11 \r
12     final private String propertyURI;\r
13     \r
14     public DoublePropertyModifier(ISessionContext context, String propertyURI) {\r
15         this.propertyURI = propertyURI;\r
16     }\r
17 \r
18     @Override\r
19     public void applyText(WriteGraph graph, Resource input, String text) throws DatabaseException {\r
20         graph.claimValue(input, graph.getResource(propertyURI), Double.parseDouble(text), DoubleBindingDefault.INSTANCE);\r
21     }\r
22 \r
23 }\r