Re: JQuery progressbar

2015-05-04 Thread Sebastien
Hi Chris,


I am using a heuristic for an optimization problem and this takes about
 5-10 seconds.
 So it might be a good idea to use a future task to run this service, which
 receives the data (list of object) in the end.
 In the beginning, I would like to initialize the model with an empty list
 so that the page is displayed fast, and in parallel execute a future task;
 as soon as the service has some results, exchanging the model against the
 data returned.

 I have looked at the example described here:
 https://gist.github.com/jonnywray/636875 
 https://gist.github.com/jonnywray/636875

 The future is called correctly, but how can the component/panel be updated
 via the onPostSuccess(AjaxRequestTarget target) method?


target.add(yourPanel) ?
Caution: it will call model#getObject. Given your explanation I don't think
your model is a LDM. Just be aware...


 By the way, what is the difference when setting the model via constructor
 (e.g. new Panel(id, model)) or via setDefaultModel method?


There should no be differences. However, if you change the model object
dynamically/afterward, you have to use #set[Default]ModelObject instead of
#set[Default]Model.


 With the first, the default model is still null.


No sure to follow here, because you said you initialized the model with an
empty list... So neither the model and the modelobject should be null...



 Thanks, Chris





Re: Could not clear select2Choice component model value.

2015-05-04 Thread Tom Götz
Done: https://github.com/wicketstuff/core/pull/402

Cheers,
   -Tom



 On 30.04.2015, at 09:31, Martin Grigorov mgrigo...@apache.org wrote:
 
 Hi Tom,
 
 Please send a PR with your suggested changes/improvements and we will
 discuss them.
 Thanks!
 
 Martin Grigorov
 Wicket Training and Consulting
 https://twitter.com/mtgrigorov
 
 On Thu, Apr 30, 2015 at 10:27 AM, Tom Götz t...@decoded.de wrote:
 
 I found the source of the mentioned changes:
 
 https://github.com/wicketstuff/core/commit/79781d83cf11ac63d2e661328fa7176b93184c64
 
   -Tom
 
 
 On 30.04.2015, at 08:58, Tom Götz t...@decoded.de wrote:
 
 See my inline comments
 
 On 30.04.2015, at 04:29, Maxim Solodovnik solomax...@gmail.com wrote:
 
 
 The changes I have made were (most probably) merged from original Igor's
 code (https://github.com/ivaynberg/wicket-select2)
 
 I can’t find the ListT choices“ property of AbstractSelect2Choice
 anywhere in Igor’s original code, so I don’t know where it should have been
 merged from.
 
 What should be the purpose of having to provide a ChoiceProvider *and* a
 list of choices?! Currently you have to provide both to avoid an exception
 upon construction, which is … weird ;) and breaks existing implementations.
 
 
 1) I believe this is since AbstractSelect2Choice is parent class for for
 Single and Multi choices.
 
 That is so, but what does this explain? ;)
 
 
 2) the code was refactored a bit, so line numbers were changed. This
 constructor:
 
 https://github.com/wicketstuff/core/blob/wicket-6.x/jdk-1.6-parent/select2-parent/select2/src/main/java/org/wicketstuff/select2/AbstractSelect2Choice.java#L109
 seems to not throwing any exceptions
 
 Yeah, but another does. This pattern does not make any sense to me:
 
 class Foo {
 
   public Foo(Object a) {
   this(a, null);
   }
 
   public Foo(Object a, Object b) {
   if (b == null)
   throw new IllegalArgumentException();
   this.a = a;
   this.b = b;
   }
 }
 
 
 3) you can call constructor mentioned in 2 to avoid exception.
 
 …
 
 
 4) I guess renderChoice method is designed to render single choice
 object,
 you can override it (for ex. to add your own properties to each choice)
 other 2 methods are private helpers
 
 renderChoice is called from within renderChoices which is called from
 within renderHead. But only if !isAjax(), and:
 
 public boolean isAjax()
 {
  return provider != null;
 }
 
 …?
 
 That means: if no ChoiceProvider is set, then use the static ListT
 choices, but if you don’t provide a ChoiceProvider in the constructor
 you’ll get an IllegalArgumentException.
 
 This code is broken and doesn’t make any sense *to me*, or I didn’t get
 it yet ;-)
 
 My proposal is:
 
 if nobody can tell which problem should be solved with the introduced
 ListT choices I would revert it to get a working implementation again, as
 it is currently unusable.
 
 Personally, I need to upgrade the select.js library in our project,
 therefor I was looking at wicketstuff-select2, as we still use the original
 wicket-select2 implementation. The current state of it leaves mit three
 options, in order of priority:
 
 a)
 convince the wicketstuff-select2 maintainers to revert the code to a
 working state, which I am currently doing ;-)
 
 b)
 fork wicketstuff-select2 and provide own (working) implementation
 
 c)
 stick with Igor’s original code, which means: no upgrades to select2.js
 
 
 Maybe someone else can shed some light on this?
 
 Cheers,
  -Tom
 
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: JQuery progressbar

