function updateConfiguration(oTarget, oListener, oConfiguration, bRemove) {

		var sId = oTarget.getId(),
			oTargetConfig = mTargets[sId],
			oCurrentConfig,
			iIndex;
		if (bRemove) {
			if (!oTargetConfig) {
				// no registration so far, nothing to remove
				return;
			}
			iIndex = oTargetConfig.listeners.indexOf(oListener);
			if (iIndex >= 0) {
				// already registered, update the configuration
				oCurrentConfig = oTargetConfig.configurations[iIndex];
			}
		} else {
			if (!oTargetConfig) {
				oTargetConfig = mTargets[sId] = {
					listeners: [],
					configurations: [],
					object: oTarget
				};
			}
			iIndex = oTargetConfig.listeners.indexOf(oListener);
			if (iIndex === -1) {
				// not registered, push listener and configuration
				oTargetConfig.listeners.push(oListener);
				oTargetConfig.configurations.push(oConfiguration);
			} else {
				oCurrentConfig = oTargetConfig.configurations[iIndex];
			}
		}
		if (oCurrentConfig) {
			oCurrentConfig.properties = oCurrentConfig.properties || [];
			updateSingleArray(oCurrentConfig.properties, oConfiguration.properties, bRemove);

			oCurrentConfig.aggregations = oCurrentConfig.aggregations || [];
			updateSingleArray(oCurrentConfig.aggregations, oConfiguration.aggregations, bRemove);

			oCurrentConfig.associations = oCurrentConfig.associations || [];
			updateSingleArray(oCurrentConfig.associations, oConfiguration.associations, bRemove);

			oCurrentConfig.bindings = oCurrentConfig.bindings || [];
			updateSingleArray(oCurrentConfig.bindings, oConfiguration.bindings, bRemove);

			oCurrentConfig.events = oCurrentConfig.events || [];
			updateSingleArray(oCurrentConfig.events, oConfiguration.events, bRemove);

			if (oConfiguration.destroy != null) {
				if (bRemove) {
					delete oCurrentConfig.destroy;
				} else {
					oCurrentConfig.destroy = oConfiguration.destroy;
				}
			}

			if (oConfiguration.parent != null) {
				if (bRemove) {
					delete oCurrentConfig.parent;
				} else {
					oCurrentConfig.parent = oConfiguration.parent;
				}
			}
		}
		var bEventsObserved = hasObserverFor(oTarget, "events");

		if (oTarget._observer && bRemove) {
			//delete oTarget._observer;
			if (!bEventsObserved && EventProvider.hasListener(oTarget, "EventHandlerChange", fnHandleEventChange)) {
				oTarget.detachEvent("EventHandlerChange", fnHandleEventChange);
			}
			if (!bEventsObserved &&
					!hasObserverFor(oTarget, "properties") &&
					!hasObserverFor(oTarget, "aggregations") &&
					!hasObserverFor(oTarget, "associations") &&
					!hasObserverFor(oTarget, "destroy") &&
					!hasObserverFor(oTarget, "parent") &&
					!hasObserverFor(oTarget, "bindings")) {
				delete oTarget._observer;
				delete mTargets[sId];
			}
		} else if (!oTarget._observer && !bRemove) {
			//is any config listening to events
			if (bEventsObserved && !EventProvider.hasListener(oTarget, "EventHandlerChange", fnHandleEventChange)) {
				oTarget.attachEvent("EventHandlerChange", fnHandleEventChange);
			}
			oTarget._observer = Observer;
		}

	}
// update a complete configuration, create one if needed or remove it
update a complete configuration, create one if needed or remove it
update a complete configuration create one if needed or remove it
function updateConfiguration(oTarget, oListener, oConfiguration, bRemove) {
		var sId = oTarget.getId(),
			oTargetConfig = mTargets[sId],
			oCurrentConfig,
			iIndex;
		if (bRemove) {
			if (!oTargetConfig) {
				return;
			}
			iIndex = oTargetConfig.listeners.indexOf(oListener);
			if (iIndex >= 0) {
				oCurrentConfig = oTargetConfig.configurations[iIndex];
			}
		} else {
			if (!oTargetConfig) {
				oTargetConfig = mTargets[sId] = {
					listeners: [],
					configurations: [],
					object: oTarget
				};
			}
			iIndex = oTargetConfig.listeners.indexOf(oListener);
			if (iIndex === -1) {
				oTargetConfig.listeners.push(oListener);
				oTargetConfig.configurations.push(oConfiguration);
			} else {
				oCurrentConfig = oTargetConfig.configurations[iIndex];
			}
		}
		if (oCurrentConfig) {
			oCurrentConfig.properties = oCurrentConfig.properties || [];
			updateSingleArray(oCurrentConfig.properties, oConfiguration.properties, bRemove);
			oCurrentConfig.aggregations = oCurrentConfig.aggregations || [];
			updateSingleArray(oCurrentConfig.aggregations, oConfiguration.aggregations, bRemove);
			oCurrentConfig.associations = oCurrentConfig.associations || [];
			updateSingleArray(oCurrentConfig.associations, oConfiguration.associations, bRemove);
			oCurrentConfig.bindings = oCurrentConfig.bindings || [];
			updateSingleArray(oCurrentConfig.bindings, oConfiguration.bindings, bRemove);
			oCurrentConfig.events = oCurrentConfig.events || [];
			updateSingleArray(oCurrentConfig.events, oConfiguration.events, bRemove);
			if (oConfiguration.destroy != null) {
				if (bRemove) {
					delete oCurrentConfig.destroy;
				} else {
					oCurrentConfig.destroy = oConfiguration.destroy;
				}
			}
			if (oConfiguration.parent != null) {
				if (bRemove) {
					delete oCurrentConfig.parent;
				} else {
					oCurrentConfig.parent = oConfiguration.parent;
				}
			}
		}
		var bEventsObserved = hasObserverFor(oTarget, "events");
		if (oTarget._observer && bRemove) {
			if (!bEventsObserved && EventProvider.hasListener(oTarget, "EventHandlerChange", fnHandleEventChange)) {
				oTarget.detachEvent("EventHandlerChange", fnHandleEventChange);
			}
			if (!bEventsObserved &&
					!hasObserverFor(oTarget, "properties") &&
					!hasObserverFor(oTarget, "aggregations") &&
					!hasObserverFor(oTarget, "associations") &&
					!hasObserverFor(oTarget, "destroy") &&
					!hasObserverFor(oTarget, "parent") &&
					!hasObserverFor(oTarget, "bindings")) {
				delete oTarget._observer;
				delete mTargets[sId];
			}
		} else if (!oTarget._observer && !bRemove) {
			if (bEventsObserved && !EventProvider.hasListener(oTarget, "EventHandlerChange", fnHandleEventChange)) {
				oTarget.attachEvent("EventHandlerChange", fnHandleEventChange);
			}
			oTarget._observer = Observer;
		}
	}
