uidesigner/com.nokia.sdt.component.symbian.test/data/display/script_queryContainment.js
author dan.podwall@nokia.com
Mon, 06 Apr 2009 14:02:48 -0500
changeset 51 da820b19f9da
parent 2 d760517a8095
permissions -rw-r--r--
merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
cawthron
parents:
diff changeset
     1
cawthron
parents:
diff changeset
     2
cawthron
parents:
diff changeset
     3
function QueryContainment() {
cawthron
parents:
diff changeset
     4
}
cawthron
parents:
diff changeset
     5
cawthron
parents:
diff changeset
     6
cawthron
parents:
diff changeset
     7
function doComponentCheck(instance, componentId) {
cawthron
parents:
diff changeset
     8
	return instance.componentId == componentId;
cawthron
parents:
diff changeset
     9
}
cawthron
parents:
diff changeset
    10
cawthron
parents:
diff changeset
    11
function doComponentCheckStatus(instance, componentId) {
cawthron
parents:
diff changeset
    12
	if (doComponentCheck(instance, componentId))
cawthron
parents:
diff changeset
    13
		return null;
cawthron
parents:
diff changeset
    14
		
cawthron
parents:
diff changeset
    15
	statusBuilder = newStatusBuilder();
cawthron
parents:
diff changeset
    16
	params = new Array(1);
cawthron
parents:
diff changeset
    17
	params[0] = componentId;
cawthron
parents:
diff changeset
    18
	statusBuilder.add(4, "Test {0}", params);
cawthron
parents:
diff changeset
    19
	return statusBuilder.createStatus("", null);
cawthron
parents:
diff changeset
    20
}
cawthron
parents:
diff changeset
    21
cawthron
parents:
diff changeset
    22
QueryContainment.prototype.canContainComponent = function(instance, otherComponent) {
cawthron
parents:
diff changeset
    23
	return doComponentCheckStatus(instance, otherComponent.id);
cawthron
parents:
diff changeset
    24
}
cawthron
parents:
diff changeset
    25
cawthron
parents:
diff changeset
    26
QueryContainment.prototype.canContainChild = function(instance, child) {
cawthron
parents:
diff changeset
    27
	return this.canContainComponent(instance.attributes, child.componentId);
cawthron
parents:
diff changeset
    28
}
cawthron
parents:
diff changeset
    29
cawthron
parents:
diff changeset
    30
QueryContainment.prototype.canRemoveChild = function(instance, child) {
cawthron
parents:
diff changeset
    31
	return doComponentCheck(instance, child.componentId);
cawthron
parents:
diff changeset
    32
}