Search in sources :

Example 46 with Button

use of org.gwtbootstrap3.client.ui.Button in project kie-wb-common by kiegroup.

the class MultipleValuePairEditorViewImpl method addItemEditor.

@Override
public Integer addItemEditor(ValuePairEditor<?> valuePairEditor) {
    Row itemEditorRow = new Row();
    Column itemEditorColumn = new Column(ColumnSize.MD_10);
    final Integer itemId = nextItemId();
    valuePairEditor.showValuePairName(false);
    valuePairEditor.addEditorHandler(new ValuePairEditorHandler() {

        @Override
        public void onValidate() {
        }

        @Override
        public void onValueChange() {
            presenter.onValueChange(itemId);
        }
    });
    itemEditorColumn.add(valuePairEditor);
    itemEditorRow.add(itemEditorColumn);
    Column deleteButtonColumn = new Column(ColumnSize.MD_2);
    Button deleteButton = new Button(Constants.INSTANCE.advanced_domain_multiple_value_pair_editor_action_delete());
    deleteButton.setType(ButtonType.LINK);
    deleteButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            presenter.onRemoveItem(itemId);
        }
    });
    deleteButtonColumn.add(deleteButton);
    itemEditorRow.add(deleteButtonColumn);
    itemsPanel.add(itemEditorRow);
    indexToEditor.put(itemId, valuePairEditor);
    indexToEditorWidget.put(itemId, itemEditorRow);
    return itemId;
}
Also used : ValuePairEditorHandler(org.kie.workbench.common.screens.datamodeller.client.widgets.advanceddomain.valuepaireditor.ValuePairEditorHandler) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) Column(org.gwtbootstrap3.client.ui.Column) Button(org.gwtbootstrap3.client.ui.Button) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) Row(org.gwtbootstrap3.client.ui.Row)

Example 47 with Button

use of org.gwtbootstrap3.client.ui.Button in project kie-wb-common by kiegroup.

the class CopyPopupWithPackageViewTest method setup.

@Before
public void setup() {
    final CopyPopUpPresenter presenter = mock(CopyPopUpPresenter.class);
    doReturn(PathFactory.newPath("my-file.txt", "my-project/src/main/resources/my-file.txt")).when(presenter).getPath();
    copyView = spy(new CopyPopupWithPackageView());
    copyView.presenter = presenter;
    copyView.packageListBox = mock(PackageListBox.class);
    copyView.translationService = mock(TranslationService.class);
    doReturn(mock(Package.class)).when(copyView.packageListBox).getSelectedPackage();
    doReturn(mock(Button.class)).when(copyView).button(anyString(), any(Command.class), any(ButtonType.class));
    packageLoadedCommandCaptor = ArgumentCaptor.forClass(Command.class);
    doNothing().when(copyView.packageListBox).setUp(eq(true), packageLoadedCommandCaptor.capture());
}
Also used : CopyPopUpPresenter(org.uberfire.ext.editor.commons.client.file.popups.CopyPopUpPresenter) PackageListBox(org.kie.workbench.common.widgets.client.handlers.PackageListBox) TranslationService(org.jboss.errai.ui.client.local.spi.TranslationService) Button(org.gwtbootstrap3.client.ui.Button) Command(org.uberfire.mvp.Command) Package(org.guvnor.common.services.project.model.Package) ButtonType(org.gwtbootstrap3.client.ui.constants.ButtonType) Before(org.junit.Before)

Example 48 with Button

use of org.gwtbootstrap3.client.ui.Button in project kie-wb-common by kiegroup.

the class ImportsWidgetViewImpl method setup.

