public class CCAjaxLongResponsePage
extends com.webobjects.appserver.WOComponent
The common case of running a task and automatically returning to the same originating page is really simple and requires just a few lines of code, for example:
public WOActionResults runLongTask() {
Runnable task = new LongRunningTask();
CCAjaxLongResponsePage nextPage = pageWithName(CCAjaxLongResponsePage.class);
nextPage.setLongRunningRunnable(task);
return nextPage;
}
Runnable
task, or a Callable
task, that returns some result.
IERXStatus
interface (just one method to return status message)
to have the task's status displayed in the long response page.
IERXPercentComplete
interface (just one method to return percentage complete)
to have a progress bar and a percentage complete automatically displayed in the long response page.
IERXStoppable
interface to allow stopping of the task by the user.
IERXPerformWOActionForResult
interface, or use ERXNextPageForResultWOAction
, which
provides a fairly generic implementation of that interface
IERXPerformWOAction.performAction()
.
setTask(Object)
setNextPageForResultController(IERXPerformWOActionForResult)
This long response page can be easily customized using a custom CSS style sheet and a few system properties.
You can create a custom CSS style sheet, place it in any framework (or your app) and set the following two properties to have it used instead of the default CSS style-sheet:
er.coolcomponents.CCAjaxLongResponsePage.stylesheet.framework
er.coolcomponents.CCAjaxLongResponsePage.stylesheet.filename
er.coolcomponents.CCAjaxLongResponsePage.stayOnLongResponsePageIndefinitely
true
to prevent ajax refresh on the long response page and to keep the page open indefinitely
even after the task has completed. The property is ignored in deployment mode.
The following properties can be used to implement additional custom behavior:
er.coolcomponents.CCAjaxLongResponsePage.defaultStatus
IERXStatus
er.coolcomponents.CCAjaxLongResponsePage.refreshInterval
er.coolcomponents.CCAjaxLongResponsePage.nextPageForErrorResultControllerClassName
com.webobjects.appserver.WOComponent._EventLoggingEnabler, com.webobjects.appserver.WOComponent.Event
com.webobjects.foundation.NSKeyValueCodingAdditions.DefaultImplementation, com.webobjects.foundation.NSKeyValueCodingAdditions.Utility
com.webobjects.foundation.NSKeyValueCoding._BooleanFieldBinding, com.webobjects.foundation.NSKeyValueCoding._BooleanMethodBinding, com.webobjects.foundation.NSKeyValueCoding._FieldBinding, com.webobjects.foundation.NSKeyValueCoding._ForwardingBinding, com.webobjects.foundation.NSKeyValueCoding._KeyBinding, com.webobjects.foundation.NSKeyValueCoding._KeyBindingCreation, com.webobjects.foundation.NSKeyValueCoding._MethodBinding, com.webobjects.foundation.NSKeyValueCoding._NumberFieldBinding, com.webobjects.foundation.NSKeyValueCoding._NumberMethodBinding, com.webobjects.foundation.NSKeyValueCoding._ReflectionKeyBindingCreation, com.webobjects.foundation.NSKeyValueCoding.ErrorHandling, com.webobjects.foundation.NSKeyValueCoding.MapImplementation, com.webobjects.foundation.NSKeyValueCoding.Null<T>, com.webobjects.foundation.NSKeyValueCoding.UnknownKeyException, com.webobjects.foundation.NSKeyValueCoding.ValueAccessor
com.webobjects.foundation.NSValidation._MethodBinding, com.webobjects.foundation.NSValidation._ValidationBinding, com.webobjects.foundation.NSValidation.DefaultImplementation, com.webobjects.foundation.NSValidation.Utility, com.webobjects.foundation.NSValidation.ValidationException
_Extension, _IsEventLoggingEnabled, _keyAssociations
Constructor and Description |
---|
CCAjaxLongResponsePage(com.webobjects.appserver.WOContext context) |
__valueForBinding, _associationWithName, _awakeInContext, _childTemplate, _cleanUpStatelessComponent, _componentDefinition, _componentUnroll, _isPage, _setContext, _setIsPage, _setParent, _setSubcomponent, _sleepInContext, _subcomponentForElementWithID, _templateNameForClass, _unroll, appendToResponse, application, awake, baseURL, bindingKeys, canAccessFieldsDirectly, canGetValueForBinding, canSetValueForBinding, clone, context, debugString, descriptionForResponse, ensureAwakeInContext, frameworkName, generateResponse, handleQueryWithUnboundKey, handleTakeValueForUnboundKey, hasBinding, hasSession, invokeAction, isCachingEnabled, isEventLoggingEnabled, isStateless, logString, name, pageWithName, parent, path, pathURL, performParentAction, pullValuesFromParent, pushValuesToParent, reset, session, set_componentUnroll, set_unroll, setCachingEnabled, setValueForBinding, setVariableValueForName, sleep, synchronizesVariablesWithBindings, takeValueForKey, takeValueForKeyPath, takeValuesFromRequest, template, templateWithHTMLString, templateWithHTMLString, templateWithHTMLString, templateWithName, toString, unableToSetNullForKey, validateTakeValueForKeyPath, validateValueForKey, validationFailedWithException, valueForBinding, valueForBooleanBinding, valueForIntegerBinding, valueForKey, valueForKeyPath, valueForNSArrayBindings, valueForNSDictionaryBindings, valueForNumberBinding, valueForStringBinding, variableValueForName, variableWithName
public CCAjaxLongResponsePage(com.webobjects.appserver.WOContext context)
public IERXPerformWOActionForResult nextPageForResultController()
public void setNextPageForResultController(IERXPerformWOActionForResult nextPageForResultController)
nextPageForResultController
- the page controller that will be given the result of the long task and
return the next page except for the case where the user stops the task.public IERXPerformWOAction nextPageForCancelController()
public void setNextPageForCancelController(IERXPerformWOAction nextPageForCancelController)
nextPageForCancelController
- the controller that handles the scenario where the user stops a stoppable taskpublic IERXPerformWOActionForResult nextPageForErrorController()
public void setNextPageForErrorController(IERXPerformWOActionForResult nextPageForErrorController)
public Object task()
public void setTask(Object task)
task
- the Runnable and/or Callable taskpublic String defaultStatus()
public void setDefaultStatus(String defaultStatus)
defaultStatus
- a status message that is displayed if the task does not provide a status messagepublic Integer refreshInterval()
public void setRefreshInterval(Integer refreshInterval)
refreshInterval
- the refresh interval in seconds. Defaults to value of er.coolcomponents.CCAjaxLongResponsePage.refreshInterval or 2 seconds.public ERXFutureTask<?> future()
Future
that is bound to the long running task.
The first time this method is accessed, it is lazily initialized and
it starts the long running task.public com.webobjects.appserver.WOActionResults nextPage()
public Object result()
public String elapsedTime()
public ERXStopWatch stopWatch()
public String controlScriptContent()
public String finishedPercentage()
public boolean hideUnfinishedProgressTableCell()
public boolean isDebugMode()
public String styleSheetFramework()
public String styleSheetFilename()
public com.webobjects.appserver.WOActionResults stopTask()
IERXStoppable
. If the task is not
stoppable, this action has no effect.public boolean wasStoppedByUser()
public boolean stayOnLongResponsePageIndefinitely()
Copyright © 2002 – 2020 Project Wonder.