I used a link rendered as a FontAwesome-Icon (aka LinkButton) before Vaadin 7.4. Using the BeanItemContainer we did so by adding generated columns like this:
table.addGeneratedColumn(FIELD_SHOW_DETAILS_LINK, new Table.ColumnGenerator() {
private static final long serialVersionUID = 1L;
@Override
public Object generateCell(final Table source, final Object itemId, Object columnId) {
final Link link = new Link();
link.setDescription("Show details");
link.setIcon(FontAwesome.SEARCH);
link.setResource(new ExternalResource("#!details/"
+ ((MainVO) itemId).getUid() + "?mode=VIEW"));
link.addStyleName("fa");
return link;
}
});
With the CSS-Style like this:
.fa {
font-family: FontAwesome;
color: gray;
text-decoration: none;
font-weight: normal;
padding-left: 5px;
padding-right: 5px;
}
I tried to "translate" this for the new Grid using a PropertyValueGenerator with the addGeneratedProperty-method. But that did not work out, the layout just shows the object notation of the Link-class.
Any help much appreciated!
You can add a generated property within the GeneratedPropertyContainer which returns a String Property (FontAwesome.XXX.getHtml()) and add a HTML-Renderer to that column in the grid.
To add the Property
and to add the Renderer: