uidesigner/com.nokia.carbide.cpp.uiq.components/components/CQikSimpleDialogSourceGen.inc
author tzelaw
Tue, 14 Apr 2009 15:03:19 -0500
changeset 94 d74b720418db
parent 2 d760517a8095
permissions -rw-r--r--
Test framework support: Ask debugger to remember DebugTarget so test framework can use it to setup test framework related utility. With this we can use the DebugUI way of launching while keeping test framework functionality
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
cawthron
parents:
diff changeset
     1
<inline scope="file"><![CDATA[
cawthron
parents:
diff changeset
     2
function getCurrentConfig(instance) {
cawthron
parents:
diff changeset
     3
	// find dialog instance
cawthron
parents:
diff changeset
     4
	var dlg = instance.parent;
cawthron
parents:
diff changeset
     5
	while (!dlg.isInstanceOf("com.nokia.carbide.uiq.CQikSimpleDialog"))
cawthron
parents:
diff changeset
     6
		dlg = dlg.parent;
cawthron
parents:
diff changeset
     7
	// find dialog configurations group
cawthron
parents:
diff changeset
     8
	var dlgConfigsGroup = dlg.findChildOfType("com.nokia.carbide.uiq.DialogConfigurationsGroup");
cawthron
parents:
diff changeset
     9
	for (var i in dlgConfigsGroup.children) {
cawthron
parents:
diff changeset
    10
		var dlgConfig = dlgConfigsGroup.children[i];
cawthron
parents:
diff changeset
    11
		if (dlgConfig.properties.viewOrContainer == instance.name)
cawthron
parents:
diff changeset
    12
			return dlgConfig.properties.uiconfig;
cawthron
parents:
diff changeset
    13
	}
cawthron
parents:
diff changeset
    14
	return null;
cawthron
parents:
diff changeset
    15
}
cawthron
parents:
diff changeset
    16
]]></inline>
cawthron
parents:
diff changeset
    17
