Lowell,

Sorry for my bad answers today, I was doing too many things at the
same time, and now that I re-read your use case I think I understand
better what you want.

If I'm correct, you want to decorate a label with a star, and use some
css class or id with that star and have the ability to turn the star
off or on depending on a condition.

Disregard the rest of the thread, because indeed Labels (or any
component replacing their bodies) don't allow nested components. Your
best choice is to use a behavior:

        label.add(new AbstractBehavior() {

                @Override
                public boolean isEnabled(Component component) {
                        return myCondition();
                }
        
                @Override
                public void onRendered(Component component) {
                        Response response = component.getResponse();
                        response.write("<span id='foo' class='bar'>*</span>");
                }
        });

The behavior writes directly to the response (after the component
itself is rendered) and the visibility can be steered using isEnabled.

Do note that if it wasn't for the fact that you're trying to decorate
labels, you could have used Borders instead of a behavior. Not to say
that this is better, just be aware of the alternative (in case you are
annotating markupcontainers).

Hope this helps,

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

Reply via email to