Thanks a lot guys !
This seems to be a question you get often, sadly I really tried googling an
answer before posting here..
But I didn't find anything :(

Thanks !
Guillaume

On Tue, Jun 9, 2009 at 2:02 PM, Martijn Dashorst <martijn.dasho...@gmail.com
> wrote:

> Just create a method House#getFirstResident() that return null if there's
> none.
>
> And the generic type of the model should be the type that is the
> result of getObject().
>
> Martijn
>
> On Tue, Jun 9, 2009 at 7:42 PM, Guillaume Simard<gui...@gmail.com> wrote:
> > Hi everyone !
> > I have two questions.
> >
> > First, I have a PropertyModel ..
> >
> > Something similar to this :
> >
> > add ( new Label("firstResidentName", new PropertyModel<House>(myHouse,
> > "residents[0].name") ) );
> >
> > Where House.getResidents() returns a Collection<Person>
> > and Person.getName() returns the Person's name (a String).
> >
> > Now say I use this PropertyModel on a House with no residents. I'll get
> > a IndexOutOfBoundsException.
> > Is there a way to define a default value for the Label in case the
> > PropertyModel cannot reach the property ?
> >
> > In my current situation, I cannot verify directly (before defining the
> > PropertyModel) if "myHouse" has any residents so the solution would have
> to
> > be related to the Label or the Model.
> >
> > Second,
> >
> > Using the same example, should my PropertyModel be " PropertyModel<House>
> "
> > or " PropertyModel<String> " ? Person.getName() returns a String.
> >
> > Thanks in advance !
> >
> > Sincerely,
> > Guillaume
> >
>
>
>
> --
> 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
>
>

Reply via email to