ColumnConfig[] columnConfigs = {keyCol, valueCol};
ColumnModel columnModel = new ColumnModel(columnConfigs);
columnModel.setDefaultSortable(true);
final EditorGridPanel grid = new EditorGridPanel();
Toolbar toolbar = new Toolbar();
ToolbarButton add = new ToolbarButton(constants.Add(), new ButtonListenerAdapter() {
public void onClick(Button button, EventObject e) {
addNewField(recordDef, grid);
}
});
toolbar.addButton(add);
/*ToolbarButton delete = new ToolbarButton("Delete", new ButtonListenerAdapter() {
public void onClick(Button button, EventObject e) {
store.remove(store.getRecordAt(grid.getPosition()[1]));
if(store.getTotalCount() == 0){
addNewField(recordDef, grid);
}
}
});
toolbar.addButton(delete);*/
ToolbarButton clear = new ToolbarButton(constants.Clear(), new ButtonListenerAdapter() {
public void onClick(Button button, EventObject e) {
store.removeAll();
addNewField(recordDef, grid);
}
});
toolbar.addButton(clear);
grid.setStore(store);
grid.setColumnModel(columnModel);
grid.setWidth(215);
grid.setHeight(300);
grid.setTitle(constants.Properties());
grid.setFrame(true);
grid.setClicksToEdit(2);
grid.setTopToolbar(toolbar);
panel.add(grid);
layout.addRow(grid);
}