2015-05-04 Thread Chris
Hi Sebastian

thanks for the update!

Chris


 Am 05.05.2015 um 01:39 schrieb Sebastien seb...@gmail.com:
 
 Hi Chris,
 
 I just had a brief look at files in the project. At least one thing which
 is wrong:
 https://github.com/cat1000/FutureProgressBar/blob/master/src/main/java/my/company/panels/RoutingListPanel.java#L24
 
 You should not unwrap the model object in a ctor; use the model directly.
 Also for subsequent components, use a model (like a propertymodel)
 That explains why your model object seems to never be updated, actually the
 listview is pointing the the old model object...
 
 I will try to have a deeper look tomorrow...
 
 Best regards,
 Sebastien.
 
 
 On Mon, May 4, 2015 at 9:47 PM, Chris chris...@gmx.at wrote:
 
 Hi Sebastian  all,
 
 I have set up a quick start project (see
 https://github.com/cat1000/FutureProgressBar 
 https://github.com/cat1000/FutureProgressBar).
 Please read the readme.txt file contained in the package pages to get an
 overview over the goals and the open questions.
 
 Basically, I am using a Future-Task to load data from a long-running
 service and in the meantime would like to display the loading progress via
 a progressBar.
 This basically is working.
 
 However, after the loading has finished, the panel is not reloaded.
 
 Thanks a lot for your help!
 
 Chris
 
 
 Am 04.05.2015 um 11:40 schrieb Sebastien seb...@gmail.com:
 
 Hi Chris,
 
 
 I am using a heuristic for an optimization problem and this takes about
 5-10 seconds.
 So it might be a good idea to use a future task to run this service,
 which
 receives the data (list of object) in the end.
 In the beginning, I would like to initialize the model with an empty
 list
 so that the page is displayed fast, and in parallel execute a future
 task;
 as soon as the service has some results, exchanging the model against
 the
 data returned.
 
 I have looked at the example described here:
 https://gist.github.com/jonnywray/636875 
 https://gist.github.com/jonnywray/636875
 
 The future is called correctly, but how can the component/panel be
 updated
 via the onPostSuccess(AjaxRequestTarget target) method?
 
 
 target.add(yourPanel) ?
 Caution: it will call model#getObject. Given your explanation I don't
 think
 your model is a LDM. Just be aware...
 
 
 By the way, what is the difference when setting the model via
 constructor
 (e.g. new Panel(id, model)) or via setDefaultModel method?
 
 
 There should no be differences. However, if you change the model object
 dynamically/afterward, you have to use #set[Default]ModelObject instead
 of
 #set[Default]Model.
 
 
 With the first, the default model is still null.
 
 
 No sure to follow here, because you said you initialized the model with
 an
 empty list... So neither the model and the modelobject should be null...
 
 
 
 Thanks, Chris
 
 
 
 
 


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: JQuery progressbar

2015-05-04 Thread Sebastien
Hi Chris,

I just had a brief look at files in the project. At least one thing which
is wrong:
https://github.com/cat1000/FutureProgressBar/blob/master/src/main/java/my/company/panels/RoutingListPanel.java#L24

You should not unwrap the model object in a ctor; use the model directly.
Also for subsequent components, use a model (like a propertymodel)
That explains why your model object seems to never be updated, actually the
listview is pointing the the old model object...

I will try to have a deeper look tomorrow...

Best regards,
Sebastien.


On Mon, May 4, 2015 at 9:47 PM, Chris chris...@gmx.at wrote:

 Hi Sebastian  all,

 I have set up a quick start project (see
 https://github.com/cat1000/FutureProgressBar 
 https://github.com/cat1000/FutureProgressBar).
 Please read the readme.txt file contained in the package pages to get an
 overview over the goals and the open questions.

 Basically, I am using a Future-Task to load data from a long-running
 service and in the meantime would like to display the loading progress via
 a progressBar.
 This basically is working.

 However, after the loading has finished, the panel is not reloaded.

 Thanks a lot for your help!

 Chris


  Am 04.05.2015 um 11:40 schrieb Sebastien seb...@gmail.com:
 
  Hi Chris,
 
 
  I am using a heuristic for an optimization problem and this takes about
  5-10 seconds.
  So it might be a good idea to use a future task to run this service,
 which
  receives the data (list of object) in the end.
  In the beginning, I would like to initialize the model with an empty
 list
  so that the page is displayed fast, and in parallel execute a future
 task;
  as soon as the service has some results, exchanging the model against
 the
  data returned.
 
  I have looked at the example described here:
  https://gist.github.com/jonnywray/636875 
  https://gist.github.com/jonnywray/636875
 
  The future is called correctly, but how can the component/panel be
 updated
  via the onPostSuccess(AjaxRequestTarget target) method?
 
 
  target.add(yourPanel) ?
  Caution: it will call model#getObject. Given your explanation I don't
 think
  your model is a LDM. Just be aware...
 
 
  By the way, what is the difference when setting the model via
 constructor
  (e.g. new Panel(id, model)) or via setDefaultModel method?
 
 
  There should no be differences. However, if you change the model object
  dynamically/afterward, you have to use #set[Default]ModelObject instead
 of
  #set[Default]Model.
 
 
  With the first, the default model is still null.
 
 
  No sure to follow here, because you said you initialized the model with
 an
  empty list... So neither the model and the modelobject should be null...
 
 
 
  Thanks, Chris
 
 
 




Re: JQuery progressbar

2015-05-04 Thread Chris
Hi Sebastian  all,

I have set up a quick start project (see 
https://github.com/cat1000/FutureProgressBar 
https://github.com/cat1000/FutureProgressBar).
Please read the readme.txt file contained in the package pages to get an 
overview over the goals and the open questions.

Basically, I am using a Future-Task to load data from a long-running service 
and in the meantime would like to display the loading progress via a 
progressBar.
This basically is working.

However, after the loading has finished, the panel is not reloaded.

Thanks a lot for your help!

Chris


 Am 04.05.2015 um 11:40 schrieb Sebastien seb...@gmail.com:
 
 Hi Chris,
 
 
 I am using a heuristic for an optimization problem and this takes about
 5-10 seconds.
 So it might be a good idea to use a future task to run this service, which
 receives the data (list of object) in the end.
 In the beginning, I would like to initialize the model with an empty list
 so that the page is displayed fast, and in parallel execute a future task;
 as soon as the service has some results, exchanging the model against the
 data returned.
 
 I have looked at the example described here:
 https://gist.github.com/jonnywray/636875 
 https://gist.github.com/jonnywray/636875
 
 The future is called correctly, but how can the component/panel be updated
 via the onPostSuccess(AjaxRequestTarget target) method?
 
 
 target.add(yourPanel) ?
 Caution: it will call model#getObject. Given your explanation I don't think
 your model is a LDM. Just be aware...
 
 
 By the way, what is the difference when setting the model via constructor
 (e.g. new Panel(id, model)) or via setDefaultModel method?
 
 
 There should no be differences. However, if you change the model object
 dynamically/afterward, you have to use #set[Default]ModelObject instead of
 #set[Default]Model.
 
 
 With the first, the default model is still null.
 
 
 No sure to follow here, because you said you initialized the model with an
 empty list... So neither the model and the modelobject should be null...
 
 
 
 Thanks, Chris