You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by mlabs <ml...@gmail.com> on 2011/03/29 20:50:24 UTC

model help

1. first I'd like to ask if there is any good reading material out there
regarding models. In particular I want to figure out all the nifty things
you can do with them via nesting/chaining etc. I've read Wicket in Action ..
but it seemed to gloss over the advanced stuff you can do with them .. and
I've read the docs.. and just from reading those, well it's not obvious what
you can do with them and why...

2. I have a specific problem and I'm looking for some hints. I have a foo
bean that I get from a DAO layer. The foo bean has the usual name,
description String properties. It also has an array of 'widget' beans called
'widgets'. The widget beans also have a name and description properties ans
well as various others.
So I have a form and I map the foo.name, foo.description properties to
TextField components using a compundpropertymodel. The 3rd component is a
ListView, which I want to use to display the widgets. 
First problem I run into is that the ListView model needs to be a List, not
an array of Widget. So the compoundpropertymodel barfs at this point. I
don't have any control over the beans and I'd rather not wrap them .. I want
to bind the components directly to the bean properties.

I'm wondering if there is a neat trick I can use involving model nesting or
something like that to solve this problem? Or maybe there is a way to tell
the CPM that for property 'widgets' .. do something different.. like
array-to-List conversion .. 

I'm a wicket newbie and the model-penny hasn't quite dropped yet.. so any
help would be most appreciated.
TIA


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/model-help-tp3415833p3415833.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: model help

Posted by Scott Swank <sc...@gmail.com>.
This is a good reference.

https://cwiki.apache.org/WICKET/working-with-wicket-models.html

Scott

On Tue, Mar 29, 2011 at 11:50 AM, mlabs <ml...@gmail.com> wrote:
> 1. first I'd like to ask if there is any good reading material out there
> regarding models. In particular I want to figure out all the nifty things
> you can do with them via nesting/chaining etc. I've read Wicket in Action ..
> but it seemed to gloss over the advanced stuff you can do with them .. and
> I've read the docs.. and just from reading those, well it's not obvious what
> you can do with them and why...
>
> 2. I have a specific problem and I'm looking for some hints. I have a foo
> bean that I get from a DAO layer. The foo bean has the usual name,
> description String properties. It also has an array of 'widget' beans called
> 'widgets'. The widget beans also have a name and description properties ans
> well as various others.
> So I have a form and I map the foo.name, foo.description properties to
> TextField components using a compundpropertymodel. The 3rd component is a
> ListView, which I want to use to display the widgets.
> First problem I run into is that the ListView model needs to be a List, not
> an array of Widget. So the compoundpropertymodel barfs at this point. I
> don't have any control over the beans and I'd rather not wrap them .. I want
> to bind the components directly to the bean properties.
>
> I'm wondering if there is a neat trick I can use involving model nesting or
> something like that to solve this problem? Or maybe there is a way to tell
> the CPM that for property 'widgets' .. do something different.. like
> array-to-List conversion ..
>
> I'm a wicket newbie and the model-penny hasn't quite dropped yet.. so any
> help would be most appreciated.
> TIA
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/model-help-tp3415833p3415833.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: model help

Posted by MZ...@osc.state.ny.us.
Not sure what your objects look like but I will try to answer question 
2...

Not sure if this will work for you...sometimes I find myself using 
PropertyModels mixed with CPMs...
new ListView("myId", new PropertyModel(foo, "widgets"))

And it may not be entirely obvious you can use dot notation to access 
nested objects...new PropertyModel(foo, "bar.name") for the following;

class Foo() {

private Bar bar;

}

class Bar() {

private String name;

}




From:   mlabs <ml...@gmail.com>
To:     users@wicket.apache.org
Date:   03/29/2011 02:50 PM
Subject:        model help



1. first I'd like to ask if there is any good reading material out there
regarding models. In particular I want to figure out all the nifty things
you can do with them via nesting/chaining etc. I've read Wicket in Action 
..
but it seemed to gloss over the advanced stuff you can do with them .. and
I've read the docs.. and just from reading those, well it's not obvious 
what
you can do with them and why...

2. I have a specific problem and I'm looking for some hints. I have a foo
bean that I get from a DAO layer. The foo bean has the usual name,
description String properties. It also has an array of 'widget' beans 
called
'widgets'. The widget beans also have a name and description properties 
ans
well as various others.
So I have a form and I map the foo.name, foo.description properties to
TextField components using a compundpropertymodel. The 3rd component is a
ListView, which I want to use to display the widgets. 
First problem I run into is that the ListView model needs to be a List, 
not
an array of Widget. So the compoundpropertymodel barfs at this point. I
don't have any control over the beans and I'd rather not wrap them .. I 
want
to bind the components directly to the bean properties.

I'm wondering if there is a neat trick I can use involving model nesting 
or
something like that to solve this problem? Or maybe there is a way to tell
the CPM that for property 'widgets' .. do something different.. like
array-to-List conversion .. 

I'm a wicket newbie and the model-penny hasn't quite dropped yet.. so any
help would be most appreciated.
TIA


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/model-help-tp3415833p3415833.html

Sent from the Users forum mailing list archive at Nabble.com.

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






Notice: This communication, including any attachments, is intended solely 
for the use of the individual or entity to which it is addressed. This 
communication may contain information that is protected from disclosure 
under State and/or Federal law. Please notify the sender immediately if 
you have received this communication in error and delete this email from 
your system. If you are not the intended recipient, you are requested not 
to disclose, copy, distribute or take any action in reliance on the 
contents of this information.