Hi Sebastian,
I am trying to apply the quick start to the real project.
I have the problem that the onSuccess method is not called - in the quickStart
it works. Do you know a hint but it is of course hard to figure it out from the
distance.
br Chris
final Future<List<Route>> contentsFuture =
routeGenerateService.generateRoutes();
FutureUpdateBehaviour<List<Route>> futureUpdateBehaviour = new
FutureUpdateBehaviour<List<Route>>(Duration.seconds(2), contentsFuture) {
@Override
protected void onPostSuccess(AjaxRequestTarget target) {
System.out.println("Success");
routingListPanel.setVisible(true);
target.add(routingListPanel.getParent());
}
@Override
protected void onUpdateError(AjaxRequestTarget target,
Exception e) {
}
};
> Am 05.05.2015 um 19:43 schrieb Sebastien <[email protected]>:
>
> Hi Chis,
>
>
> On Tue, May 5, 2015 at 6:25 PM, Chris <[email protected]> wrote:
>
>> Hi Sebastian,
>>
>> thanks a lot - in the meantime I have added a spring task executor service
>> so that the thread pool is closed properly during shutdown.
>>
>> Could you explain to me why it is necessary to set the default model
>> explicitly although the model is already set in the constructor?
>> Is then the default model used when set or the other model?
>> routingListPanel = new RoutingListPanel("routingPanel", routingModel);
>> routingListPanel.setDefaultModel(routingModel);
>>
>
> Because by "new RoutingListPanel("routingPanel", routingModel);", you
> suppose it will be the model of the RoutingListPanel, but... is it not; you
> transmitted the model to the underlying list view... :) Just transmit the
> routingModel (too) to the call to super and this will be solved.
>
> public RoutingListPanel(String id, final IModel<List<Route>>
> routingModel) {
> super(id, routingModel);
>
> also, you can remove this line:
> https://github.com/cat1000/FutureProgressBar/blob/ff0e9bda72ebc589a974103697baa5865719afcd/src/main/java/my/company/panels/MapPanel.java#L132
>
>
>
>>
>> Thanks, Chris
>>
>>
>>> Am 05.05.2015 um 16:10 schrieb Sebastien <[email protected]>:
>>>
>>> Hi Chris,
>>>
>>> I had a quick look today, I just applied the suggestion I mentioned
>>> previously and I have now a result...
>>> https://github.com/cat1000/FutureProgressBar/pull/1
>>>
>>> Best regards,
>>> Sebastien
>>>
>>> On Tue, May 5, 2015 at 1:52 AM, Chris <[email protected]> wrote:
>>>
>>>> Hi Sebastian
>>>>
>>>> thanks for the update!
>>>>
>>>> Chris
>>>>
>>>>
>>>>> Am 05.05.2015 um 01:39 schrieb Sebastien <[email protected]>:
>>>>>
>>>>> 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 <[email protected]> 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 <[email protected]>:
>>>>>>>
>>>>>>> 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: [email protected]
>>>> For additional commands, e-mail: [email protected]
>>>>
>>>>
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]