X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.modeling.ui%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fui%2Fchart%2Fproperty%2FIntegerToDoublePropertyModifier.java;h=ae6dc64dc47efeaf3449d6aa16fe5269204fa29c;hb=refs%2Fchanges%2F96%2F3896%2F1;hp=f9af288f474e313e435353fa2bc7d693a458fca8;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/IntegerToDoublePropertyModifier.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/IntegerToDoublePropertyModifier.java index f9af288f4..ae6dc64dc 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/IntegerToDoublePropertyModifier.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/IntegerToDoublePropertyModifier.java @@ -1,47 +1,47 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Association for Decentralized Information Management in - * Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.modeling.ui.chart.property; - -import org.simantics.browsing.ui.swt.widgets.Scale; -import org.simantics.browsing.ui.swt.widgets.impl.SelectionListenerImpl; -import org.simantics.databoard.Bindings; -import org.simantics.db.Resource; -import org.simantics.db.WriteGraph; -import org.simantics.db.exception.DatabaseException; -import org.simantics.db.management.ISessionContext; - -/** - * @author Tuukka Lehtonen - */ -public class IntegerToDoublePropertyModifier extends SelectionListenerImpl { - - private final Scale slider; - private final String propertyURI; - private int selection; - - public IntegerToDoublePropertyModifier(Scale slider, ISessionContext context, String propertyURI) { - super(context); - this.slider = slider; - this.propertyURI = propertyURI; - } - - @Override - public void beforeApply() { - this.selection = slider.getWidget().getSelection(); - } - - @Override - public void apply(WriteGraph graph, Resource input) throws DatabaseException { - graph.claimLiteral(input, graph.getResource(propertyURI), (double) selection, Bindings.DOUBLE); - } - -} +/******************************************************************************* + * Copyright (c) 2010, 2011 Association for Decentralized Information Management in + * Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.modeling.ui.chart.property; + +import org.simantics.browsing.ui.swt.widgets.Scale; +import org.simantics.browsing.ui.swt.widgets.impl.SelectionListenerImpl; +import org.simantics.databoard.Bindings; +import org.simantics.db.Resource; +import org.simantics.db.WriteGraph; +import org.simantics.db.exception.DatabaseException; +import org.simantics.db.management.ISessionContext; + +/** + * @author Tuukka Lehtonen + */ +public class IntegerToDoublePropertyModifier extends SelectionListenerImpl { + + private final Scale slider; + private final String propertyURI; + private int selection; + + public IntegerToDoublePropertyModifier(Scale slider, ISessionContext context, String propertyURI) { + super(context); + this.slider = slider; + this.propertyURI = propertyURI; + } + + @Override + public void beforeApply() { + this.selection = slider.getWidget().getSelection(); + } + + @Override + public void apply(WriteGraph graph, Resource input) throws DatabaseException { + graph.claimLiteral(input, graph.getResource(propertyURI), (double) selection, Bindings.DOUBLE); + } + +}