DropDownChoice in ListView

2009-03-21 Thread Alexander Lohse

Hi,

I am encountering a strange problem when adding DropDownChoices to a  
ListView. Displaying and retrieving values works fine, BUT the values  
are lost during errorous form submission.


The following ListView is added to a form. When the form is submitted  
successful all ModelObjects are updated fine.
But when submission fails ( e.g. because of some other fields which  
are required and values are missing) the DropdownChoices loose their  
selected values and return to the original ModelObject value.


Here is the code of the ListView:

public class TaskList extends ListViewReminderTaskProxyModel {

public TaskList (String id) {
super(id);
setRenderBodyOnly(true);
}

protected void populateItem (final  
ListItemReminderTaskProxyModel listItem) {

ReminderTaskProxyModel model = listItem.getModelObject();

WeekdayChoice dayChoice = new WeekdayChoice(day);
dayChoice.setModel(new PropertyModelInteger(model, day));
listItem.add(dayChoice);

HourChoice hourChoice = new HourChoice(hour);
hourChoice.setModel(new PropertyModelInteger(model, hour));
listItem.add(hourChoice);

listItem.setRenderBodyOnly(true);
}
}

WeekdayChoice and HourChoice basically extend DropDownChoice and set  
the choices and a renderer:


public class HourChoice extends DropDownChoiceInteger {

public HourChoice (String id) {
super(id);
setChoiceRenderer(new HourRenderer());
ListInteger hours = new LinkedListInteger();
for(int i = 1; i = 24; i++) {
hours.add(i);
}
setChoices(hours);
}

private class HourRenderer implements IChoiceRendererInteger {

private NumberFormat format = new DecimalFormat(00.##);

public Object getDisplayValue (Integer hour) {
return format.format(hour) + :00;
}

public String getIdValue (Integer hour, int index) {
return String.valueOf(hour);
}
}
}

Any ideas, or hints where I might go wrong are greatly appreciated.
Thank you in advance!

Regards,

Alex
__

A designer knows he has achieved perfection not when there is nothing  
left to add,

but when there is nothing left to take away.
(Antoine de Saint Exupéry)
.

Alexander Lohse • Entwicklungsleitung  Projektmanagement
Tel +49 38374 752 11 • Fax +49 38374 752 23
http://www.humantouch.de

Human Touch Medienproduktion GmbH
Am See 1 • 17440 Klein Jasedow • Deutschland

Geschäftsführung:
Lara Mallien, Nele Hybsier, Alexander Lohse, Johannes Heimrath (Senior)
Handelsregister Stralsund • HRB 4192 • USt-IdNr. DE128367684


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



Re: DropDownChoice in ListView

2009-03-21 Thread Alexander Lohse

Thank you very much!

Now that I know what to look out for, I think I must have been blind  
while searching for an answer.


But my first reference, this cwiki page, missed out on this:

http://cwiki.apache.org/WICKET/listview-with-checkboxes.html

I just updated it and added the necessary line!

Best Regards,

Alex

Am 21.03.2009 um 21:29 schrieb Martijn Dashorst:


ListView documentation states that you should setReuseItems(true)
when working in a form or with form components.

Martijn

On Sat, Mar 21, 2009 at 9:26 PM, Alexander Lohse a...@humantouch.de  
wrote:

Hi,

I am encountering a strange problem when adding DropDownChoices to a
ListView. Displaying and retrieving values works fine, BUT the  
values are

lost during errorous form submission.

The following ListView is added to a form. When the form is submitted
successful all ModelObjects are updated fine.
But when submission fails ( e.g. because of some other fields which  
are
required and values are missing) the DropdownChoices loose their  
selected

values and return to the original ModelObject value.

Here is the code of the ListView:

public class TaskList extends ListViewReminderTaskProxyModel {

   public TaskList (String id) {
   super(id);
   setRenderBodyOnly(true);
   }

   protected void populateItem (final  
ListItemReminderTaskProxyModel

listItem) {
   ReminderTaskProxyModel model = listItem.getModelObject();

   WeekdayChoice dayChoice = new WeekdayChoice(day);
   dayChoice.setModel(new PropertyModelInteger(model, day));
   listItem.add(dayChoice);

   HourChoice hourChoice = new HourChoice(hour);
   hourChoice.setModel(new PropertyModelInteger(model,  
hour));

   listItem.add(hourChoice);

   listItem.setRenderBodyOnly(true);
   }
}

WeekdayChoice and HourChoice basically extend DropDownChoice and  
set the

choices and a renderer:

public class HourChoice extends DropDownChoiceInteger {

   public HourChoice (String id) {
   super(id);
   setChoiceRenderer(new HourRenderer());
   ListInteger hours = new LinkedListInteger();
   for(int i = 1; i = 24; i++) {
   hours.add(i);
   }
   setChoices(hours);
   }

