You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Luther Baker <lu...@gmail.com> on 2009/05/23 20:08:46 UTC
IModel and ResourceModel
I typically write this out longhand (is that bad or unpopular) for ez
debugging):
add(new Label("quote", new ResourceModel("default-quote")));
would often be:
IModel<String> model = new ResourceModel("default-quote")));
Label label = new Label("quote", model);
add(label);
My question is, am I correct to assume that a ResourceModel is an
IModel<String>? I think that is what the source has but typing my
application based on what the black box library uses today seems like a bad
practice. I'm afraid to rely on this -- since, the source could change ... ?
False alarm? Am I misunderstanding something maybe?
Thanks,
-Luther
Re: IModel and ResourceModel
Posted by Jeremy Thomerson <je...@wickettraining.com>.
Black box library? Isn't a black box one that you can't see in to?
How would that apply to an OPEN source library where the code is
available for [1] download, [2] publicly viewing on the internet, or
[3] modifying yourself?
[1] - http://download.filehat.com/apache/wicket/1.4-rc4/
[2] - http://fisheye6.atlassian.com/browse/wicket/trunk/wicket/src/main/java/org/apache/wicket/model/ResourceModel.java?r=672603
[3] - http://www.apache.org/licenses/LICENSE-2.0
But the answer is YES - it is an IModel<String> which is the only
reason your code compiles. It's also in the source code. I'd
recommend using maven and "mvn eclipse:eclipse" or similar for your
IDE so that you can just click into the code to see this.
On Sat, May 23, 2009 at 1:08 PM, Luther Baker <lu...@gmail.com> wrote:
> I think that is what the source has but typing my
> application based on what the black box library uses today seems like a bad
> practice.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: IModel and ResourceModel
Posted by James Carman <jc...@carmanconsulting.com>.
On Sat, May 23, 2009 at 2:08 PM, Luther Baker <lu...@gmail.com> wrote:
> I typically write this out longhand (is that bad or unpopular) for ez
> debugging):
>
> add(new Label("quote", new ResourceModel("default-quote")));
>
> would often be:
>
> IModel<String> model = new ResourceModel("default-quote")));
> Label label = new Label("quote", model);
> add(label);
>
> My question is, am I correct to assume that a ResourceModel is an
> IModel<String>? I think that is what the source has but typing my
> application based on what the black box library uses today seems like a bad
> practice. I'm afraid to rely on this -- since, the source could change ... ?
> False alarm? Am I misunderstanding something maybe?
Check the javadocs:
http://wicket.apache.org/docs/1.4/org/apache/wicket/model/ResourceModel.html
ResourceModel extends AbstractReadOnlyModel<String>. Sine resource
strings are, in fact, Strings, I wouldn't foresee that changing. I
think you're safe. I'm using it in my code, so if you're not, I'm
screwed too! :)
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org