editor.addColumn(column, "New Value"); // TODO : i18n
}
// edit / undo edit
{
Column<PropertyUpdateInfo, String> column = new Column<PropertyUpdateInfo, String>(new ButtonCell()) {
@Override
public String getValue(PropertyUpdateInfo entry) {
return "Edit";
}
};
editor.addColumn(column);
column.setFieldUpdater(new FieldUpdater<PropertyUpdateInfo, String>() {
@Override
public void update(int index, final PropertyUpdateInfo e, String value) {
if (e.isDeleteFlag()) {
Window.alert("You can't edit a deleted property");
return;
}
PropertyEditCallback callback = new PropertyEditCallback() {
@Override
public void onEditSuccess(PropertyInfo newInfo) {
if (e.getInfo() == null) { // new property, always set newInfo
e.setNewInfo(newInfo);
} else if (e.getInfo().equals(newInfo)) { // existing property, nothing changed, ignore change
e.setNewInfo(null);
} else if (SharedConstants.Datastore.KEY_RESERVED_NAME.equals(e.getName()) &&
PropertyType.typeOf(newInfo) != PropertyType.KEY) { // existing property, name conflict, reject
Window.alert("__key__ property only accept key type");
}else { // existing property, something changed
e.setNewInfo(newInfo);
}
dataProvider.refresh();
}
};
editorManager.edit(origKey.getKeyString(),
e.getNewInfo() == null ? e.getInfo() : e.getNewInfo(), callback);
}
});
}
// delete / undo delete
{
Column<PropertyUpdateInfo, String> column = new Column<PropertyUpdateInfo, String>(new ButtonCell()) {
@Override
public String getValue(PropertyUpdateInfo entry) {
if (entry.isDeleteFlag()) {
return "Undo(X)";
} else {