How do Wicket models work with the general?

I would like to learn something about models that support the wicket, with a common. I understood the models, the prop model and the prop connection model.

But what about the model class? What happens if I do this:

Label<Person> label = new Label<Person> ( "someID", new Model<Person>() )

What will be displayed on this label? toString output?

Let's say I have the same in TextField. What value will it set in this object?

+5
source share
1 answer

Wicket source code is very well documented and requires no explanation. Labeluses getDefaultModelObjectAsString()from Component, which is as follows:

// Get converter
final Class<?> objectClass = modelObject.getClass();

final IConverter converter = getConverter(objectClass);

// Model string from property
final String modelString = converter.convertToString(modelObject, getLocale());

, , Wicket IConverter String. ConverterLocator, , IConverter , Wicket DefaultConverter, org.apache.wicket.util.lang.Objects String.

TextField IConverter String String . , Wicket String toString, . , IModel<Person> TextField, IConverter<Person>.

+7

All Articles