Re: How to deal with JPA Entities in a Wicket Model? (Data handling in models)

2013-05-04 Thread Christian Reiter


Am 03.05.2013 16:28, schrieb Bertrand Guay-Paquet:
Best solution I can imagine would be if there would be a callback or 
overridable method which is called when the user navigates to a page 
and another one which is called when the user leaves a page. Those 
methods would be great to prepare and cleanup models. Are there such 
methods?
No method will reliably inform you that a user left a page. His WIFI 
could die, the power could go out, etc. You must clear all expired 
temporary data after some time. If your data is stored in the session, 
that's done automatically for you.


Thanks for your answer.

I understand, that there can be situations when a user actually doesn't 
leave a page the usual way, but if there were a method as described, it 
could at least be helpful for all the preceding page-leave-events under 
normal conditions.


At the moment I think I could handle the problem of unsaved data by 
using a Stateful Session Bean.


Best Regards,

Christian



Mit freundlichen Grüßen,  ///  Kind Regards,
 Christian Reiter



--

Christian Reiter||| c.rei...@gmx.net


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



How to deal with JPA Entities in a Wicket Model? (Data handling in models)

2013-05-03 Thread Christian Reiter

Hi!

I'm wondering what's the recommended way to store a unpersisted object 
while it is edited (I'm using EJBs with JPA as backend).


Let's imagine I want to build a customer editor which should be able to 
handle editing of new (unpersisted) and existing (persisted) customers.


If I use a loadable detachable model to load the customer from the 
backed, all unpersisted changes between requests are lost - not really 
desirable. If I use a simple model which stores the entity in serialized 
form my sessions are growing and in addition I've to handle entity 
refreshing if a user navigates back to the page by using the browser's 
back button to prevent the user from saving an old entity state.


Best solution I can imagine would be if there would be a callback or 
overridable method which is called when the user navigates to a page and 
another one which is called when the user leaves a page. Those methods 
would be great to prepare and cleanup models. Are there such methods?


Is there any recommended way to store entities in wicket while they are 
edited?


Kind Regards,
 Christian Reiter



--

Christian Reiter||| c.rei...@gmx.net


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



wicket-contrib-javaee: @EJB injection - injecting always the same instance regardless of session

2010-03-18 Thread Christian Reiter

Hi!

I've just started using the @EJB injection annotation from 
wicket-contrib-javaee.
I use it to inject a Stateful Session Bean to keep track of my user 
session and do some

stuff like authorization.

I thought the @EJB annotation keeps track of my sessions and would 
inject a unique instance of

the Stateful Session Bean for each of my Wicket session.

But, it injects always the same Stateful Session Bean instance 
completely ignoring my Wicket sessions. In this case it is useless to 
keep track of my users.


Am i doing anything wrong or is this the intended behaviour?

Would it be better to get the Stateful Session Bean by a lookup call and 
then store it in the

Wicket session?

Thanks for your help!

Best Regards,
 christian

--
Christian Reiter|||c.rei...@gmx.net


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



AjaxFallbackButton doesn't update ajax components when validation fails?

2009-10-16 Thread Christian Reiter

Hi!

I've got a form in which I use some textfields and other components 
which have validators attached.

The form also has the two standard ok and cancel buttons.

One important feature of the form is that the user should be able to 
query the altitude of a geoposition.
Therefore the form has a latitude and longitude textfield and a query 
altitude button.


When there is text in latitude and in longitude and the user clicks the 
query altitude button a web service
is queried for the appropriate altitude. Then the form's model object is 
updated with the altitude.


Everything works as expected when no other component in the form fails 
validation. The altitude is sent
back to the client. But when any other component fails validation, the 
altitude text field also isn't updated.


How can I omit this behaviour and get the altitude field updated, 
regardless of the validation result of the

other components?

Here's my query-altitude-button code:

queryAltitudeButton = new AjaxFallbackButton(queryAltitudeButton, form) {

@Override
protected void onError(AjaxRequestTarget target, Form? 
form) {

queryAlti(target);
}


@Override
protected void onSubmit(AjaxRequestTarget target, Form? 
form) {

queryAlti(target);
}

private void queryAlti(AjaxRequestTarget target) {
Double alti = 
AltitudeService.getAltitude(place.getLatitude(), place.getLongitude());


if( alti != null  alti = -300.0  alti = 9000.0) {
place.setElevation(alti);
} else {
place.setElevation(null);
}

if( target != null ) {
target.addComponent(altitudeTextField);
target.addComponent(feedbackPanel);
}
}
};
queryAltitudeButton.setOutputMarkupId(true);
form.add(queryAltitudeButton);


Thanks!

chris

--


Christian Reiter|||c.rei...@gmx.net


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



DropDownChoice: get selected object even if validation fails?

2009-10-15 Thread Christian Reiter

Hello!

I've got a DropDownChoice in one of my forms, with which the user can 
select a icon.

I want to display a preview of this icon beneath the drop down choice box.
Therefore I added an AjaxFormValidatingBehavior to the DropDownChoice. 
Now, when
the user changes the value of the DropDownChoice I get informed in the 
onError or onSubmit
method of the AjaxFormValidatingBehavior. Everything works fine if the 
form validation is
ok and the form data gets synced to my data model (then I query my model 
for the selected icon

and update the corresponding Image and send it to the client).

The problem occurs when the form validation doesn't work, because in 
this case, the
form data isn't synced to the model and I have no chance to know which 
icon was selected
by the user (through the DropDownChoice). As I want to display a preview 
of the icon also
if any of the previous form components didn't validate successful, I am 
in need of a method
which tells me which Icon was chosen by the user, regardless of the 
previous validation

result.

Is this possible?

Thanks in anticipation!

Best Regards,

chris


--


Christian Reiter|||c.rei...@gmx.net  



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



Using Wicket together with Microsoft VirtualEarth/BingMaps

2009-09-09 Thread Christian Reiter

Hi!

I am relatively new to Wicket but impressed by the comfort it offers.
So far I used Perl/ModPerl/JavaScript for my web projects. I am usually 
using Java for my Desktop apps.


For a application which should be created from scratch I am forced to 
use Microsofts Bing Maps (formerly
known as VirtualEarth). Bing Maps is something similar to Google Maps. 
Basically there are only two tasks

which have to performed with Bing.

a) Placing placemarks/pushpins on the map
b) Displaying those placemarks later (the placemarks act as links to 
some documents)


I know that there is an extension for using Google Maps with Wicket, but 
I haven't found any for Bing Maps/VE.


Is it basically possible to integrate Bing Maps with Wicket? I think 
task b) Displaying the placemarks can be done easily.
But how about task a)? I am able to fire an JavaScript function when the 
user places a pusphin but how can I forward

this event to Wicket? Any hints?

Thanks in advance!

Christian

--


Christian Reiter|||c.rei...@gmx.net


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