Search in sources :

Example 6 with WOActionResults

use of com.webobjects.appserver.WOActionResults in project wonder-slim by undur.

the class AjaxModalDialog method invokeAction.

/**
 * Only handle this phase if the modal box is open or it is our action (opening the box).
 * Overridden to include result returned by action binding if bound.
 *
 * @see #close(WOContext)
 * @see #update(WOContext, String)
 * @see com.webobjects.appserver.WOComponent#takeValuesFromRequest(com.webobjects.appserver.WORequest, com.webobjects.appserver.WOContext)
 */
@Override
public WOActionResults invokeAction(WORequest request, WOContext context) {
    ajaxComponentActionUrl = AjaxUtils.ajaxComponentActionUrl(context());
    pushDialog();
    try {
        WOActionResults result = null;
        if (shouldHandleRequest(request, context)) {
            result = super.invokeAction(request, context);
        } else if (isOpen()) {
            if (_actionResults != null) {
                pushActionResultsIntoContext(context);
                try {
                    result = _actionResults.invokeAction(request, context);
                } finally {
                    popActionResultsFromContext(context);
                }
            } else {
                result = super.invokeAction(request, context);
            }
        }
        setCurrentDialogInPageIfNecessary(result, request, context);
        return result;
    } finally {
        popDialog();
    }
}
Also used : WOActionResults(com.webobjects.appserver.WOActionResults)

Example 7 with WOActionResults

use of com.webobjects.appserver.WOActionResults in project wonder-slim by undur.

the class AjaxDroppable method handleRequest.

@Override
public WOActionResults handleRequest(WORequest request, WOContext context) {
    AjaxUpdateContainer.setUpdateContainerID(request, (String) valueForBinding("updateContainerID"));
    String droppedDraggableID = request.stringFormValueForKey(_draggableIDKeyName);
    if (canSetValueForBinding("droppedDraggableID")) {
        setValueForBinding(droppedDraggableID, "droppedDraggableID");
    }
    if (canSetValueForBinding("droppedObject")) {
        WOComponent page = context.page();
        Object droppedObject = AjaxDraggable.draggableObjectForPage(page, droppedDraggableID);
        setValueForBinding(droppedObject, "droppedObject");
    }
    if (canGetValueForBinding("action")) {
        WOActionResults results = (WOActionResults) valueForBinding("action");
        if (results != null) {
            System.out.println("AjaxDroppable.handleRequest: Not quite sure what to do with non-null results yet ...");
        }
    }
    return null;
}
Also used : WOActionResults(com.webobjects.appserver.WOActionResults) WOComponent(com.webobjects.appserver.WOComponent)

Example 8 with WOActionResults

use of com.webobjects.appserver.WOActionResults in project wonder-slim by undur.

the class AjaxDynamicElement method invokeAction.

/**
 * Execute the request, if it's coming from our action, then invoke the ajax handler and put the key
 * <code>AJAX_REQUEST_KEY</code> in the request userInfo dictionary (<code>request.userInfo()</code>).
 *
 * @param request the current request
 * @param context context of the transaction
 * @return the action results
 */
@Override
public WOActionResults invokeAction(WORequest request, WOContext context) {
    WOActionResults result = null;
    if (shouldHandleRequest(request, context)) {
        result = handleRequest(request, context);
        ERXAjaxApplication.enableShouldNotStorePage();
        if (ERXAjaxApplication.shouldIgnoreResults(request, context, result)) {
            log.warn("An Ajax request attempted to return the page, which is almost certainly an error.");
            result = null;
        }
        if (result == null && !ERXAjaxApplication.isAjaxReplacement(request)) {
            result = AjaxUtils.createResponse(request, context);
        }
    } else if (hasChildrenElements()) {
        result = super.invokeAction(request, context);
    }
    return result;
}
Also used : WOActionResults(com.webobjects.appserver.WOActionResults)

Example 9 with WOActionResults

use of com.webobjects.appserver.WOActionResults in project wonder-slim by undur.

the class AjaxUpdateContainer method invokeAction.

@Override
public WOActionResults invokeAction(WORequest request, WOContext context) {
    WOActionResults results;
    if (shouldRenderContainer(context.component())) {
        String previousUpdateContainerID = AjaxUpdateContainer.currentUpdateContainerID();
        try {
            AjaxUpdateContainer.setCurrentUpdateContainerID(_containerID(context));
            results = super.invokeAction(request, context);
        } finally {
            AjaxUpdateContainer.setCurrentUpdateContainerID(previousUpdateContainerID);
        }
    } else {
        results = super.invokeAction(request, context);
    }
    return results;
}
Also used : WOActionResults(com.webobjects.appserver.WOActionResults)

Example 10 with WOActionResults

use of com.webobjects.appserver.WOActionResults in project wonder-slim by undur.

the class AjaxUpdateContainer method handleRequest.

@Override
public WOActionResults handleRequest(WORequest request, WOContext context) {
    WOComponent component = context.component();
    String id = _containerID(context);
    if (associations().objectForKey("action") != null) {
        @SuppressWarnings("unused") WOActionResults results = (WOActionResults) valueForBinding("action", component);
    // ignore results
    }
    WOResponse response = AjaxUtils.createResponse(request, context);
    AjaxUtils.setPageReplacementCacheKey(context, id);
    if (hasChildrenElements()) {
        appendChildrenToResponse(response, context);
    }
    String onRefreshComplete = (String) valueForBinding("onRefreshComplete", component);
    if (onRefreshComplete != null) {
        AjaxUtils.appendScriptHeader(response);
        response.appendContentString(onRefreshComplete);
        AjaxUtils.appendScriptFooter(response);
    }
    if (AjaxModalDialog.isInDialog(context)) {
        AjaxUtils.appendScriptHeader(response);
        response.appendContentString("AMD.contentUpdated();");
        AjaxUtils.appendScriptFooter(response);
    }
    return null;
}
Also used : WOActionResults(com.webobjects.appserver.WOActionResults) WOComponent(com.webobjects.appserver.WOComponent) WOResponse(com.webobjects.appserver.WOResponse)

Aggregations

WOActionResults (com.webobjects.appserver.WOActionResults)31 WOComponent (com.webobjects.appserver.WOComponent)11 WOResponse (com.webobjects.appserver.WOResponse)6 WOElement (com.webobjects.appserver.WOElement)2 WOApplication (com.webobjects.appserver.WOApplication)1 WOContext (com.webobjects.appserver.WOContext)1 WORequest (com.webobjects.appserver.WORequest)1 WOForm (com.webobjects.appserver._private.WOForm)1 WONoContentElement (com.webobjects.appserver._private.WONoContentElement)1 NSArray (com.webobjects.foundation.NSArray)1 NSData (com.webobjects.foundation.NSData)1 NSMutableArray (com.webobjects.foundation.NSMutableArray)1 NSMutableDictionary (com.webobjects.foundation.NSMutableDictionary)1 NSRange (com.webobjects.foundation.NSRange)1 ERXWOContext (er.extensions.appserver.ERXWOContext)1 ERXWOForm (er.extensions.components._private.ERXWOForm)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1