Hi,

I've checked Image's source class and it seems that it doesn't support compound models (see comments in method initModel()).
Hi there,

I have a rather simple problem, but could find a solution yet. I wanna
combine text and an image in ONE model. The image is defined by a
ContextRelativeResource. It works all as assumed, except for the
image. Here the whole thing:

public class Team extends WebPage
{
        public static class TeamMember implements Serializable
        {
                final String name;
                final Integer age;
                final ContextRelativeResource picture;
//              final PackageResource picture;

                public TeamMember (final String name, final Integer age, String 
pic)
                {
                        this.name = name;
                        this.age = age;
                        this.picture = new ContextRelativeResource ("image/" + 
pic);
                }
        }

        public Team ()
        {
                CompoundPropertyModel<TeamMember>  tm = new
CompoundPropertyModel<TeamMember>  (reneTm) ;
                setDefaultModel (tm) ;

                add (new Label ("name"));  // works with string
                add (new Label ("age"));   // works with Integer

                add (new Image ("picture")); // DOESNT WORK??

//              Image image = new Image ("picture", tm.getObject ().picture);
//    image.getDefaultModelObject () == NULL  ????

        }
}

For the completeness, here the markup:

<table border="1">
        <tr>
                <td>
                        <span wicket:id="name"></span>
                </td>
                <td>
                        <img src="#" alt="" wicket:id="picture">
                </td>
                <td>
                        <span wicket:id="age"></span>
                </td>
        </tr>
</table>

It seems, that Image doesnt use the CompoundPropertyModel which I set
as the default model. If I would use Label instead of Image, the
correct ContextRelativeResource will be retrieved from the model.

What did I do wrong, or how to combine text and image in one Model??

Regards,
Rene

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




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

Reply via email to