private void setup() {
    // Setup table
    table.setStriped(true);
    table.setCondensed(true);
    table.setBordered(true);
    table.setEmptyTableWidget(new Label(ImportConstants.INSTANCE.noImportsDefined()));
    // Columns
    final TextColumn<Import> importTypeColumn = new TextColumn<Import>() {

        @Override
        public String getValue(final Import importType) {
            return importType.getType();
        }
    };
    final ButtonCell deleteImportButton = new ButtonCell(IconType.TRASH, ButtonType.DANGER, ButtonSize.SMALL) {

        @Override
        public void render(final com.google.gwt.cell.client.Cell.Context context, final SafeHtml data, final SafeHtmlBuilder sb) {
            // Don't render a "Delete" button for "internal" Fact Types
            if (isExternalImport(context.getIndex())) {
                super.render(context, data, sb);
            }
        }

        @Override
        public void onBrowserEvent(final Context context, final Element parent, final String value, final NativeEvent event, final ValueUpdater<String> valueUpdater) {
            // Don't act on cell interactions for "internal" Fact Types
            if (isExternalImport(context.getIndex())) {
                super.onBrowserEvent(context, parent, value, event, valueUpdater);
            }
        }

        @Override
        protected void onEnterKeyDown(final Context context, final Element parent, final String value, final NativeEvent event, final ValueUpdater<String> valueUpdater) {
            // Don't act on cell interactions for "internal" Fact Types
            if (isExternalImport(context.getIndex())) {
                super.onEnterKeyDown(context, parent, value, event, valueUpdater);
            }
        }
    };
    final Column<Import, String> deleteImportColumn = new Column<Import, String>(deleteImportButton) {

        @Override
        public String getValue(final Import importType) {
            return ImportConstants.INSTANCE.remove();
        }
    };
    deleteImportColumn.setFieldUpdater((index, importType, value) -> {
        if (isReadOnly) {
            return;
        }
        final YesNoCancelPopup confirm = YesNoCancelPopup.newYesNoCancelPopup(ImportConstants.INSTANCE.remove(), ImportConstants.INSTANCE.promptForRemovalOfImport0(importType.getType()), () -> getRemoveImportCommand().execute(importType), () -> {
        /*Nothing*/
        }, null);
        confirm.show();
    });
    table.addColumn(importTypeColumn, new TextHeader(ImportConstants.INSTANCE.importType()));
    table.addColumn(deleteImportColumn, ImportConstants.INSTANCE.remove());
    // Link display
    getDataProvider().addDataDisplay(table);
}
Also used : Import(org.kie.soup.project.datamodel.imports.Import) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) Element(com.google.gwt.dom.client.Element) Label(org.gwtbootstrap3.client.ui.Label) YesNoCancelPopup(org.uberfire.ext.widgets.common.client.common.popups.YesNoCancelPopup) TextHeader(com.google.gwt.user.cellview.client.TextHeader) SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder) ValueUpdater(com.google.gwt.cell.client.ValueUpdater) TextColumn(com.google.gwt.user.cellview.client.TextColumn) Column(com.google.gwt.user.cellview.client.Column) ButtonCell(org.gwtbootstrap3.client.ui.gwt.ButtonCell) TextColumn(com.google.gwt.user.cellview.client.TextColumn) NativeEvent(com.google.gwt.dom.client.NativeEvent)

Example 49 with Button

use of org.gwtbootstrap3.client.ui.Button in project kie-wb-common by kiegroup.

the class ProjectDiagramEditorMenuItemsBuilder method newExportsItem.

