开发者

GWT CellTable with ImageResourceCell

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.s开发者_开发问答etPageSize(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.


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");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