Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve support for OGNL expressions in AjaxUpdateTrigger #674

Merged
merged 1 commit into from
Sep 10, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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