Search in sources :

Example 16 with ButtonCell

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);
}
Also used : TextColumn(com.google.gwt.user.cellview.client.TextColumn) Column(com.google.gwt.user.cellview.client.Column) Label(org.gwtbootstrap3.client.ui.Label) TextHeader(com.google.gwt.user.cellview.client.TextHeader) ButtonCell(org.gwtbootstrap3.client.ui.gwt.ButtonCell) Global(org.drools.workbench.screens.globals.model.Global) TextColumn(com.google.gwt.user.cellview.client.TextColumn)

Aggregations

Column (com.google.gwt.user.cellview.client.Column)16 ButtonCell (org.gwtbootstrap3.client.ui.gwt.ButtonCell)12 AbstractCell (com.google.gwt.cell.client.AbstractCell)4 ValueUpdater (com.google.gwt.cell.client.ValueUpdater)4 Element (com.google.gwt.dom.client.Element)4 NativeEvent (com.google.gwt.dom.client.NativeEvent)4 SafeHtmlBuilder (com.google.gwt.safehtml.shared.SafeHtmlBuilder)4 HTMLButtonElement (elemental2.dom.HTMLButtonElement)4 Button (org.gwtbootstrap3.client.ui.Button)4 Icon (org.gwtbootstrap3.client.ui.Icon)4 PostConstruct (javax.annotation.PostConstruct)3 Label (org.gwtbootstrap3.client.ui.Label)2 NotificationRow (org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.NotificationRow)2 ReassignmentRow (org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.ReassignmentRow)2 TextCell (com.google.gwt.cell.client.TextCell)1 TextColumn (com.google.gwt.user.cellview.client.TextColumn)1 TextHeader (com.google.gwt.user.cellview.client.TextHeader)1 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)1 Global (org.drools.workbench.screens.globals.model.Global)1 ContainerConfigParamsView_ArtifactIdColumn (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.ContainerConfigParamsView_ArtifactIdColumn)1