public MenuItem newExportsItem(final Command exportPNGCommand, final Command exportJPGCommand, final Command exportPDFCommand, final Command exportBPMNCommand) {
    final DropDownMenu menu = new DropDownMenu() {

        {
            setPull(Pull.RIGHT);
        }
    };
    menu.add(new AnchorListItem(translationService.getValue(CoreTranslationMessages.EXPORT_PNG)) {

        {
            setIcon(IconType.FILE_IMAGE_O);
            setIconPosition(IconPosition.LEFT);
            setTitle(translationService.getValue(CoreTranslationMessages.EXPORT_PNG));
            addClickHandler(event -> exportPNGCommand.execute());
        }
    });
    menu.add(new AnchorListItem(translationService.getValue(CoreTranslationMessages.EXPORT_JPG)) {

        {
            setIcon(IconType.FILE_IMAGE_O);
            setIconPosition(IconPosition.LEFT);
            setTitle(translationService.getValue(CoreTranslationMessages.EXPORT_JPG));
            addClickHandler(event -> exportJPGCommand.execute());
        }
    });
    menu.add(new AnchorListItem(translationService.getValue(CoreTranslationMessages.EXPORT_PDF)) {

        {
            setIcon(IconType.FILE_PDF_O);
            setIconPosition(IconPosition.LEFT);
            setTitle(translationService.getValue(CoreTranslationMessages.EXPORT_PDF));
            addClickHandler(event -> exportPDFCommand.execute());
        }
    });
    menu.add(new AnchorListItem(translationService.getValue(CoreTranslationMessages.EXPORT_BPMN)) {

        {
            setIcon(IconType.FILE_TEXT_O);
            setIconPosition(IconPosition.LEFT);
            setTitle(translationService.getValue(CoreTranslationMessages.EXPORT_BPMN));
            addClickHandler(event -> exportBPMNCommand.execute());
        }
    });
    final IsWidget group = new ButtonGroup() {

        {
            add(new Button() {

                {
                    setToggleCaret(true);
                    setDataToggle(Toggle.DROPDOWN);
                    setIcon(IconType.DOWNLOAD);
                    setSize(ButtonSize.SMALL);
                    setTitle(translationService.getValue(StunnerProjectClientConstants.DOWNLOAD_DIAGRAM));
                }
            });
            add(menu);
        }
    };
    return buildItem(group);
}
Also used : AnchorListItem(org.gwtbootstrap3.client.ui.AnchorListItem) IconType(org.gwtbootstrap3.client.ui.constants.IconType) Pull(org.gwtbootstrap3.client.ui.constants.Pull) DropDownMenu(org.gwtbootstrap3.client.ui.DropDownMenu) IconPosition(org.gwtbootstrap3.client.ui.constants.IconPosition) StunnerProjectClientConstants(org.kie.workbench.common.stunner.project.client.resources.i18n.StunnerProjectClientConstants) Button(org.gwtbootstrap3.client.ui.Button) Inject(javax.inject.Inject) ClientTranslationService(org.kie.workbench.common.stunner.core.client.i18n.ClientTranslationService) Toggle(org.gwtbootstrap3.client.ui.constants.Toggle) MenuUtils(org.kie.workbench.common.stunner.client.widgets.menu.MenuUtils) CoreTranslationMessages(org.kie.workbench.common.stunner.core.i18n.CoreTranslationMessages) MenuItem(org.uberfire.workbench.model.menu.MenuItem) MenuDevCommandsBuilder(org.kie.workbench.common.stunner.client.widgets.menu.dev.MenuDevCommandsBuilder) ApplicationScoped(javax.enterprise.context.ApplicationScoped) IsWidget(com.google.gwt.user.client.ui.IsWidget) PopupUtil(org.kie.workbench.common.stunner.client.widgets.popups.PopupUtil) ButtonSize(org.gwtbootstrap3.client.ui.constants.ButtonSize) Command(org.uberfire.mvp.Command) ButtonGroup(org.gwtbootstrap3.client.ui.ButtonGroup) IsWidget(com.google.gwt.user.client.ui.IsWidget) AnchorListItem(org.gwtbootstrap3.client.ui.AnchorListItem) ButtonGroup(org.gwtbootstrap3.client.ui.ButtonGroup) Button(org.gwtbootstrap3.client.ui.Button) DropDownMenu(org.gwtbootstrap3.client.ui.DropDownMenu)

Example 50 with Button

use of org.gwtbootstrap3.client.ui.Button in project kie-wb-common by kiegroup.

