use of org.gwtbootstrap3.client.ui.gwt.ButtonCell in project drools-wb by kiegroup.
the class GlobalsEditorViewImpl method setup.
private void setup() {
// Setup table
table.setStriped(true);
table.setCondensed(true);
table.setBordered(true);
table.setEmptyTableWidget(new Label(translationService.getTranslation(GlobalsEditorConstants.GlobalsEditorViewImplNoGlobalsDefined)));
// Columns
final TextColumn<Global> aliasColumn = new TextColumn<Global>() {
@Override
public String getValue(final Global global) {
return global.getAlias();
}
};
final TextColumn<Global> classNameColumn = new TextColumn<Global>() {
@Override
public String getValue(final Global global) {
return global.getClassName();
}
};
deleteGlobalButton = new ButtonCell(IconType.MINUS, ButtonType.DANGER, ButtonSize.SMALL);
final Column<Global, String> deleteGlobalColumn = new Column<Global, String>(deleteGlobalButton) {
@Override
public String getValue(final Global global) {
return translationService.getTranslation(GlobalsEditorConstants.GlobalsEditorViewImplRemove);
}
};
deleteGlobalColumn.setFieldUpdater((index, global, value) -> {
if (Window.confirm(translationService.format(GlobalsEditorConstants.GlobalsEditorViewImplPromptForRemovalOfGlobal, global.getAlias()))) {
dataProvider.getList().remove(index);
}
});
table.addColumn(aliasColumn, new TextHeader(translationService.getTranslation(GlobalsEditorConstants.GlobalsEditorViewImplAlias)));
table.addColumn(classNameColumn, new TextHeader(translationService.getTranslation(GlobalsEditorConstants.GlobalsEditorViewImplClassName)));
table.addColumn(deleteGlobalColumn, translationService.getTranslation(GlobalsEditorConstants.GlobalsEditorViewImplRemove));
// Link data
dataProvider.addDataDisplay(table);
dataProvider.setList(globals);
generatedLabel.setText(translationService.getTranslation(GlobalsEditorConstants.GlobalsEditorViewImplAutoGeneratedFile));
addGlobalButton.setText(translationService.getTranslation(GlobalsEditorConstants.GlobalsEditorViewImplAdd));
addGlobalButton.setIcon(IconType.PLUS);
}
Aggregations