It does not requiere hibernate... I will build an example... better than
empty talk.


On Tue, May 6, 2014 at 3:59 PM, Richard W. Adams <rwada...@up.com> wrote:

> Well for starters, the example seems to require Hibernate (which our
> organization doesn't allow us to use). This correct?
>
> Second, I don't have the flexibility implement a service. I have to send
> Javascript back to the client, and the corporate Javascript framework then
> renders the progress bar.
>
> What is the 'context' class you refer to? Where is it instantiated and
> where is it stored?
>
>
>
>
> From:   Ernesto Reinaldo Barreiro <reier...@gmail.com>
> To:     "users@wicket.apache.org" <users@wicket.apache.org>
> Date:   05/06/2014 07:52 AM
> Subject:        Re: Background Threading
>
>
>
> Hi,
>
>
> On Tue, May 6, 2014 at 2:11 PM, Richard W. Adams <rwada...@up.com> wrote:
>
> > Interesting approach. Our use case is more complex, as it runs a
> > background task in a separate thread. Our task has three basic
> > requirements. It must:
> >
> > 1. Be cancellable.
> >
> > 2. Report its outcome (success/failure/warning).
> >
> > 3. Report incremental progress.
> >
> > Our fundamental problem is not how to display the progress bar, it's how
> > to determine the outcome of the background thread. That's an
> unexpectedly
> > a tough nut to crack. The vast majority of examples we've seen use the
> > Runnable interface (which doesn't help us, as it can't be canceled or
> > return a value), rather than Callable interface (which meets our needs,
> > but doesn't seem to play well with Wicket)
> >
>
> Really? Is it that hard?
>
> 1-Create a "context" class to pass information to/from WEB
> threads/background thread.
> 2-Both threads keep a copy of it: so you can report progress, cancel
> generation and so on.
>
> I have implemented something like that ages ago
>
> https://code.google.com/p/antilia/wiki/OSGiPowered
>
>
>
> >
> >
> >
> >
> > From:   Colin Rogers <colin.rog...@objectconsulting.com.au>
> > To:     "users@wicket.apache.org" <users@wicket.apache.org>
> > Date:   05/05/2014 08:14 PM
> > Subject:        RE: Progress Bar
> >
> >
> >
> > There is a pretty nifty, jquery based progress bar, in wicket-jquery-ui
> > library...
> >
> >
> http://www.7thweb.net/wicket-jquery-ui/progressbar/DefaultProgressBarPage
> >
> > Cheers,
> > Col.
> >
> > -----Original Message-----
> > From: Richard W. Adams [mailto:rwada...@up.com]
> > Sent: Tuesday, 6 May 2014 3:19 AM
> > To: users@wicket.apache.org
> > Subject: Progress Bar
> >
> > We have a requirement to implement a progress bar for long-running
> server
> > operations. We can't use the code at
> > https://github.com/wicketstuff/core/wiki/Progressbar, because it doesn't
> > meet our corporate user interface look-and-feel standards.
> >
> > So, we started our own implementation. Our test page contains these
> > methods below (the TestExecutor below class implements
> > Callable<ExecutorResult>).
> >
> >
> >
>
> //----------------------------------------------------------------------------------------------
> > private Component createButton() {
> >         return new AjaxButton("start-button") {
> >                 private static final long serialVersionUID = -1;
> >
> >                 @Override protected void onSubmit(final
> AjaxRequestTarget
> > ajax, final Form<?> form) {
> >
> >                         final ExecutorService service = Executors.
> > newSingleThreadExecutor();
> >                         try {
> >                                 final ProgressBarTestPage page =
> > ProgressBarTestPage.this;
> >                                 final TransactionData data = new
> > TransactionData (page.getId(), false);
> >                                 final TestExecutor executor = new
> > TestExecutor(data, getPermissions());
> >
> >                                 executor.addListener(page);     //
> Request
> > notification when done
> >                                 future = service.submit(executor); //
> > Begin execution
> >                                 progressBarUpdater.start(ajax,
> executor);
> > // Start polling for progress
> >
> >                         } catch (final Exception ex) {
> >                                 throw new RuntimeException(ex);
> >                         }
> >                         service.shutdown();     // Terminate gracefully
> > (VM probably
> >                 }               //      won't exit if we fail to do
> this)
> >         };
> > }
> >
> >
>
> //----------------------------------------------------------------------------------------------
> > /**
> >    Observer Pattern method to let us know when the task is done so we
> can
> > check how things went.
> > */
> > @Override public void executionComplete(final EnmCallableExecutor
> > executor) {
> >
> >         try {
> >                 if (!future.isCancelled()) { //
> > Unless execution was canceled
> >                         final ExecutorResult result = future.get(); //
> > Get the outcome
> >                         System.out.println(result);
> >                         /*
> >                          * TODO: Show success or error message
> >                          */
> >                 }
> >         } catch (final Exception ex) {
> >                 ex.printStackTrace();
> >         }
> > }
> >
> > The ProgessBarUpdater class has this method:
> >
> >
> >
>
> //----------------------------------------------------------------------------------------------
> > /**
> >  * Displays the progress bar &amp; begins the polling. We don't start
> the
> > polling until
> >  * explicitly told to do, for efficiency purposes.
> >  * @param ajax The Ajax request wrapper.
> >  * @param reporter The object to query for progress data.
> >  */
> > public void start(final AjaxRequestTarget ajax, final ProgressReporter
> > reporter) {
> >
> >         add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(2)) {
> >                 private static final long serialVersionUID = 1L;
> >
> >                 @Override protected void onPostProcessTarget(final
> > AjaxRequestTarget ajax) {
> >
> >                         final Progress progress =
> reporter.getProgress();
> >                         final String script =                   // Build
> > script to update
> >                                 ProgressScript.build(progress);  //
> > progress bar
> >                         ajax.appendJavascript(script);
> >                         if (progress == null) {                 // If
> > operation is finished
> >                                 final ProgressBarUpdater updater =
> >                                         ProgressBarUpdater.this;
> >                                 updater.remove(this); //
> > Stop timer to prevent
> >                                 ajax.addComponent(updater);  //
> pointless
> > polling
> >                         }
> >                 }
> >         });
> >         ajax.addComponent(this);
> > }
> >
> > The page also contains a Future object so we can check the result after
> > the thread finishes:
> >
> >         private Future<ExecutorResult> future;
> >
> > __________________________________________
> >
> > Having said all that, here's the problem: When I click the page's
> button,
> > Wicket throws this error:
> >
> >         Unable to serialize class: java.util.concurrent.FutureTask
> >
> > The FutureTask object, I believe, is coming from the service.submit call
> > whose return value we store in our Future variable.
> >
> > Does anyone know how to get around this roadblock?
> >
> >
> >
> > **
> >
> > This email and any attachments may contain information that is
> > confidential and/or privileged for the sole use of the intended
> recipient.
> >  Any use, review, disclosure, copying, distribution or reliance by
> others,
> > and any forwarding of this email or its contents, without the express
> > permission of the sender is strictly prohibited by law.  If you are not
> > the intended recipient, please contact the sender immediately, delete
> the
> > e-mail and destroy all copies.
> > **
> > EMAIL DISCLAIMER This email message and its attachments are confidential
> > and may also contain copyright or privileged material. If you are not
> the
> > intended recipient, you may not forward the email or disclose or use the
> > information contained in it. If you have received this email message in
> > error, please advise the sender immediately by replying to this email
> and
> > delete the message and any associated attachments. Any views, opinions,
> > conclusions, advice or statements expressed in this email message are
> > those of the individual sender and should not be relied upon as the
> > considered view, opinion, conclusions, advice or statement of this
> company
> > except where the sender expressly, and with authority, states them to be
> > the considered view, opinion, conclusions, advice or statement of this
> > company. Every care is taken but we recommend that you scan any
> > attachments for viruses.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
> >
> >
> > **
> >
> > This email and any attachments may contain information that is
> > confidential and/or privileged for the sole use of the intended
> recipient.
> >  Any use, review, disclosure, copying, distribution or reliance by
> others,
> > and any forwarding of this email or its contents, without the express
> > permission of the sender is strictly prohibited by law.  If you are not
> the
> > intended recipient, please contact the sender immediately, delete the
> > e-mail and destroy all copies.
> > **
> >
>
>
>
> --
> Regards - Ernesto Reinaldo Barreiro
>
>
>
> **
>
> This email and any attachments may contain information that is
> confidential and/or privileged for the sole use of the intended recipient.
>  Any use, review, disclosure, copying, distribution or reliance by others,
> and any forwarding of this email or its contents, without the express
> permission of the sender is strictly prohibited by law.  If you are not the
> intended recipient, please contact the sender immediately, delete the
> e-mail and destroy all copies.
> **
>



-- 
Regards - Ernesto Reinaldo Barreiro

Reply via email to