@Test public void testOnClickOkButton() { final String description = "description"; final String url = "url"; final ArgumentCaptor<DMNExternalLink> captor = ArgumentCaptor.forClass(DMNExternalLink.class); final Consumer onExternalLinkCreated = mock(Consumer.class); attachmentNameInput.value = description; urlInput.value = url; popover.setOnExternalLinkCreated(onExternalLinkCreated); popover.onClickOkButton(null); verify(onExternalLinkCreated).accept(captor.capture()); final DMNExternalLink externalLink = captor.getValue(); assertEquals(description, externalLink.getDescription()); assertEquals(url, externalLink.getUrl()); verify(popover).hide(); }
@EventHandler("okButton") @SuppressWarnings("unused") public void onClickOkButton(final ClickEvent clickEvent) { final Consumer<DMNExternalLink> consumer = getOnExternalLinkCreated(); if (!Objects.isNull(consumer)) { final String description = attachmentNameInput.value; final String url = urlInput.value; final DMNExternalLink externalLink = new DMNExternalLink(url, description); consumer.accept(externalLink); } hide(); }
NameAndUrlPopoverViewImpl extends AbstractPopoverViewImpl implements NameAndUrlPopoverView { @EventHandler("okButton") @SuppressWarnings("unused") public void onClickOkButton(final ClickEvent clickEvent) { final Consumer<DMNExternalLink> consumer = getOnExternalLinkCreated(); if (!Objects.isNull(consumer)) { final String description = attachmentNameInput.value; final String url = urlInput.value; final DMNExternalLink externalLink = new DMNExternalLink(url, description); consumer.accept(externalLink); } hide(); } }
NameAndUrlPopoverViewImpl extends AbstractPopoverViewImpl implements NameAndUrlPopoverView { @EventHandler("okButton") @SuppressWarnings("unused") public void onClickOkButton(final ClickEvent clickEvent) { final Consumer<DMNExternalLink> consumer = getOnExternalLinkCreated(); if (!Objects.isNull(consumer)) { final String description = attachmentNameInput.value; final String url = urlInput.value; final DMNExternalLink externalLink = new DMNExternalLink(url, description); consumer.accept(externalLink); } hide(); } NameAndUrlPopoverViewImpl(); @Inject  NameAndUrlPopoverViewImpl(final Div popoverElement,
                                     final Div popoverContentElement,
                                     final JQueryProducer.JQuery<Popover> jQueryPopover,
                                     final TranslationService translationService,
                                     final HTMLButtonElement cancelButton,
                                     final HTMLButtonElement okButton,
                                     final HTMLInputElement urlInput,
                                     final HTMLInputElement attachmentNameInput,
                                     @Named("span") final HTMLElement urlLabel,
                                     @Named("span") final HTMLElement attachmentName,
                                     @Named("span") final HTMLElement attachmentTip); }
NameAndUrlPopoverViewImpl extends AbstractPopoverViewImpl implements NameAndUrlPopoverView { @EventHandler("okButton") @SuppressWarnings("unused") public void onClickOkButton(final ClickEvent clickEvent) { final Consumer<DMNExternalLink> consumer = getOnExternalLinkCreated(); if (!Objects.isNull(consumer)) { final String description = attachmentNameInput.value; final String url = urlInput.value; final DMNExternalLink externalLink = new DMNExternalLink(url, description); consumer.accept(externalLink); } hide(); } NameAndUrlPopoverViewImpl(); @Inject  NameAndUrlPopoverViewImpl(final Div popoverElement,
                                     final Div popoverContentElement,
                                     final JQueryProducer.JQuery<Popover> jQueryPopover,
                                     final TranslationService translationService,
                                     final HTMLButtonElement cancelButton,
                                     final HTMLButtonElement okButton,
                                     final HTMLInputElement urlInput,
                                     final HTMLInputElement attachmentNameInput,
                                     @Named("span") final HTMLElement urlLabel,
                                     @Named("span") final HTMLElement attachmentName,
                                     @Named("span") final HTMLElement attachmentTip); @PostConstruct void init(); @EventHandler("okButton") @SuppressWarnings("unused") void onClickOkButton(final ClickEvent clickEvent); @EventHandler("cancelButton") @SuppressWarnings("unused") void onClickCancelButton(final ClickEvent clickEvent); @Override void init(final NameAndUrlPopoverView.Presenter presenter); Consumer<DMNExternalLink> getOnExternalLinkCreated(); @Override void setOnExternalLinkCreated(final Consumer<DMNExternalLink> onExternalLinkCreated); @Override void show(final Optional<String> popoverTitle); }
NameAndUrlPopoverViewImpl extends AbstractPopoverViewImpl implements NameAndUrlPopoverView { @EventHandler("okButton") @SuppressWarnings("unused") public void onClickOkButton(final ClickEvent clickEvent) { final Consumer<DMNExternalLink> consumer = getOnExternalLinkCreated(); if (!Objects.isNull(consumer)) { final String description = attachmentNameInput.value; final String url = urlInput.value; final DMNExternalLink externalLink = new DMNExternalLink(url, description); consumer.accept(externalLink); } hide(); } NameAndUrlPopoverViewImpl(); @Inject  NameAndUrlPopoverViewImpl(final Div popoverElement,
                                     final Div popoverContentElement,
                                     final JQueryProducer.JQuery<Popover> jQueryPopover,
                                     final TranslationService translationService,
                                     final HTMLButtonElement cancelButton,
                                     final HTMLButtonElement okButton,
                                     final HTMLInputElement urlInput,
                                     final HTMLInputElement attachmentNameInput,
                                     @Named("span") final HTMLElement urlLabel,
                                     @Named("span") final HTMLElement attachmentName,
                                     @Named("span") final HTMLElement attachmentTip); @PostConstruct void init(); @EventHandler("okButton") @SuppressWarnings("unused") void onClickOkButton(final ClickEvent clickEvent); @EventHandler("cancelButton") @SuppressWarnings("unused") void onClickCancelButton(final ClickEvent clickEvent); @Override void init(final NameAndUrlPopoverView.Presenter presenter); Consumer<DMNExternalLink> getOnExternalLinkCreated(); @Override void setOnExternalLinkCreated(final Consumer<DMNExternalLink> onExternalLinkCreated); @Override void show(final Optional<String> popoverTitle);  }