1 /*******************************************************************************
2 * Copyright (c) 2012, 2013 Association for Decentralized Information Management in
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.g3d.property;
14 public class DoublePropertyManipulator implements PropertyManipulator {
16 ValueProvider provider;
20 String editValue = null;
22 public DoublePropertyManipulator(ValueProvider provider, Object input) {
23 this.provider = provider;
28 public int getValueCount() {
33 public String getDescription(int i) {
40 public String getValue(int i) {
44 Object value = provider.getValue(input);
45 if (value == null) return null;
46 return value.toString();
47 } catch (Exception e) {
53 public String setValue(String value, int i) {
56 provider.setValue(input, Double.parseDouble(value));
57 } catch (Exception e) {
58 return e.getMessage();
64 public boolean getEditMode() {
69 public void setEditMode(boolean b) {
73 editValue = provider.getValue(input).toString();
74 } catch (Exception e) {