uidesigner/com.nokia.carbide.cpp.uiq.components/components/CQikSimpleDialogSourceGen.inc
changeset 2 d760517a8095
equal deleted inserted replaced
-1:000000000000 2:d760517a8095
       
     1 <inline scope="file"><![CDATA[
       
     2 function getCurrentConfig(instance) {
       
     3 	// find dialog instance
       
     4 	var dlg = instance.parent;
       
     5 	while (!dlg.isInstanceOf("com.nokia.carbide.uiq.CQikSimpleDialog"))
       
     6 		dlg = dlg.parent;
       
     7 	// find dialog configurations group
       
     8 	var dlgConfigsGroup = dlg.findChildOfType("com.nokia.carbide.uiq.DialogConfigurationsGroup");
       
     9 	for (var i in dlgConfigsGroup.children) {
       
    10 		var dlgConfig = dlgConfigsGroup.children[i];
       
    11 		if (dlgConfig.properties.viewOrContainer == instance.name)
       
    12 			return dlgConfig.properties.uiconfig;
       
    13 	}
       
    14 	return null;
       
    15 }
       
    16 ]]></inline>
       
    17 <inline><![CDATA[
       
    18 if (isWithinSimpleDialog(instance)) {
       
    19 	var allChildContribs = Engine.generateChildContributions(form);
       
    20 	
       
    21 	var initControlContribs = Engine.getContributionsForPhase(allChildContribs, "Initialize");
       
    22 	var initPropertiesContribs = Engine.getContributionsForPhase(allChildContribs, "InitializeControlHandlers");
       
    23 	
       
    24 	allChildContribs.removeAll(initControlContribs);
       
    25 	allChildContribs.removeAll(initPropertiesContribs);
       
    26 	
       
    27 	for (var i in instance.children) {
       
    28 		var child = instance.children[i];
       
    29 		var childContribs = Engine.generateChildContributions(child, form);
       
    30 		childContribs.removeAll(Engine.generateChildContributions(child, form));
       
    31 		childContribs.retainAll(Engine.getContributionsForPhase(childContribs, "Initialize"));
       
    32 		if (Engine.formMatches(form, ["InstanceGen"])) {
       
    33 			if (this.isRegistered(child) == true) {
       
    34 				//println(child + " is registered, removing Initialize contribs");
       
    35 				var toRemove = Engine.getContributionsForPhase(childContribs, "Initialize");
       
    36 				//println("toRemove.size before=" + toRemove.size());
       
    37 				//println("ChildContribs.size before=" + childContribs.size());
       
    38 				childContribs.removeAll(toRemove);
       
    39 				//println("ChildContribs.size after=" + childContribs.size());
       
    40 				//for (var iterator = childContribs.iterator(); iterator.hasNext();) {
       
    41 					//var myContrib = iterator.next();
       
    42 					//println("     " + myContrib);
       
    43 				//}
       
    44 			} else {
       
    45 				//println(child + " is not registered, registering child");
       
    46 				this.register(child);
       
    47 			}
       
    48 		}
       
    49 		contribs.addAll(childContribs);
       
    50 	}
       
    51 	
       
    52 	var curConfig = getCurrentConfig(instance);
       
    53 	var contrib;
       
    54 	
       
    55 //poc 091107 uncomment ini..
       
    56 	if (curConfig != null) {
       
    57 		contrib = Engine.createContributionForPhase("InitializeControlHandlers");
       
    58 		contrib.setText("if ( CQUiConfigClient::Static().CurrentConfig() == " + curConfig + " )\n");
       
    59 		contribs.add(contrib);
       
    60 		contrib = Engine.createContributionForPhase("InitializeControlHandlers");
       
    61 		contrib.setText("{\n");
       
    62 		contrib.indentAdjust(1);
       
    63 		contribs.add(contrib);
       
    64 	}
       
    65 
       
    66 //poc 091107 uncomment fin..
       
    67 		
       
    68 	for (var iterator = initPropertiesContribs.iterator(); iterator.hasNext();) {
       
    69 		contrib = iterator.next();
       
    70 		if (curConfig != null)
       
    71 			contrib.indentAdjust(1);
       
    72 		contribs.add(contrib);
       
    73 	}
       
    74 
       
    75 //poc 091107 uncomment ini..
       
    76 	if (curConfig != null) {
       
    77 		contrib = Engine.createContributionForPhase("InitializeControlHandlers");
       
    78 		contrib.setText("}\n");
       
    79 		contrib.indentAdjust(1);
       
    80 		contribs.add(contrib);
       
    81 	}
       
    82 //poc 091107 uncomment fin..
       
    83 		
       
    84 	contribs.addAll(allChildContribs);
       
    85 }
       
    86 ]]></inline>