I found a way, if anybody needs it:

...
final ProgressBar bar = new ProgressBar("progress2", progressionModel) {
           @Override
           protected void onFinished(AjaxRequestTarget target) {
               ITaskService taskService = getTaskService();
               Long taskId = progressionModel.getTaskId();

               int errors = 0;
               int warns = 0;

               for (Message m : taskService.getMessages(taskId)) {
                   switch (m.severity) {
                   case INFO:
                       getSession().info(m.messageKey);
                       break;
                   case WARN:
                       warns++;
                       getSession().warn(m.messageKey);
                       break;
                   case ERROR:
                       errors++;
                       getSession().error(m.messageKey);
                       break;
                   }
               }

               if (target != null) {
                   if (errors == 0) {
                       if (warns == 0) {
target.appendJavascript("alert('Task done!\\nTâche terminée!\\nArbeit fertig!')");
                       } else {
target.appendJavascript("alert('Task done, with " + warns + " warnings!\\nTâche terminée, avec " + warns + " warnings!\\nArbeit fertig, mit " + warns + " warnings!')");
                       }
                   } else {
target.appendJavascript("alert('Warning! There was " + errors + " error(s)!\\nAttention! Il y a eu " + errors + " erreur(s)!\\nAchtung! Es ist " + errors + " Fehler(n)!')");
                   }
               }
               taskService.finish(taskId);
               setVisible(false);
           }
...


Works well ;)


Piller Sébastien a écrit :
Hello,

I'm using wicketstuff-progressbar and it works very well (great job Christopher!). I was wondering how I can add feedbacks messages to the process (I need to display some warning informations when some work has been done but not completely).

I tried both /Task#warn/ and /Session#warn/. /Task#warn/ doesn't work (my feedback panel stays empty, even when I try to refresh it with /AjaxRequestTarget#addComponent/), and Session#warn throw an exception (/IllegalStateException, you can only locate or create sessions in the context of a request cycle/)

I've searched the doc and the example, but couldn't find any example of this feature.

Any clue?

Thank you ;)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to