Currently, the implementations of AjaxEditablelabel and
AjaxEditableMultilineLabel have a funny flaw: if you their model value
is null/ empty, there is no text to select and no way to ever get into
edit mode again.

I think this should be fixed; it is crazy to expect users to write
special models for this case.

One way to fix it is:

        protected Component newLabel(MarkupContainer parent, String
componentId, IModel<T> model)
        {
                WebComponent<T> label = new WebComponent<T>(this, componentId, 
model)
                {
                        private static final long serialVersionUID = 1L;

                        @Override
                        protected void onComponentTagBody(MarkupStream 
markupStream,
ComponentTag openTag)
                        {
                                String string = getModelObjectAsString();
                                if (string == null || string.equals(""))
                                {
                                        string = "...";
                                }
                                replaceComponentTagBody(markupStream, openTag, 
string);
                        }
                };
                label.setOutputMarkupId(true);
                label.add(new LabelAjaxBehavior(ClientEvent.CLICK));
                return label;
        }

which would display ... on an empty model. And maybe ... could come
from a non-final protected method so that it is easy to customize
without having to know how to properly construct a label.

What do you think?

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