GXT 3 - ColumnConfig.setCell() not working for CompositeCell

僤鯓⒐⒋嵵緔 提交于 2019-12-13 05:34:18

问题


I am trying to create a column with multiple images in a single grid cell. The following is the column config

 private ColumnConfig<SensorTreeModel,ImageResource> actionsCol;
 actionsCol = new ColumnConfig<SensorTreeModel,ImageResource>(new ValueProvider<SensorTreeModel, ImageResource>() {
          com.sencha.project.client.Resources resources = GWT.create(com.sencha.project.client.Resources.class);
            @Override
            public ImageResource getValue(SensorTreeModel object) {

                ImageResource add = com.sencha.project.client.Resources.INSTANCES.add();
                return add;
           }

            @Override
            public void setValue(SensorTreeModel object, ImageResource value) {
              if (object.getIsLeaf()) {

              }
            }

            @Override
            public String getPath() {
              return "actions";
            }
          });
      actionsCol.setHeader("");
      //This is where an error occurs      
     actionsCol.setCell(compositeCell);

Each of my image cell looks like below:

public class ImageCell implements HasCell<SensorTreeModel, ImageResource>{
private ImageResourceCell imageCell = new ImageResourceCell();
@Override
public Cell<ImageResource> getCell() {
    // TODO Auto-generated method stub
    return imageCell;
}

@Override
public FieldUpdater<SensorTreeModel, ImageResource> getFieldUpdater() {
    // TODO Auto-generated method stub
    return new FieldUpdater<SensorTreeModel, ImageResource>() {
          @Override
          public void update(int index, SensorTreeModel object, ImageResource value) {
             //object.setLast(ImageResource(value));
          }         
        };
}

@Override
public ImageResource getValue(SensorTreeModel object) {
    // TODO Auto-generated method stub
    return com.sencha.project.client.Resources.INSTANCES.add();
}

}

The composite cell looks like below:

 List<HasCell<SensorTreeModel, ?>> cells= new ArrayList<HasCell<SensorTreeModel,?>>();
      cells.add(new com.sencha.project.client.ImageCell());
      cells.add(new com.sencha.project.client.ImageCell());

      CompositeCell<SensorTreeModel> compositeCell = new CompositeCell<SensorTreeModel>(cells); 

So, what I am trying to do is create a number of images in a grid cell. I initially create an ImageCell which returns an image. Now, I add number of these cells onto the composite cell. Later I reference this composite cell from the setCell function in actionsCol (column config).

来源:https://stackoverflow.com/questions/36127646/gxt-3-columnconfig-setcell-not-working-for-compositecell

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!