   private class HourRenderer implements IChoiceRendererInteger {

   private NumberFormat format = new DecimalFormat(00.##);

   public Object getDisplayValue (Integer hour) {
   return format.format(hour) + :00;
   }

   public String getIdValue (Integer hour, int index) {
   return String.valueOf(hour);
   }
   }
}

Any ideas, or hints where I might go wrong are greatly appreciated.
Thank you in advance!

Regards,

Alex
__

A designer knows he has achieved perfection not when there is  
nothing left

to add,
but when there is nothing left to take away.
(Antoine de Saint Exupéry)
.

Alexander Lohse • Entwicklungsleitung  Projektmanagement
Tel +49 38374 752 11 • Fax +49 38374 752 23
http://www.humantouch.de

Human Touch Medienproduktion GmbH
Am See 1 • 17440 Klein Jasedow • Deutschland

Geschäftsführung:
Lara Mallien, Nele Hybsier, Alexander Lohse, Johannes Heimrath  
(Senior)

Handelsregister Stralsund • HRB 4192 • USt-IdNr. DE128367684


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






--
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.5 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

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



__

In software, we rarely have meaningful requirements.
Even if we do, the only measure of success that matters is
whether our solution solves the customer's shifting idea of what their  
problem is.

(Jeff Atwood)
.

Alexander Lohse • Entwicklungsleitung  Projektmanagement
Tel +49 38374 752 11 • Fax +49 38374 752 23
http://www.humantouch.de

Human Touch Medienproduktion GmbH
Am See 1 • 17440 Klein Jasedow • Deutschland

Geschäftsführung:
Lara Mallien, Nele Hybsier, Alexander Lohse, Johannes Heimrath (Senior)
Handelsregister Stralsund • HRB 4192 • USt-IdNr. DE128367684


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



Re: determine which form was submitted

2009-02-25 Thread Alexander Lohse

Hi Ernesto,

not really, but you pointed me in right way:

I have two forms in my markup, which are shown and hidden via  
javascript. So I need to know which form was posted to keep it visible.


onSubmit was not sufficient, as I need to know which form was  
submitted, wether the input is valid or not. But overriding onValidate  
did the trick!


Thanks,

Alex

Am 25.02.2009 um 09:49 schrieb Ernesto Reinaldo Barreiro:

Wouldn't it be enough to and  onSubmit() {...} for each form and  
then you

will know which one was submited?

Ernesto

On Wed, Feb 25, 2009 at 12:33 AM, Alexander Lohse a...@humantouch.de  
wrote:



Hi,

I have two forms on one page and need to toggle visibility of a  
container

depending on which form was submitted.

Is there a way to I find out which form was posted?

Thank you in advance or any help,

Alex
__

A designer knows he has achieved perfection not when there is  
nothing left

to add,
but when there is nothing left to take away.
(Antoine de Saint Exupéry)

.

Alexander Lohse • Entwicklungsleitung  Projektmanagement
Tel +49 38374 752 11 • Fax +49 38374 752 23
http://www.humantouch.de

Human Touch Medienproduktion GmbH
Am See 1 • 17440 Klein Jasedow • Deutschland

Geschäftsführung:
Lara Mallien, Nele Hybsier, Alexander Lohse, Johannes Heimrath  
(Senior)

Handelsregister Stralsund • HRB 4192 • USt-IdNr. DE128367684


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




__

In theory, there is no difference between theory and practice. But,  
in practice, there is.

(Jan L. A. van de Snepscheut)
.

Alexander Lohse • Entwicklungsleitung  Projektmanagement
Tel +49 38374 752 11 • Fax +49 38374 752 23
http://www.humantouch.de

Human Touch Medienproduktion GmbH
Am See 1 • 17440 Klein Jasedow • Deutschland

Geschäftsführung:
Lara Mallien, Nele Hybsier, Alexander Lohse, Johannes Heimrath (Senior)
Handelsregister Stralsund • HRB 4192 • USt-IdNr. DE128367684





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



AuthorizationStrategy for Resources?

2009-02-25 Thread Alexander Lohse

Hi,

I wonder if there is a way to implement a AuthorizationStrategy for  
WebResources?


I want to export some data to xml and found the WebResource to be a  
nice convienient way to do so.
But this data should not be accessible for everyone, but only for  
authenticated users ...


Best regards,

Alex
__

The hardest part of design … is keeping features out.
(Donald Norman)
.

Alexander Lohse • Entwicklungsleitung  Projektmanagement
Tel +49 38374 752 11 • Fax +49 38374 752 23
http://www.humantouch.de

Human Touch Medienproduktion GmbH
Am See 1 • 17440 Klein Jasedow • Deutschland

Geschäftsführung:
Lara Mallien, Nele Hybsier, Alexander Lohse, Johannes Heimrath (Senior)
Handelsregister Stralsund • HRB 4192 • USt-IdNr. DE128367684





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



determine which form was submitted

2009-02-24 Thread Alexander Lohse

Hi,

I have two forms on one page and need to toggle visibility of a  
container depending on which form was submitted.


Is there a way to I find out which form was posted?

Thank you in advance or any help,

Alex
__

A designer knows he has achieved perfection not when there is nothing  
left to add,

but when there is nothing left to take away.
(Antoine de Saint Exupéry)
.

Alexander Lohse • Entwicklungsleitung  Projektmanagement
Tel +49 38374 752 11 • Fax +49 38374 752 23
http://www.humantouch.de

Human Touch Medienproduktion GmbH
Am See 1 • 17440 Klein Jasedow • Deutschland

Geschäftsführung:
Lara Mallien, Nele Hybsier, Alexander Lohse, Johannes Heimrath (Senior)
Handelsregister Stralsund • HRB 4192 • USt-IdNr. DE128367684


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



Re: Storing user entity in session?

2009-02-23 Thread Alexander Lohse

Hi Martijn,

could you paste some short example code to point out how to load and  
access a UserModel in the requestcycle?


Regards,

Alex

Am 23.02.2009 um 08:42 schrieb Martijn Dashorst:


Storing the user in a field of Session is wrong. Didn't you read the
concurrency caveats I posted earlier?

When users click fast enough, you'll get Hibernate exceptions pretty
soon. Entity instances can't be shared between multiple threads.
Putting them in the Session exposes them to that threat. Putting
transient before the field doesn't mitigate that, neither does
synchronized.

Martijn

On Fri, Feb 20, 2009 at 11:25 PM, Tauren Mills tau...@groovee.com  
wrote:

Nino and Martijn,

Thanks for the help.  Last night I was looking through the elephas
code and found a solution that I think will work for me.  It doesn't
store an LDM in the session, but stores an identifier and a
*transient* instance of User.  This seems like an effective solution
to me. I tried it out and haven't had problems yet.  Here's the
elephas session so you can see for yourself:
http://code.google.com/p/elephas/source/browse/trunk/src/main/java/org/elephas/webapp/application/ElephasSession.java?r=87

Then on my page, I just do something like this:
setDefaultModel(new  
DetachableUserModel(getSession().getUser(),userDao));


Please let me know your thoughts on this.

Thanks,
Tauren


On Fri, Feb 20, 2009 at 2:05 AM, nino martinez wael
nino.martinez.w...@gmail.com wrote:

Hi Tauren

I've done something similar.. Have no trouble with..

Disclaimer, below code are really ugly and I need to clean it up...



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






--
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.5 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

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



__

A designer knows he has achieved perfection not when there is nothing  
left to add,

but when there is nothing left to take away.
(Antoine de Saint Exupéry)
.

Alexander Lohse • Entwicklungsleitung  Projektmanagement
Tel +49 38374 752 11 • Fax +49 38374 752 23
http://www.humantouch.de

Human Touch Medienproduktion GmbH
Am See 1 • 17440 Klein Jasedow • Deutschland

Geschäftsführung:
Lara Mallien, Nele Hybsier, Alexander Lohse, Johannes Heimrath (Senior)
Handelsregister Stralsund • HRB 4192 • USt-IdNr. DE128367684


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



validation message-keys differences on m3 to rc2

2009-02-22 Thread Alexander Lohse

Hi,

I could not find any reported changes concerning validation message  
keys from version 1.4-m3 to 1.4-rc2, but I have the following  
required key in my application resources that does not work anymore.


entry key=loginForm.password.RequiredBitte geben Sie ein Passwort  
ein!/entry


Any other keys in this file are working when addressed via  
wicket:message, so this is no file-naming problem.


I also doublechecked the form-component-ids.

The following form is placed on a Panel:

private LoginForm () {
super(loginForm);

userNameField = new TextField(username);
userNameField.setRequired(true);
userNameField.add(EmailAddressValidator.getInstance());

passwordField = new PasswordTextField(password);
passwordField.setResetPassword(true);
passwordField.setRequired(true);

add(userNameField);
add(passwordField);
add(new SubmitLink(submitLink));

setModel(new CompoundPropertyModelLoginModel(model));
}

Any ideas or hints?

Thanks in advance. Best regards,

Alex
__

Alexander Lohse • Entwicklungsleitung  Projektmanagement
Tel +49 38374 752 11 • Fax +49 38374 752 23
http://www.humantouch.de

Human Touch Medienproduktion GmbH
Am See 1 • 17440 Klein Jasedow • Deutschland

Geschäftsführung:
Lara Mallien, Nele Hybsier, Alexander Lohse, Johannes Heimrath (Senior)
Handelsregister Stralsund • HRB 4192 • USt-IdNr. DE128367684


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