Question

Does anyone have an idea on how to implement a GWT CellTable with an ImageResourceCell from GWT 2.1M3?

I have the following but can't seem to figure out the correct way to add an 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");

//THIS IS NOT WORKING

       ct.addColumn(new IdentityColumn<DeviceInfo>(new ImageResourceCell()) {

       @Override
       public String getValue(DeviceInfo devInfo) {
        return <Some imageResource>;
       }
      }, "Status");

Any help on this would rock! Thanks.

Was it helpful?

Solution

I'm just sorting this out myself, but here's an example I have that works:

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");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top