> Yes ... from a template method for easy configuration would be fine. I could

Was not such a good idea after all I just found out as - of course -
that is used as the next input.

> also think of cases when you would prefer "" (empty string) as default value
> and then, using css, make the label fill the content which it is in, like a
> table cell f.ex.

Can't we make that the default? You know how to do that?

This is one alternative:

public class NullValueModelDecorator<T> implements IWrapModel<T>
{
        private static final long serialVersionUID = 1L;

        private final IModel<T> model;

        private final T replacementForNull;

        public NullValueModelDecorator(IModel<T> model, T replacementForNull)
        {
                this.model = model;
                this.replacementForNull = replacementForNull;
        }

        public void detach()
        {
        }

        public IModel getNestedModel()
        {
                return null;
        }


        public T getObject()
        {
                T value = model.getObject();
                return (value != null) ? value : replacementForNull;
        }

        public void setObject(T object)
        {
                if (object != null && (!replacementForNull.equals(object)))
                {
                        model.setObject(object);
                }
        }
}

but the css way sounds more elegant

Eelco

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-develop mailing list
Wicket-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-develop

Reply via email to