GWT CellTable com ImageResourceCell
-
26-09-2019 - |
Pergunta
Alguém tem uma idéia de como implementar uma CellTable GWT com um ImageResourceCell do GWT 2.1M3?
Eu tenho o seguinte, mas não consigo descobrir a maneira correta de adicionar um ImageResourceCell
CellTable<DeviceInfo> ct = new CellTable<DeviceInfo>();
// ct.setSelectionEnabled(true);
ct.setSelectionModel(setSelectionModel(ct));
ct.setPageSize(50);
// listData.addView(ct);
listData.addDataDisplay(ct);
ct.addColumn(new TextColumn<DeviceInfo>() {
@Override
public String getValue(DeviceInfo devInfo) {
return devInfo.getDeviceName();
}
}, "Name");
//ISTO NÃO ESTÁ A FUNCIONAR
ct.addColumn(new IdentityColumn<DeviceInfo>(new ImageResourceCell()) {
@Override
public String getValue(DeviceInfo devInfo) {
return <Some imageResource>;
}
}, "Status");
Qualquer ajuda nisso rock! Obrigado.
Solução
Estou apenas resolvendo isso sozinho, mas aqui está um exemplo que tenho que funciona:
CellTable<Entity> dataTable = new CellTable<Entity>();
Column<Entity, ImageResource> status = new Column<Entity, ImageResource>(new ImageResourceCell()) {
@Override
public ImageResource getValue(Entity entity) {
...ImageResource lookup stuff...
return imgRsrc;
}
};
dataTable.addColumn(status, "Status");
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow