2009/11/19 Jeremy Thomerson <[email protected]>
> http://cwiki.apache.org/WICKET/using-custom-converters.html
>
>
Thanks a lot , this solves my problem...
But , there is a more complicated situation :
Old code : (works in 1.3)
ListView poem = new ListView("poem" , new PropertyModel(model , "poem")
{
@Override
public Object getObject()
{
List<String> result = new ArrayList<String>();
String poemString = (String) super.getObject();
StringTokenizer st = new StringTokenizer(poemString);
while(st.hasMoreTokens())
result.add(st.nextToken());
return result;
}
})
{
@Override
protected void populateItem(ListItem listItem)
{
listItem.add(new Label("poemLine" ,
listItem.getDefaultModelObjectAsString()));
}
};
add(poem);
In the above code , it get "poem" ( a String ) from a PropertyModel , and
convert it to List<String> ,
and then render each String in the populateItem() method.
I look into IConverter and AbstractConverter , both need to convert Object
to String , not what I need ( List<String> )
How should I solve this problem ?