addProp.getElement().setAttribute("style", "float:right");
addProp.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
PropertyRecord newRecord = beanFactory.property().as();
newRecord.setKey("key");
newRecord.setValue("value");
propertyProvider.getList().add(newRecord);
propertyProvider.refresh();
}
});
//add(addProp);
// Create columns
Column<PropertyRecord, String> keyColumn = new Column<PropertyRecord, String>(new DefaultEditTextCell()) {
{
setFieldUpdater(new FieldUpdater<PropertyRecord, String>() {
@Override
public void update(int index, PropertyRecord object, String value) {
object.setKey(value);
}
});
}
@Override
public String getValue(PropertyRecord object) {
return object.getKey();
}
};
Column<PropertyRecord, String> valueColumn = new Column<PropertyRecord, String>(new DefaultEditTextCell()) {
{
setFieldUpdater(new FieldUpdater<PropertyRecord, String>() {
@Override
public void update(int index, PropertyRecord object, String value) {
object.setValue(value);
}
});
}
@Override
public String getValue(PropertyRecord object) {
return object.getValue();
}
};
OptionCell optionCell = new OptionCell("remove", new ActionCell.Delegate<String>()
{
@Override
public void execute(String rowNum) {
Integer row = Integer.valueOf(rowNum);
PropertyRecord propertyRecord = propertyProvider.getList().get(row);
propertyProvider.getList().remove(propertyRecord);
propertyProvider.refresh();
}
});