Hi,

I'v got this in a list:

add(new Label("name"))

sometimes there's no name defined, then I want to set a default text,
I'd do it like this:

add(new Label("name").setDefaultModel(new Model("No name defined")));

Now I have it like this:

item.add(new Label("name", new PropertyModel(item.getModel(),"name")){
  @Override
  protected void onComponentTagBody(MarkupStream markupStream,
ComponentTag openTag) {
    String model = (String) getModelObject();
      if (model == null){
        replaceComponentTagBody(markupStream, openTag, "no language selected");
      } else {
        super.onComponentTagBody(markupStream, openTag)
      }
}
});

This is really verbose. Anybody knows a better way?

thanks a lot,

Pieter



-- 
Pieter Cogghe
Ganzendries 186
9000 Gent
0487 10 14 21

-------------------------------------------------------------------------
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