i´m trying to implement a converter that converts a string into a coresponding embedded icon object.
everytime i´m getting this fault: The converter presentation type class com.vaadin.ui.Embedded is not compatible with the renderer presentation type class java.lang.String (in Column[propertyId:xxxx)
public class IconTypeConverter implements Converter<Embedded, String>{
@Override
public String convertToModel(Embedded value, Class<? extends String> targetType, Locale locale)
throws com.vaadin.data.util.converter.Converter.ConversionException {
return null;
}
@Override
public Embedded convertToPresentation(String value, Class<? extends Embedded> targetType, Locale locale)
throws com.vaadin.data.util.converter.Converter.ConversionException {
return new Embedded(caption, new ThemeResource(sourcepath))
}
@Override
public Class<String> getModelType() {
return String.class;
}
@Override
public Class<Embedded> getPresentationType() {
return Embedded.class;
}
}
Based on your description you are trying to use this IconTypeConverter in Grid.Column. Embedded is a Component, and hence do not have string presentation that Grid could show. That is why you get this error.
I assume that you are trying to show an icon.
In that case you need two phase approach. You need String to String converter that converts your icon to HTML presentation (i.e. String containing the HTML) and then set HTMLRenderer to that same column.