1 package org.simantics.g3d.property;
5 public class ComboPropertyManipulator implements PropertyManipulator{
7 ComboValueProvider provider;
12 public ComboPropertyManipulator(ValueProvider provider, Object input) {
13 this.provider = (ComboValueProvider)provider;
18 public int getValueCount() {
23 public String getDescription(int i) {
30 public String getValue(int i) {
32 Integer value = (Integer)provider.getValue(input);
33 if (value == null) return null;
34 return getItems()[value];
35 } catch (Exception e) {
41 public String setValue(String value, int i) {
43 provider.setValue(input, Integer.parseInt(value));
44 } catch (Exception e) {
45 return e.getMessage();
51 public boolean getEditMode() {
56 public void setEditMode(boolean b) {
60 public String[] getItems() {
62 List<Object> vals = provider.getValues(input);
63 String arr[] = new String[vals.size()];
64 for (int i = 0; i < vals.size(); i++) {
65 arr[i] = vals.get(i).toString();
68 } catch (Exception e) {
73 public Integer getValueIndex() {
75 Integer value = (Integer)provider.getValue(input);
77 } catch (Exception e) {
82 public Integer indexOf(String value) {
83 String[] items = getItems();
84 for (int i = 0; i < items.length; i++)
85 if (items[i].equals(value))