GWT CellTable con ImageResourceCell
-
26-09-2019 - |
Domanda
Qualcuno ha un'idea su come implementare un GWT CellTable con un'ImageResourceCell da GWT 2.1M3?
Ho il seguente, ma non riesco a capire il modo corretto per aggiungere un 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");
// questo non sta funzionando
ct.addColumn(new IdentityColumn<DeviceInfo>(new ImageResourceCell()) {
@Override
public String getValue(DeviceInfo devInfo) {
return <Some imageResource>;
}
}, "Status");
Qualsiasi aiuto su questo sarebbe rock! Grazie.
Soluzione
Sono solo l'ordinamento questo fuori me stesso, ma ecco un esempio che ho che le opere:
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");
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow