public NSDictionary<String, NSArray<String>> propertyDependencies(D2WContext context) { NSDictionary<String, NSArray<String>> propertyDependencies = PROPERTY_DEPENDENCIES .valueInObject(context); return propertyDependencies; }
/** * Checks whether the current property is declared as to be observed via the * propertyDependencies key. * * @return true if the current property key is to be observed */ public Object shouldObserve(D2WContext context) { boolean shouldObserve = false; NSDictionary<String, NSArray<String>> propertyDependencies = ERMDAjaxNotificationCenter.PROPERTY_DEPENDENCIES .valueInObject(context); if (propertyDependencies != null && propertyDependencies.containsKey(context.propertyKey())) { shouldObserve = true; } return shouldObserve; }
/** * @param context * The d2wContext of the changed property level component * @return a list of property keys to be updated */ @SuppressWarnings("unchecked") public NSArray<String> propertyChanged(D2WContext context) { String prop = context.propertyKey(); NSArray<String> dependants = NSArray.EmptyArray; NSDictionary<String, NSArray<String>> propertyDependencies = PROPERTY_DEPENDENCIES .valueInObject(context); if (propertyDependencies.containsKey(prop)) { dependants = (NSArray<String>) propertyDependencies.valueForKey(prop); } return dependants; }
/** * Checks whether the current property is declared dependent via the * propertyDependencies key. * * @return true if the current property is dependent */ public Object isDependent(D2WContext context) { boolean isDependent = false; NSDictionary<String, NSArray<String>> propertyDependencies = ERMDAjaxNotificationCenter.PROPERTY_DEPENDENCIES .valueInObject(context); if (propertyDependencies != null) { if (ERXArrayUtilities.flatten(propertyDependencies.allValues()).contains( context.propertyKey())) { isDependent = true; } } return isDependent; }
public void propertyChanged(NSNotification n) { log.debug("Property changed for property key: {}", PROPERTY_KEY.valueInObject(n.object())); NSArray<String> updateProps = propertyChanged((D2WContext) n.object()); if (updateProps != null && updateProps.count() > 0) { refreshRelationships(updateProps); // collect the corresponding update container IDs NSMutableArray<String> attributeLineUCs = new NSMutableArray<String>(); D2WContext c = (D2WContext) n.object(); String pageConfiguration = (String) c.valueForKey("pageConfiguration"); for (String aPropertyName : updateProps) { String lineUC = pageConfiguration; lineUC = lineUC.concat(ERXStringUtilities.capitalize(aPropertyName)); lineUC = lineUC.concat("LineUC"); attributeLineUCs.addObject(lineUC); } ERXArrayUtilities.addObjectsFromArrayWithoutDuplicates(updateContainerIDs, attributeLineUCs); // force update of notification center UC AjaxUpdateContainer.safeUpdateContainerWithID(id, context()); log.debug("Container ids to be updated: {}", updateContainerIDs.componentsJoinedByString(", ")); } }