blob: 61f62e603428361bc8a2d10e54fe76cb5eb11a40 (
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
package NET.worlds.scape;
import java.util.StringTokenizer;
class Point2EditorDialog extends ListEditorDialog {
protected Property property;
protected Point2 p;
Point2EditorDialog(EditTile parent, String title, Property property) {
super(parent, title);
this.property = property;
this.ready();
}
@Override
protected void build() {
this.p = (Point2)this.property.get();
super.build();
}
@Override
protected int getElementCount() {
return 2;
}
@Override
protected String getElement(int index) {
switch (index) {
case 0:
return "" + this.p.x;
default:
return "" + this.p.y;
}
}
@Override
protected boolean setElements(StringTokenizer e) {
Point2 p = new Point2();
int count = 0;
while (e.hasMoreTokens()) {
try {
float tmp = Float.valueOf(e.nextToken());
switch (count++) {
case 0:
p.x = tmp;
break;
case 1:
p.y = tmp;
break;
default:
return false;
}
} catch (Exception var5) {
return false;
}
}
if (count != 2) {
return false;
} else {
this.parent.addUndoableSet(this.property, p);
return true;
}
}
}
|