Skip to content

Commit

Permalink
Merge pull request #674 from hprange/ajaxUpdateTriggerGeneralization
Browse files Browse the repository at this point in the history
Improve support for OGNL expressions in AjaxUpdateTrigger
  • Loading branch information
hprange committed Sep 10, 2015
2 parents e3a6b7e + e3ba807 commit 9efe29e
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions Frameworks/Ajax/Ajax/Sources/er/ajax/AjaxUpdateTrigger.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package er.ajax;

import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;

import com.webobjects.appserver.WOAssociation;
import com.webobjects.appserver.WOComponent;
import com.webobjects.appserver.WOContext;
import com.webobjects.appserver.WODynamicElement;
import com.webobjects.appserver.WOElement;
import com.webobjects.appserver.WOResponse;
import com.webobjects.foundation.NSArray;
import com.webobjects.foundation.NSDictionary;
import com.webobjects.foundation.NSMutableArray;

import er.extensions.components.ERXComponentUtilities;

Expand Down Expand Up @@ -45,12 +44,12 @@ public AjaxUpdateTrigger(String name, NSDictionary associations, WOElement templ
public void appendToResponse(WOResponse response, WOContext context) {
super.appendToResponse(response, context);
WOComponent component = context.component();
NSArray updateContainerIDs = (NSArray) _updateContainerIDs.valueInComponent(component);
if (updateContainerIDs != null && updateContainerIDs.count() > 0) {
List<String> updateContainerIDs = (List<String>) _updateContainerIDs.valueInComponent(component);
if (updateContainerIDs != null && updateContainerIDs.size() > 0) {
AjaxUtils.appendScriptHeader(response);
Enumeration updateContainerIDEnum = updateContainerIDs.objectEnumerator();
while (updateContainerIDEnum.hasMoreElements()) {
String updateContainerID = (String) updateContainerIDEnum.nextElement();
Iterator<String> updateContainerIDEnum = updateContainerIDs.iterator();
while (updateContainerIDEnum.hasNext()) {
String updateContainerID = updateContainerIDEnum.next();
// PROTOTYPE FUNCTIONS
Object evalScripts = ERXComponentUtilities.valueForBinding("evalScripts", "true", _associations, component);
response.appendContentString("if ($wi('" + updateContainerID + "')) { ");
Expand All @@ -60,7 +59,7 @@ public void appendToResponse(WOResponse response, WOContext context) {
AjaxUtils.appendScriptFooter(response);

if (_resetAfterUpdate != null && _resetAfterUpdate.booleanValueInComponent(component)) {
((NSMutableArray) updateContainerIDs).removeAllObjects();
updateContainerIDs.clear();
}
}
}
Expand Down

0 comments on commit 9efe29e

Please sign in to comment.