Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Canceling a processing request (Busy handler custom implementation?)(How to allow the user to cancel a request that is currently processing.)
Canceling a processing request (Busy handler custom implementation?) [message #1212135] Tue, 26 November 2013 14:36 Go to next message
Kathlyn Heilman is currently offline Kathlyn Heilman
Messages: 2
Registered: November 2013
Junior Member
How do I allow the user to cancel the processing of a request in RAP/SWT? We are using RAP and currently the form will display "Processing request. Click here to cancel". When I click there the only thing that happens is that area gets grayed out.

Will writing a custom implementation of the busy handler solve this? If so is there an example of how to do this?
Re: Canceling a processing request (Busy handler custom implementation?) [message #1219818 is a reply to message #1212135] Thu, 05 December 2013 18:33 Go to previous message
Lukas Huser is currently offline Lukas Huser
Messages: 41
Registered: March 2010
Member
Hi Kathlyn

You probably won't need to implement your own busy handler for RAP. But you could try to honor the user's cancel request in a more timely fashion.
When a user cancels the current request, the following will happen:
a) the current client job (i.e. the current ClientSyncJob) is cancelled. Cancelling a job does not have any effect by itself, unless the job checks for the cancel flag and reacts in a reasonable way.
b) by default, Scout reacts as follows when the current client job is cancelled: if the client is waiting for the response of a remote service call from the server, it will send a cancel request to the server. The server will then cancel the current transaction (see ITransaction) which is associated with the current client request. The client immediately returns from the remote call (without returning any content/result).

From your description I guess that you are possibly performing some lenghty operation in the client model (i.e. any code in the different exec* methods in the client). In this case you could try to make your code more responsive to the cancel request by regularily checking whether the current job has been cancelled (through a call to the static method ClientJob.isCurrentJobCancelled()) and reacting accordingly.
Or you could try to do the computation asynchronously in the background and only report the result back to the UI (this could also be a reasonable approach if you are loading some large amount of data in a form or similar). You could adapt the code sample of the "polling" approach described by Beat in this post.

If your situation is totally different from what I assumed here, feel free to ask some more detailed questions.

Lukas
Previous Topic:Init before login dialog box
Next Topic:CalendarField item selection notification
Goto Forum:
  


Current Time: Thu Aug 21 20:11:17 EDT 2014

Powered by FUDForum. Page generated in 0.02090 seconds