public class CCAjaxLongResponsePage extends 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
WOComponent._EventLoggingEnabler, WOComponent.Event
NSKeyValueCodingAdditions.DefaultImplementation, NSKeyValueCodingAdditions.Utility
NSKeyValueCoding._BooleanFieldBinding, NSKeyValueCoding._BooleanMethodBinding, NSKeyValueCoding._FieldBinding, NSKeyValueCoding._ForwardingBinding, NSKeyValueCoding._KeyBinding, NSKeyValueCoding._KeyBindingCreation, NSKeyValueCoding._MethodBinding, NSKeyValueCoding._NumberFieldBinding, NSKeyValueCoding._NumberMethodBinding, NSKeyValueCoding._ReflectionKeyBindingCreation, NSKeyValueCoding.ErrorHandling, NSKeyValueCoding.MapImplementation, NSKeyValueCoding.Null<T>, NSKeyValueCoding.UnknownKeyException, NSKeyValueCoding.ValueAccessor
NSValidation._MethodBinding, NSValidation._ValidationBinding, NSValidation.DefaultImplementation, NSValidation.Utility, NSValidation.ValidationException
_Extension, _IsEventLoggingEnabled, _keyAssociations
_CLASS
_CLASS, _KeyPathSeparatorChar, KeyPathSeparator
NullValue
_CLASS
Constructor and Description |
---|
CCAjaxLongResponsePage(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(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 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 WOActionResults stopTask()
IERXStoppable
. If the task is not
stoppable, this action has no effect.public boolean wasStoppedByUser()
public boolean stayOnLongResponsePageIndefinitely()
Copyright © 2002 – 2024 Project Wonder.