use of elemental2.dom.HTMLAnchorElement in project kie-wb-common by kiegroup.
the class VariableListItemWidgetViewImpl method handleAcceptButton.
@EventHandler("acceptButton")
public void handleAcceptButton(final ClickEvent e) {
final String tagAdded = tagNamesComboBox.getValue();
if (!Strings.isNullOrEmpty(tagAdded) && !tagSet.contains(tagAdded)) {
for (final HTMLAnchorElement closeAnchor : removeButtons.values()) {
closeAnchor.onclick.onInvoke(new elemental2.dom.Event("DoNotUpdateModel"));
}
removeButtons.clear();
tagSet.add(tagAdded);
setCustomTags(setToList(tagSet));
notifyModelChanged();
if (!VariablesEditorFieldRenderer.getDefaultTagsSet().contains(tagAdded) && getPreviousCustomValue() != null && !tagAdded.equals(getPreviousCustomValue())) {
// Is custom
tagSet.remove(getPreviousCustomValue());
}
renderTagElementsBadges();
}
}
use of elemental2.dom.HTMLAnchorElement in project kie-wb-common by kiegroup.
the class VariableListItemWidgetTest method testSetTags.
@Test
public void testSetTags() {
List<String> tags = Arrays.asList("internal", "input", "customTag");
VariablesEditorWidgetView.Presenter presenter = mock(VariablesEditorWidgetView.Presenter.class);
widget.setParentWidget(presenter);
widget.setTagSet(new HashSet<>());
HTMLLabelElement tagLabel = mock(HTMLLabelElement.class);
HTMLAnchorElement tagCloseButton = mock(HTMLAnchorElement.class);
when(widget.getBadgeElement(anyString())).thenReturn(tagLabel);
when(widget.getBadgeCloseButton()).thenReturn(tagCloseButton);
HTMLDivElement tagsContainer = mock(HTMLDivElement.class);
widget.tagsContainer = tagsContainer;
widget.removeButtons = new HashMap<>();
widget.setTagTypes(tags);
verify(tagNamesComboBox, times(1)).addCustomValueToListBoxValues("customTag", "");
}
Aggregations