2
|
1 |
var kZero = "Zero";
|
|
2 |
var kOne = "One";
|
|
3 |
var kTwo = "Two";
|
|
4 |
var kThree = "Three";
|
|
5 |
var kMany = "Many";
|
|
6 |
|
|
7 |
|
|
8 |
function Reconcile() {
|
|
9 |
}
|
|
10 |
|
|
11 |
Reconcile.prototype.createDisplayValue = function(instance, propertyTypeName, propertyValue) {
|
|
12 |
if (!propertyTypeName.equals("compoundProperty")) {
|
|
13 |
java.lang.System.out.println("createDisplayValue() Wrong property type: "+propertyTypeName+"; expected \"compoundProperty\"");
|
|
14 |
return null;
|
|
15 |
}
|
|
16 |
|
|
17 |
var sum = propertyValue.first + propertyValue.second;
|
|
18 |
if (sum == 0)
|
|
19 |
return kZero;
|
|
20 |
if (sum == 1)
|
|
21 |
return kOne;
|
|
22 |
if (sum == 2)
|
|
23 |
return kTwo;
|
|
24 |
if (sum == 3)
|
|
25 |
return kThree;
|
|
26 |
|
|
27 |
return kMany;
|
|
28 |
}
|
|
29 |
|
|
30 |
Reconcile.prototype.isDisplayValueEditable = function(instance, propertyTypeName) {
|
|
31 |
if (!propertyTypeName.equals("compoundProperty")) {
|
|
32 |
java.lang.System.out.println("isDisplayValueEditable() Wrong property type: "+propertyTypeName+"; expected \"compoundProperty\"");
|
|
33 |
return true;
|
|
34 |
}
|
|
35 |
|
|
36 |
return true;
|
|
37 |
}
|
|
38 |
|
|
39 |
Reconcile.prototype.applyDisplayValue = function(instance, propertyTypeName, displayValue, propertyValue) {
|
|
40 |
if (!propertyTypeName.equals("compoundProperty")) {
|
|
41 |
java.lang.System.out.println("applyDisplayValue() Wrong property type: "+propertyTypeName+"; expected \"compoundProperty\"");
|
|
42 |
return;
|
|
43 |
}
|
|
44 |
|
|
45 |
if (displayValue.equals(kZero)) {
|
|
46 |
propertyValue.first = 0;
|
|
47 |
propertyValue.second = 0;
|
|
48 |
}
|
|
49 |
if (displayValue.equals(kOne)) {
|
|
50 |
propertyValue.first = 0;
|
|
51 |
propertyValue.second = 1;
|
|
52 |
}
|
|
53 |
if (displayValue.equals(kTwo)) {
|
|
54 |
propertyValue.first = 1;
|
|
55 |
propertyValue.second = 1;
|
|
56 |
}
|
|
57 |
if (displayValue.equals(kThree)) {
|
|
58 |
propertyValue.first = 1;
|
|
59 |
propertyValue.second = 2;
|
|
60 |
}
|
|
61 |
if (displayValue.equals(kMany)) {
|
|
62 |
propertyValue.first = 2;
|
|
63 |
propertyValue.second = 2;
|
|
64 |
}
|
|
65 |
}
|
|
66 |
|