Icon is a component.
You need to use either ComponentRenderer or Grid::addComponentColumn which internally uses ComponentRenderer.
By default toString is used to render any object.
I’m trying this and it doesn’t work, I get a blank TreeGrid
grid.addComponentColumn((ValueProvider<BroadworksComponent, Icon>) b -> b.getIcon())
grid.setHierarchyColumn("text", (ValueProvider<BroadworksComponent, BroadworksComponent>) b -> b.getThis());
getIcon() & getThis() is defined as:
public Icon getIcon() {
return VaadinIcon.BUILDING_O.create();
}
public BroadworksComponent getThis() { return this; }
BroadworksComponent extends Label
I would like to have the Label display as text in the grid WITH a ContextMenu attached that is class centric. Every class that extends BroadworksComponent will create a new ContextMenu
example
public class Customer extends BroadworksComponent {
String serviceProviderId;
String address1;
String address2;
String city;
String state;
String zip;
String country;
String domain;
public Customer(String text) {
super(text);
ContextMenu contextMenu = new ContextMenu();
contextMenu.setTarget(this);
contextMenu.addItem("Edit", e -> editDialog(e));
contextMenu.addItem("Add Location", e -> addLocation(e));
contextMenu.addItem("Add NG911 database record", e -> addNG911DatabaseRecord(e));
}