But I get the following error:

...WicketMessage: Expected close tag for '<span wicket:id="foobar">'
Possible attempt to embed component(s) '<span wicket:id="star">' in
the body of this component which discards its body

Doesn't that mean my approach is flawed?

On 5/31/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
> Then you should be able to use that label idea and embed it in your component.
>
> Eelco
>
> On 5/31/07, Lowell Kirsh <[EMAIL PROTECTED]> wrote:
> > Once again I left out a detail - the reason I have the span is that I
> > want to apply a CSS class to the star. Also, I like to have the star
> > as a child of the other component, because that way I don't have to
> > assign unique names to each star, and also, I can package the text and
> > the star as one object type (or just use a single method to deal with
> > both at once) so that I don't have duplicated code.
> >
> > On 5/31/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
> > > On 5/31/07, Lowell Kirsh <[EMAIL PROTECTED]> wrote:
> > > > My use case is actually turning out slightly more complex than I
> > > > posted. What I actually have is:
> > > >
> > > > <span wicket:id="foo">TEXT<span wicket:id="star">*</span><span>
> > > >
> > > > and I'd like to sometimes remove the star. So my java (which doesn't
> > > > work) looks like:
> > > >
> > > >    private static class LabelWithStar extends WebMarkupContainer
> > > >     {
> > > >         public LabelWithStar(String id, String model, final boolean
> > > > starIsVisible)
> > > >         {
> > > >             super(id, new Model(model));
> > > >             this.add(new WebMarkupContainer("star") {
> > > >                 public boolean isVisible()
> > > >                 {
> > > >                     return starIsVisible;
> > > >                 }
> > > >             });
> > > >         }
> > > >
> > > >         protected void onComponentTagBody(MarkupStream markupStream,
> > > > ComponentTag openTag)
> > > >         {
> > > >             replaceComponentTagBody(markupStream, openTag,
> > > > getModelObjectAsString());
> > > >         }
> > > >     }
> > > >
> > > > This doesn't work because the call to replaceComponentTagBody()
> > > > removes the span with the star. How should I be doing this instead?
> > >
> > > You mean you need to have the span? Why is that?
> > >
> > > Alternatively, you can do something like
> > >
> > > add(new Label("star", new AbstractReadOnlyModel() {
> > >
> > >         @Override
> > >         public Object getObject() {
> > >                 return isStarVisible() ? "*" : "";
> > >                 }
> > >         }));
> > > }
> > >
> > >
> > > Eelco
> > >
> > > -------------------------------------------------------------------------
> > > This SF.net email is sponsored by DB2 Express
> > > Download DB2 Express C - the FREE version of DB2 express and take
> > > control of your XML. No limits. Just data. Click to get it now.
> > > http://sourceforge.net/powerbar/db2/
> > > _______________________________________________
> > > Wicket-user mailing list
> > > Wicket-user@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/wicket-user
> > >
> >
> > -------------------------------------------------------------------------
> > This SF.net email is sponsored by DB2 Express
> > Download DB2 Express C - the FREE version of DB2 express and take
> > control of your XML. No limits. Just data. Click to get it now.
> > http://sourceforge.net/powerbar/db2/
> > _______________________________________________
> > Wicket-user mailing list
> > Wicket-user@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to