1 package org.simantics.g3d.property;
\r
3 import java.lang.reflect.InvocationTargetException;
\r
4 import java.lang.reflect.Method;
\r
6 import javax.vecmath.Vector3d;
\r
8 public class VectorPropertyManipulator implements PropertyManipulator {
\r
10 ValueProvider provider;
\r
11 protected Object input;
\r
14 Vector3d editValue = null;
\r
16 public VectorPropertyManipulator(ValueProvider provider, Object input) {
\r
17 this.provider = provider;
\r
22 public int getValueCount() {
\r
27 public String getDescription(int i) {
\r
38 public String getValue(int i) {
\r
40 Vector3d v = _getValue();
\r
44 return Double.toString(v.x);
\r
46 return Double.toString(v.y);
\r
48 return Double.toString(v.z);
\r
50 } catch (Exception e) {
\r
56 public String setValue(String value, int i) {
\r
58 Double d = Double.parseDouble(value);
\r
59 Vector3d v = _getValue();
\r
60 v = new Vector3d(v.x, v.y, v.z);
\r
69 } catch (Exception e) {
\r
70 return e.getMessage();
\r
75 protected void setValue(Vector3d v) throws Exception {
\r
76 provider.setValue(input, v);
\r
79 private Vector3d _getValue() throws Exception{
\r
82 return (Vector3d) provider.getValue(input);
\r
86 public boolean getEditMode() {
\r
91 public void setEditMode(boolean b) {
\r
95 editValue = (Vector3d) provider.getValue(input);
\r
96 } catch (Exception e) {
\r