summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/FloatArrayEditorDialog.java
blob: 4172da107e6a30b141c7f2230a4f1f61f7b0ad5c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package NET.worlds.scape;

import java.util.StringTokenizer;

class FloatArrayEditorDialog extends ListEditorDialog {
   protected Property property;
   protected float[] arr;

   FloatArrayEditorDialog(EditTile parent, String title, Property property) {
      super(parent, title);
      this.property = property;
      this.ready();
   }

   @Override
   protected void build() {
      this.arr = (float[])this.property.get();
      super.build();
   }

   @Override
   protected int getElementCount() {
      return this.arr.length;
   }

   @Override
   protected String getElement(int index) {
      return "" + this.arr[index];
   }

   @Override
   protected boolean setElements(StringTokenizer e) {
      int count = 0;

      while (e.hasMoreTokens()) {
         try {
            this.arr[count++] = Float.valueOf(e.nextToken());
         } catch (Exception var4) {
            return false;
         }
      }

      if (count == this.arr.length) {
         this.parent.addUndoableSet(this.property, this.arr);
         return true;
      } else {
         return false;
      }
   }
}