Re: [wicket-user] List of DropDownChoices

2005-07-11 Thread Johannes Fahrenkrug
Martijn,

thank you so much for your help.
Now it works perfectly. I added the field "paxProAnreise" to the
TerminDetail class, added getters and setters and changed the
PropertyModel accordingly. Now my code looks like this:

protected void populateItem(ListItem item) {
   final TerminDetail terminDetail = (TerminDetail)
item.getModelObject();
   boolean visible = terminDetail.getFreieKontingente() > 0;
   item.add(new Label("zimmerart",
terminDetail.getZimmerart()).setVisible(visible));
   item.add(new DropDownChoice ("moeglichePaxAnzahlen",
new PropertyModel(terminDetail, "paxProZimmerart"),
   
terminDetail.getMoeglichePaxAnzahlen()).setVisible(visible));
}

Now it works like a charm :)

- Johannes

Martijn Dashorst wrote:

> Johannes,
>
> You haven't attached a model to the dropdown choice. The constructor
> you are using implies having a CompoundPropertyModel as
> ListItem.model. You don't have this, so you need to use another
> constructor:
>
> item.add(new DropDownChoice ("paxProZimmerart", new
> PropertyModel(terminDetail, "paxProZimmerart"),
> terminDetail.getMoeglichePaxAnzahlen()));
>
> Looking at your code, I suspect you will be getting other exceptions,
> as you render your components conditionally, this will give exceptions.
>
> Better to use:
>
> protected void populateItem(ListItem item) {
>final TerminDetail terminDetail = (TerminDetail)
> item.getModelObject();
>boolean visible = terminDetail.getFreieKontingente() > 0;
>item.add(new Label("zimmerart",
> terminDetail.getZimmerart()).setVisible(visible));
>item.add(new DropDownChoice ("paxProZimmerart",
> new PropertyModel(terminDetail,
> "paxProZimmerart"),
>
> terminDetail.getMoeglichePaxAnzahlen()).setVisible(visible);
> }
>
>
> Martijn
>
>
> Johannes Fahrenkrug wrote:
>
>> I attached the exception and this is the code I use to build the list:
>>
>> add (zimmerartenList = new ListView ("zimmerartenList",
>> termin.getTerminDetails()) {
>>
>>private static final long serialVersionUID =
>> 2623213955857979457L;
>>
>>@Override
>>protected void populateItem(ListItem item) {
>>final TerminDetail terminDetail = (TerminDetail)
>> item.getModelObject();
>>  if(
>> terminDetail.getFreieKontingente() > 0 ) {
>>item.add(new Label("zimmerart",
>> terminDetail.getZimmerart()));
>>item.add(new DropDownChoice ("paxProZimmerart",
>> terminDetail.getMoeglichePaxAnzahlen()));
>>}
>>}
>>});
>>
>>
>>
>> Johan Compagner wrote:
>>
>>  
>>
>>> what kind of exception?
>>>
>>>
>>> Johannes Fahrenkrug wrote:
>>>
>>>   
>>>
 Hi,

 I'm new to Wicket and I have a question. I need to generate and
 display
 a List of DropDownChoices. This is the scenario:
 I have different room types and for every room type I have certain
 vacancies. So I need to have something like this:

 Double room   - [Choose one   ]
 [2 ]
 [4 ]
 [6 ]

 Single room  -[Choose one  ]
 [1]
 [2 ]
 [3 ]
 [4]


 I already managed to display that (with a list view and a
 DropDownChoice
 attached to each item). But when I want to submit the form, I get an
 exception.

 What would be The Right Thing to do?

 Thank you so much!

 - Johannes


 ---
 This SF.Net email is sponsored by the 'Do More With Dual!' webinar
 happening
 July 14 at 8am PDT/11am EDT. We invite you to explore the latest in
 dual
 core and dual graphics technology at this free one hour event hosted
 by HP,
 AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user



 
>>>
>>> ---
>>> This SF.Net email is sponsored by the 'Do More With Dual!' webinar
>>> happening
>>> July 14 at 8am PDT/11am EDT. We invite you to explore the latest in
>>> dual
>>> core and dual graphics technology at this free one hour event hosted
>>> by HP,
>>> AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebi

Re: [wicket-user] List of DropDownChoices

2005-07-11 Thread Martijn Dashorst

Johannes,

You haven't attached a model to the dropdown choice. The constructor you 
are using implies having a CompoundPropertyModel as ListItem.model. You 
don't have this, so you need to use another constructor:


item.add(new DropDownChoice ("paxProZimmerart", new 
PropertyModel(terminDetail, "paxProZimmerart"), 
terminDetail.getMoeglichePaxAnzahlen()));


Looking at your code, I suspect you will be getting other exceptions, as 
you render your components conditionally, this will give exceptions.


Better to use:

protected void populateItem(ListItem item) {
   final TerminDetail terminDetail = (TerminDetail) item.getModelObject();
   boolean visible = terminDetail.getFreieKontingente() > 0;
   item.add(new Label("zimmerart", 
terminDetail.getZimmerart()).setVisible(visible));
   item.add(new DropDownChoice ("paxProZimmerart", 
new PropertyModel(terminDetail, "paxProZimmerart"),


terminDetail.getMoeglichePaxAnzahlen()).setVisible(visible);
}


Martijn


Johannes Fahrenkrug wrote:


I attached the exception and this is the code I use to build the list:

add (zimmerartenList = new ListView ("zimmerartenList",
termin.getTerminDetails()) {

   private static final long serialVersionUID =
2623213955857979457L;

   @Override
   protected void populateItem(ListItem item) {
   final TerminDetail terminDetail = (TerminDetail)
item.getModelObject();
  
   if( terminDetail.getFreieKontingente() > 0 ) {

   item.add(new Label("zimmerart",
terminDetail.getZimmerart()));
   item.add(new DropDownChoice ("paxProZimmerart",
terminDetail.getMoeglichePaxAnzahlen()));
   }
   }
   });



Johan Compagner wrote:

 


what kind of exception?


Johannes Fahrenkrug wrote:

   


Hi,

I'm new to Wicket and I have a question. I need to generate and display
a List of DropDownChoices. This is the scenario:
I have different room types and for every room type I have certain
vacancies. So I need to have something like this:

Double room   - [Choose one   ]
[2 ]
[4 ]
[6 ]

Single room  -[Choose one  ]
[1]
[2 ]
[3 ]
[4]


I already managed to display that (with a list view and a DropDownChoice
attached to each item). But when I want to submit the form, I get an
exception.

What would be The Right Thing to do?

Thank you so much!

- Johannes


---
This SF.Net email is sponsored by the 'Do More With Dual!' webinar
happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted
by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user



 


---
This SF.Net email is sponsored by the 'Do More With Dual!' webinar
happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted
by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
   






---
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
 





---
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [wicket-user] List of DropDownChoices

2005-07-11 Thread Johannes Fahrenkrug
I attached the exception and this is the code I use to build the list:

add (zimmerartenList = new ListView ("zimmerartenList",
termin.getTerminDetails()) {

private static final long serialVersionUID =
2623213955857979457L;

@Override
protected void populateItem(ListItem item) {
final TerminDetail terminDetail = (TerminDetail)
item.getModelObject();
   
if( terminDetail.getFreieKontingente() > 0 ) {
item.add(new Label("zimmerart",
terminDetail.getZimmerart()));
item.add(new DropDownChoice ("paxProZimmerart",
terminDetail.getMoeglichePaxAnzahlen()));
}
}
});



Johan Compagner wrote:

> what kind of exception?
>
>
> Johannes Fahrenkrug wrote:
>
>> Hi,
>>
>> I'm new to Wicket and I have a question. I need to generate and display
>> a List of DropDownChoices. This is the scenario:
>> I have different room types and for every room type I have certain
>> vacancies. So I need to have something like this:
>>
>> Double room   - [Choose one   ]
>>  [2 ]
>>  [4 ]
>>  [6 ]
>>
>> Single room  -[Choose one  ]
>>  [1]
>>  [2 ]
>>  [3 ]
>>  [4]
>>
>>
>> I already managed to display that (with a list view and a DropDownChoice
>> attached to each item). But when I want to submit the form, I get an
>> exception.
>>
>> What would be The Right Thing to do?
>>
>> Thank you so much!
>>
>> - Johannes
>>
>>
>> ---
>> This SF.Net email is sponsored by the 'Do More With Dual!' webinar
>> happening
>> July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
>> core and dual graphics technology at this free one hour event hosted
>> by HP,
>> AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
>> ___
>> Wicket-user mailing list
>> Wicket-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>
>>  
>>
>
>
> ---
> This SF.Net email is sponsored by the 'Do More With Dual!' webinar
> happening
> July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
> core and dual graphics technology at this free one hour event hosted
> by HP,
> AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
> ___
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user




---
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [wicket-user] List of DropDownChoices

2005-07-11 Thread Johan Compagner

what kind of exception?


Johannes Fahrenkrug wrote:


Hi,

I'm new to Wicket and I have a question. I need to generate and display
a List of DropDownChoices. This is the scenario:
I have different room types and for every room type I have certain
vacancies. So I need to have something like this:

Double room   - [Choose one   ]
 [2 ]
 [4 ]
 [6 ]

Single room  -[Choose one  ]
 [1]
 [2 ]
 [3 ]
 [4]


I already managed to display that (with a list view and a DropDownChoice
attached to each item). But when I want to submit the form, I get an
exception.

What would be The Right Thing to do?

Thank you so much!

- Johannes


---
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

 




---
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user