I am trying to create a CompositeCell that consists of TextCell and ButtonCell. I want to add a CompositeCell to Column, and then Column to CellTable. However, I cannot figure out what the column instance should look like. In particular, I cannot find its type parameters in the following code:
Column<FilterInfo, ?> compositeColumn = new Column<FilterInfo, ?>(createCompositeCell()) {
@Override
public Object getValue(Object object) {
return null;
}};
The method that creates a CompositeCell for the FilterInfo custom class (is it needed?):
private CompositeCell<FilterInfo> createCompositeCell(){
HasCell<FilterInfo, String> filterName = new HasCell<FilterInfo, String>() {
public Cell<String> getCell() {
return new TextCell();
}
public FieldUpdater<FilterInfo, String> getFieldUpdater() {
return null;
}
public String getValue(FilterInfo object) {
return object.getFilterName();
}};
HasCell<FilterInfo, String> filterButton = new HasCell<FilterInfo,String>(){
public Cell<String> getCell() {
return new ButtonCell();
}
public FieldUpdater<FilterInfo, String> getFieldUpdater() {
return null;
}
public String getValue(FilterInfo object) {
return "...";
}
};
List<HasCell<FilterInfo, ?>> cells = new ArrayList<HasCell<FilterInfo, ?>>();
cells.add(filterName);
cells.add(filterButton);
CompositeCell<FilterInfo> compositeCell = new CompositeCell<FilterInfo>(cells);
return compositeCell;
}
I would appreciate any guidance on adapting the code or other proposal to create the desired CompositeCell and add it to CellTable correctly.
source
share