the class ShapeSetsMenuItemsBuilder method build.

public MenuItem build(final String title, final String prefix, final Callback callback) {
    final DropDownMenu menu = new DropDownMenu() {

        {
            addStyleName("pull-right");
        }
    };
    final Collection<ShapeSet<?>> shapeSets = shapeManager.getShapeSets();
    if (null != shapeSets) {
        shapeSets.stream().forEach(shapeSet -> {
            menu.add(new AnchorListItem(prefix + " " + shapeSet.getDescription()) {

                {
                    setTitle(prefix + " " + shapeSet.getDescription());
                    setIcon(IconType.PLUS);
                    addClickHandler(event -> callback.onClick(shapeSet));
                }
            });
        });
    }
    final IsWidget group = new ButtonGroup() {

        {
            add(new Button() {

                {
                    setToggleCaret(false);
                    setDataToggle(Toggle.DROPDOWN);
                    setSize(ButtonSize.SMALL);
                    setText(title);
                    setTitle(title);
                }
            });
            add(menu);
        }
    };
    return MenuUtils.buildItem(group);
}
Also used : AnchorListItem(org.gwtbootstrap3.client.ui.AnchorListItem) IconType(org.gwtbootstrap3.client.ui.constants.IconType) Collection(java.util.Collection) DropDownMenu(org.gwtbootstrap3.client.ui.DropDownMenu) Button(org.gwtbootstrap3.client.ui.Button) Inject(javax.inject.Inject) Toggle(org.gwtbootstrap3.client.ui.constants.Toggle) MenuUtils(org.kie.workbench.common.stunner.client.widgets.menu.MenuUtils) MenuItem(org.uberfire.workbench.model.menu.MenuItem) ShapeManager(org.kie.workbench.common.stunner.core.client.api.ShapeManager) ApplicationScoped(javax.enterprise.context.ApplicationScoped) IsWidget(com.google.gwt.user.client.ui.IsWidget) ButtonSize(org.gwtbootstrap3.client.ui.constants.ButtonSize) ButtonGroup(org.gwtbootstrap3.client.ui.ButtonGroup) ShapeSet(org.kie.workbench.common.stunner.core.client.ShapeSet) IsWidget(com.google.gwt.user.client.ui.IsWidget) AnchorListItem(org.gwtbootstrap3.client.ui.AnchorListItem) ButtonGroup(org.gwtbootstrap3.client.ui.ButtonGroup) Button(org.gwtbootstrap3.client.ui.Button) DropDownMenu(org.gwtbootstrap3.client.ui.DropDownMenu) ShapeSet(org.kie.workbench.common.stunner.core.client.ShapeSet)

Aggregations

Button (org.gwtbootstrap3.client.ui.Button)71 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)33 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)33 FormStylePopup (org.uberfire.ext.widgets.common.client.common.popups.FormStylePopup)14 SmallLabel (org.uberfire.ext.widgets.common.client.common.SmallLabel)12 HTML (com.google.gwt.user.client.ui.HTML)10 ListBox (org.gwtbootstrap3.client.ui.ListBox)10 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)9 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)9 InfoPopup (org.uberfire.ext.widgets.common.client.common.InfoPopup)9 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)7 TextBox (org.gwtbootstrap3.client.ui.TextBox)6 MenuItem (org.uberfire.workbench.model.menu.MenuItem)6 IsWidget (com.google.gwt.user.client.ui.IsWidget)5 Widget (com.google.gwt.user.client.ui.Widget)5 AnchorListItem (org.gwtbootstrap3.client.ui.AnchorListItem)5 ButtonGroup (org.gwtbootstrap3.client.ui.ButtonGroup)5 FlexTable (com.google.gwt.user.client.ui.FlexTable)4 ApplicationScoped (javax.enterprise.context.ApplicationScoped)4 Inject (javax.inject.Inject)4