uidesigner/com.nokia.sdt.component.symbian.test/data/reconcilePropertyTest/script_reconcile.js
author fturovic <frank.turovich@nokia.com>
Fri, 24 Apr 2009 10:31:21 -0500
branchRCL_2_0
changeset 124 4629a6a90ed5
parent 2 d760517a8095
permissions -rw-r--r--
merged with Tims last change
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
cawthron
parents:
diff changeset
     1
var kZero = "Zero";
cawthron
parents:
diff changeset
     2
var kOne = "One";
cawthron
parents:
diff changeset
     3
var kTwo = "Two";
cawthron
parents:
diff changeset
     4
var kThree = "Three";
cawthron
parents:
diff changeset
     5
var kMany = "Many";
cawthron
parents:
diff changeset
     6
cawthron
parents:
diff changeset
     7
cawthron
parents:
diff changeset
     8
function Reconcile() {
cawthron
parents:
diff changeset
     9
}
cawthron
parents:
diff changeset
    10
cawthron
parents:
diff changeset
    11
Reconcile.prototype.createDisplayValue = function(instance, propertyTypeName, propertyValue) {
cawthron
parents:
diff changeset
    12
	if (!propertyTypeName.equals("compoundProperty")) {
cawthron
parents:
diff changeset
    13
		java.lang.System.out.println("createDisplayValue() Wrong property type: "+propertyTypeName+"; expected \"compoundProperty\"");
cawthron
parents:
diff changeset
    14
		return null;
cawthron
parents:
diff changeset
    15
	}
cawthron
parents:
diff changeset
    16
		
cawthron
parents:
diff changeset
    17
	var sum = propertyValue.first + propertyValue.second;
cawthron
parents:
diff changeset
    18
	if (sum == 0)
cawthron
parents:
diff changeset
    19
		return kZero;
cawthron
parents:
diff changeset
    20
	if (sum == 1)
cawthron
parents:
diff changeset
    21
		return kOne;
cawthron
parents:
diff changeset
    22
	if (sum == 2)
cawthron
parents:
diff changeset
    23
		return kTwo;
cawthron
parents:
diff changeset
    24
	if (sum == 3)
cawthron
parents:
diff changeset
    25
		return kThree;
cawthron
parents:
diff changeset
    26
cawthron
parents:
diff changeset
    27
	return kMany;
cawthron
parents:
diff changeset
    28
}
cawthron
parents:
diff changeset
    29
	
cawthron
parents:
diff changeset
    30
Reconcile.prototype.isDisplayValueEditable = function(instance, propertyTypeName) {
cawthron
parents:
diff changeset
    31
	if (!propertyTypeName.equals("compoundProperty")) {
cawthron
parents:
diff changeset
    32
		java.lang.System.out.println("isDisplayValueEditable() Wrong property type: "+propertyTypeName+"; expected \"compoundProperty\"");
cawthron
parents:
diff changeset
    33
		return true;
cawthron
parents:
diff changeset
    34
	}
cawthron
parents:
diff changeset
    35
		
cawthron
parents:
diff changeset
    36
	return true;
cawthron
parents:
diff changeset
    37
}
cawthron
parents:
diff changeset
    38
	
cawthron
parents:
diff changeset
    39
Reconcile.prototype.applyDisplayValue = function(instance, propertyTypeName, displayValue, propertyValue) {
cawthron
parents:
diff changeset
    40
	if (!propertyTypeName.equals("compoundProperty")) {
cawthron
parents:
diff changeset
    41
		java.lang.System.out.println("applyDisplayValue() Wrong property type: "+propertyTypeName+"; expected \"compoundProperty\"");
cawthron
parents:
diff changeset
    42
		return;
cawthron
parents:
diff changeset
    43
	}
cawthron
parents:
diff changeset
    44
		
cawthron
parents:
diff changeset
    45
	if (displayValue.equals(kZero)) {
cawthron
parents:
diff changeset
    46
		propertyValue.first = 0;
cawthron
parents:
diff changeset
    47
		propertyValue.second = 0;
cawthron
parents:
diff changeset
    48
	}
cawthron
parents:
diff changeset
    49
	if (displayValue.equals(kOne)) {
cawthron
parents:
diff changeset
    50
		propertyValue.first = 0;
cawthron
parents:
diff changeset
    51
		propertyValue.second = 1;
cawthron
parents:
diff changeset
    52
	}
cawthron
parents:
diff changeset
    53
	if (displayValue.equals(kTwo)) {
cawthron
parents:
diff changeset
    54
		propertyValue.first = 1;
cawthron
parents:
diff changeset
    55
		propertyValue.second = 1;
cawthron
parents:
diff changeset
    56
	}
cawthron
parents:
diff changeset
    57
	if (displayValue.equals(kThree)) {
cawthron
parents:
diff changeset
    58
		propertyValue.first = 1;
cawthron
parents:
diff changeset
    59
		propertyValue.second = 2;
cawthron
parents:
diff changeset
    60
	}
cawthron
parents:
diff changeset
    61
	if (displayValue.equals(kMany)) {
cawthron
parents:
diff changeset
    62
		propertyValue.first = 2;
cawthron
parents:
diff changeset
    63
		propertyValue.second = 2;
cawthron
parents:
diff changeset
    64
	}
cawthron
parents:
diff changeset
    65
}
cawthron
parents:
diff changeset
    66