Hi all,
I have:
public FooPage( ... ) {
this.setDefaultModel( new CompoundPropertyModel(new
GenericIdLDM( Foo.class, 1)) );
add(new Label("title"));
I'd like to have $subj.
I've found this solution from 2007 (point below) :
http://www.mail-archive.com/[email protected]/msg29603.html
However, it wouldn't work for CPM as it needs the constructor with model.
How could I make it CPM?
Thanks,
Ondra
--------
public class DefaultTextModel extends AbstractReadOnlyModel<String> {
private final IModel<String> delegate;
private final String def;
public DefaultTextModel(String def, IModel delegate) {
this.def = def;
this.delegate = delegate;
}
public String getObject() {
String s = delegate.getObject();
return (Strings.isEmpty(s)) ? def : s;
}
public void detach() {
delegate.detach();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]