2
|
1 |
|
|
2 |
|
|
3 |
function QueryContainment() {
|
|
4 |
}
|
|
5 |
|
|
6 |
|
|
7 |
function doComponentCheck(instance, componentId) {
|
|
8 |
return instance.componentId == componentId;
|
|
9 |
}
|
|
10 |
|
|
11 |
function doComponentCheckStatus(instance, componentId) {
|
|
12 |
if (doComponentCheck(instance, componentId))
|
|
13 |
return null;
|
|
14 |
|
|
15 |
statusBuilder = newStatusBuilder();
|
|
16 |
params = new Array(1);
|
|
17 |
params[0] = componentId;
|
|
18 |
statusBuilder.add(4, "Test {0}", params);
|
|
19 |
return statusBuilder.createStatus("", null);
|
|
20 |
}
|
|
21 |
|
|
22 |
QueryContainment.prototype.canContainComponent = function(instance, otherComponent) {
|
|
23 |
return doComponentCheckStatus(instance, otherComponent.id);
|
|
24 |
}
|
|
25 |
|
|
26 |
QueryContainment.prototype.canContainChild = function(instance, child) {
|
|
27 |
return this.canContainComponent(instance.attributes, child.componentId);
|
|
28 |
}
|
|
29 |
|
|
30 |
QueryContainment.prototype.canRemoveChild = function(instance, child) {
|
|
31 |
return doComponentCheck(instance, child.componentId);
|
|
32 |
}
|