<inline><![CDATA[
cawthron
parents:
diff changeset
    18
if (isWithinSimpleDialog(instance)) {
cawthron
parents:
diff changeset
    19
	var allChildContribs = Engine.generateChildContributions(form);
cawthron
parents:
diff changeset
    20
	
cawthron
parents:
diff changeset
    21
	var initControlContribs = Engine.getContributionsForPhase(allChildContribs, "Initialize");
cawthron
parents:
diff changeset
    22
	var initPropertiesContribs = Engine.getContributionsForPhase(allChildContribs, "InitializeControlHandlers");
cawthron
parents:
diff changeset
    23
	
cawthron
parents:
diff changeset
    24
	allChildContribs.removeAll(initControlContribs);
cawthron
parents:
diff changeset
    25
	allChildContribs.removeAll(initPropertiesContribs);
cawthron
parents:
diff changeset
    26
	
cawthron
parents:
diff changeset
    27
	for (var i in instance.children) {
cawthron
parents:
diff changeset
    28
		var child = instance.children[i];
cawthron
parents:
diff changeset
    29
		var childContribs = Engine.generateChildContributions(child, form);
cawthron
parents:
diff changeset
    30
		childContribs.removeAll(Engine.generateChildContributions(child, form));
cawthron
parents:
diff changeset
    31
		childContribs.retainAll(Engine.getContributionsForPhase(childContribs, "Initialize"));
cawthron
parents:
diff changeset
    32
		if (Engine.formMatches(form, ["InstanceGen"])) {
cawthron
parents:
diff changeset
    33
			if (this.isRegistered(child) == true) {
cawthron
parents:
diff changeset
    34
				//println(child + " is registered, removing Initialize contribs");
cawthron
parents:
diff changeset
    35
				var toRemove = Engine.getContributionsForPhase(childContribs, "Initialize");
cawthron
parents:
diff changeset
    36
				//println("toRemove.size before=" + toRemove.size());
cawthron
parents:
diff changeset
    37
				//println("ChildContribs.size before=" + childContribs.size());
cawthron
parents:
diff changeset
    38
				childContribs.removeAll(toRemove);
cawthron
parents:
diff changeset
    39
				//println("ChildContribs.size after=" + childContribs.size());
cawthron
parents:
diff changeset
    40
				//for (var iterator = childContribs.iterator(); iterator.hasNext();) {
cawthron
parents:
diff changeset
    41
					//var myContrib = iterator.next();
cawthron
parents:
diff changeset
    42
					//println("     " + myContrib);
cawthron
parents:
diff changeset
    43
				//}
cawthron
parents:
diff changeset
    44
			} else {
cawthron
parents:
diff changeset
    45
				//println(child + " is not registered, registering child");
cawthron
parents:
diff changeset
    46
				this.register(child);
cawthron
parents:
diff changeset
    47
			}
cawthron
parents:
diff changeset
    48
		}
cawthron
parents:
diff changeset
    49
		contribs.addAll(childContribs);
cawthron
parents:
diff changeset
    50
	}
cawthron
parents:
diff changeset
    51
	
cawthron
parents:
diff changeset
    52
	var curConfig = getCurrentConfig(instance);
cawthron
parents:
diff changeset
    53
	var contrib;
cawthron
parents:
diff changeset
    54
	
cawthron
parents:
diff changeset
    55
//poc 091107 uncomment ini..
cawthron
parents:
diff changeset
    56
	if (curConfig != null) {
cawthron
parents:
diff changeset
    57
		contrib = Engine.createContributionForPhase("InitializeControlHandlers");
cawthron
parents:
diff changeset
    58
		contrib.setText("if ( CQUiConfigClient::Static().CurrentConfig() == " + curConfig + " )\n");
cawthron
parents:
diff changeset
    59
		contribs.add(contrib);
cawthron
parents:
diff changeset
    60
		contrib = Engine.createContributionForPhase("InitializeControlHandlers");
cawthron
parents:
diff changeset
    61
		contrib.setText("{\n");
cawthron
parents:
diff changeset
    62
		contrib.indentAdjust(1);
cawthron
parents:
diff changeset
    63
		contribs.add(contrib);
cawthron
parents:
diff changeset
    64
	}
cawthron
parents:
diff changeset
    65
cawthron
parents:
diff changeset
    66
//poc 091107 uncomment fin..
cawthron
parents:
diff changeset
    67
		
cawthron
parents:
diff changeset
    68
	for (var iterator = initPropertiesContribs.iterator(); iterator.hasNext();) {
cawthron
parents:
diff changeset
    69
		contrib = iterator.next();
cawthron
parents:
diff changeset
    70
		if (curConfig != null)
cawthron
parents:
diff changeset
    71
			contrib.indentAdjust(1);
cawthron
parents:
diff changeset
    72
		contribs.add(contrib);
cawthron
parents:
diff changeset
    73
	}
cawthron
parents:
diff changeset
    74
cawthron
parents:
diff changeset
    75
//poc 091107 uncomment ini..
cawthron
parents:
diff changeset
    76
	if (curConfig != null) {
cawthron
parents:
diff changeset
    77
		contrib = Engine.createContributionForPhase("InitializeControlHandlers");
cawthron
parents:
diff changeset
    78
		contrib.setText("}\n");
cawthron
parents:
diff changeset
    79
		contrib.indentAdjust(1);
cawthron
parents:
diff changeset
    80
		contribs.add(contrib);
cawthron
parents:
diff changeset
    81
	}
cawthron
parents:
diff changeset
    82
//poc 091107 uncomment fin..
cawthron
parents:
diff changeset
    83
		
cawthron
parents:
diff changeset
    84
	contribs.addAll(allChildContribs);
cawthron
parents:
diff changeset
    85
}
cawthron
parents:
diff changeset
    86
]]></inline>