function updateConfiguration ( oTarget , oListener , oConfiguration , bRemove ) { var sId = oTarget . getId ( ) , oTargetConfig = mTargets [ sId ] , oCurrentConfig , iIndex ; if ( bRemove ) { if ( ! oTargetConfig ) { return ; } iIndex = oTargetConfig . listeners . indexOf ( oListener ) ; if ( iIndex >= 0 ) { oCurrentConfig = oTargetConfig . configurations [ iIndex ] ; } } else { if ( ! oTargetConfig ) { oTargetConfig = mTargets [ sId ] = { listeners : [ ] , configurations : [ ] , object : oTarget } ; } iIndex = oTargetConfig . listeners . indexOf ( oListener ) ; if ( iIndex === - 1 ) { oTargetConfig . listeners . push ( oListener ) ; oTargetConfig . configurations . push ( oConfiguration ) ; } else { oCurrentConfig = oTargetConfig . configurations [ iIndex ] ; } } if ( oCurrentConfig ) { oCurrentConfig . properties = oCurrentConfig . properties || [ ] ; updateSingleArray ( oCurrentConfig . properties , oConfiguration . properties , bRemove ) ; oCurrentConfig . aggregations = oCurrentConfig . aggregations || [ ] ; updateSingleArray ( oCurrentConfig . aggregations , oConfiguration . aggregations , bRemove ) ; oCurrentConfig . associations = oCurrentConfig . associations || [ ] ; updateSingleArray ( oCurrentConfig . associations , oConfiguration . associations , bRemove ) ; oCurrentConfig . bindings = oCurrentConfig . bindings || [ ] ; updateSingleArray ( oCurrentConfig . bindings , oConfiguration . bindings , bRemove ) ; oCurrentConfig . events = oCurrentConfig . events || [ ] ; updateSingleArray ( oCurrentConfig . events , oConfiguration . events , bRemove ) ; if ( oConfiguration . destroy != null ) { if ( bRemove ) { delete oCurrentConfig . destroy ; } else { oCurrentConfig . destroy = oConfiguration . destroy ; } } if ( oConfiguration . parent != null ) { if ( bRemove ) { delete oCurrentConfig . parent ; } else { oCurrentConfig . parent = oConfiguration . parent ; } } } var bEventsObserved = hasObserverFor ( oTarget , "events" ) ; if ( oTarget . _observer && bRemove ) { if ( ! bEventsObserved && EventProvider . hasListener ( oTarget , "EventHandlerChange" , fnHandleEventChange ) ) { oTarget . detachEvent ( "EventHandlerChange" , fnHandleEventChange ) ; } if ( ! bEventsObserved && ! hasObserverFor ( oTarget , "properties" ) && ! hasObserverFor ( oTarget , "aggregations" ) && ! hasObserverFor ( oTarget , "associations" ) && ! hasObserverFor ( oTarget , "destroy" ) && ! hasObserverFor ( oTarget , "parent" ) && ! hasObserverFor ( oTarget , "bindings" ) ) { delete oTarget . _observer ; delete mTargets [ sId ] ; } } else if ( ! oTarget . _observer && ! bRemove ) { if ( bEventsObserved && ! EventProvider . hasListener ( oTarget , "EventHandlerChange" , fnHandleEventChange ) ) { oTarget . attachEvent ( "EventHandlerChange" , fnHandleEventChange ) ; } oTarget . _observer = Observer ; } }
update a complete configuration, create one if needed or remove it
update a complete configuration create one if needed or remove it
// no registration so far, nothing to remove // already registered, update the configuration // not registered, push listener and configuration //delete oTarget._observer; //is any config listening to events