我正在尝试将一个动作单元添加到 GWT 数据网格中,但我在这样做时遇到了麻烦。我查看了 GWT 展示,发现了一个将 actioncell 添加到 celltable 的示例,如下所示
// ActionCell.
addColumn(new ActionCell<ContactInfo>(
"Click Me", new ActionCell.Delegate<ContactInfo>() {
public void execute(ContactInfo contact) {
Window.alert("You clicked " + contact.getFullName());
}
}), "Action", new GetValue<ContactInfo>() {
public ContactInfo getValue(ContactInfo contact) {
return contact;
}
}, null);
这是我的尝试,但我不知道这在语法上应该如何看待,它是如何工作的?
Column<OpInventory, ActionCell<OpInventory>> checkColumn = new Column<OpInventory,
//I get an error on instantiating the Delegate
ActionCell<OpInventory>>(new ActionCell("x", new ActionCell.Delegate<OpInventory>())) {
//this is wrong here
@Override
public ActionCell getValue(OpInventory object) {
// TODO Auto-generated method stub
return null;
}
};
table.addColumn(checkColumn, SafeHtmlUtils.fromSafeConstant("<br/>"));
table.setColumnWidth(checkColumn, 40, Unit.PX);