@Test public void testDataTypeHandlerSpace() { view.init(); verify(customDataType, times(1)).addKeyDownHandler(keyDownHandlerCaptor.capture()); KeyDownHandler handler = keyDownHandlerCaptor.getValue(); doReturn(Integer.valueOf(' ')).when(keyDownEvent).getNativeKeyCode(); handler.onKeyDown(keyDownEvent); verify(keyDownEvent, times(1)).preventDefault(); }
@PostConstruct public void init() { name.setRegExp(StringUtils.ALPHA_NUM_REGEXP, StunnerFormsClientFieldsConstants.CONSTANTS.Removed_invalid_characters_from_name(), StunnerFormsClientFieldsConstants.CONSTANTS.Invalid_character_in_name()); name.addChangeHandler(event -> { String value = name.getText(); if (isDuplicateName(value)) { notification.fire(new NotificationEvent(StunnerFormsClientFieldsConstants.CONSTANTS.DuplicatedVariableNameError(value), NotificationEvent.NotificationType.ERROR)); name.setValue(currentName); ValueChangeEvent.fire(name, currentName); } else if (isBoundToNodes(currentName)) { errorPopupPresenter.showMessage(StunnerFormsClientFieldsConstants.CONSTANTS.RenameDiagramVariableError()); name.setValue(currentName); ValueChangeEvent.fire(name, currentName); } notifyModelChanged(); }); dataTypeComboBox.init(this, true, dataType, customDataType, false, true, CUSTOM_PROMPT, ENTER_TYPE_PROMPT); customDataType.setRegExp(StringUtils.ALPHA_NUM_UNDERSCORE_DOT_REGEXP, StunnerFormsClientFieldsConstants.CONSTANTS.Removed_invalid_characters_from_name(), StunnerFormsClientFieldsConstants.CONSTANTS.Invalid_character_in_name()); customDataType.addKeyDownHandler(this::preventSpaces); PopOver.jQuery(variableTagsSettings).popovers(); setTagTittle("Tags: "); variableTagsSettings.onclick = e -> { e.preventDefault(); openOverlayActions(); return null; }; customTagName.addFocusHandler(focusEvent -> setPreviousCustomValue(customTagName.getValue())); customTagName.addKeyDownHandler(this::preventSpaces); loadDefaultTagNames(); setTagsListItems(); }
VariableListItemWidgetViewImpl implements VariableListItemWidgetView,
                                                       ComboBoxView.ModelPresenter { @PostConstruct public void init() { name.setRegExp(StringUtils.ALPHA_NUM_REGEXP, StunnerFormsClientFieldsConstants.CONSTANTS.Removed_invalid_characters_from_name(), StunnerFormsClientFieldsConstants.CONSTANTS.Invalid_character_in_name()); name.addChangeHandler(event -> { String value = name.getText(); if (isDuplicateName(value)) { notification.fire(new NotificationEvent(StunnerFormsClientFieldsConstants.CONSTANTS.DuplicatedVariableNameError(value), NotificationEvent.NotificationType.ERROR)); name.setValue(currentName); ValueChangeEvent.fire(name, currentName); } else if (isBoundToNodes(currentName)) { errorPopupPresenter.showMessage(StunnerFormsClientFieldsConstants.CONSTANTS.RenameDiagramVariableError()); name.setValue(currentName); ValueChangeEvent.fire(name, currentName); } notifyModelChanged(); }); dataTypeComboBox.init(this, true, dataType, customDataType, false, true, CUSTOM_PROMPT, ENTER_TYPE_PROMPT); customDataType.setRegExp(StringUtils.ALPHA_NUM_UNDERSCORE_DOT_REGEXP, StunnerFormsClientFieldsConstants.CONSTANTS.Removed_invalid_characters_from_name(), StunnerFormsClientFieldsConstants.CONSTANTS.Invalid_character_in_name()); customDataType.addKeyDownHandler(this::preventSpaces); PopOver.jQuery(variableTagsSettings).popovers(); setTagTittle("Tags: "); variableTagsSettings.onclick = e -> { e.preventDefault(); openOverlayActions(); return null; }; customTagName.addFocusHandler(focusEvent -> setPreviousCustomValue(customTagName.getValue())); customTagName.addKeyDownHandler(this::preventSpaces); loadDefaultTagNames(); setTagsListItems(); } }
VariableListItemWidgetViewImpl implements VariableListItemWidgetView,
                                                       ComboBoxView.ModelPresenter { @PostConstruct public void init() { name.setRegExp(StringUtils.ALPHA_NUM_REGEXP, StunnerFormsClientFieldsConstants.CONSTANTS.Removed_invalid_characters_from_name(), StunnerFormsClientFieldsConstants.CONSTANTS.Invalid_character_in_name()); name.addChangeHandler(event -> { String value = name.getText(); if (isDuplicateName(value)) { notification.fire(new NotificationEvent(StunnerFormsClientFieldsConstants.CONSTANTS.DuplicatedVariableNameError(value), NotificationEvent.NotificationType.ERROR)); name.setValue(currentName); ValueChangeEvent.fire(name, currentName); } else if (isBoundToNodes(currentName)) { errorPopupPresenter.showMessage(StunnerFormsClientFieldsConstants.CONSTANTS.RenameDiagramVariableError()); name.setValue(currentName); ValueChangeEvent.fire(name, currentName); } notifyModelChanged(); }); dataTypeComboBox.init(this, true, dataType, customDataType, false, true, CUSTOM_PROMPT, ENTER_TYPE_PROMPT); customDataType.setRegExp(StringUtils.ALPHA_NUM_UNDERSCORE_DOT_REGEXP, StunnerFormsClientFieldsConstants.CONSTANTS.Removed_invalid_characters_from_name(), StunnerFormsClientFieldsConstants.CONSTANTS.Invalid_character_in_name()); customDataType.addKeyDownHandler(this::preventSpaces); PopOver.jQuery(variableTagsSettings).popovers(); setTagTittle("Tags: "); variableTagsSettings.onclick = e -> { e.preventDefault(); openOverlayActions(); return null; }; customTagName.addFocusHandler(focusEvent -> setPreviousCustomValue(customTagName.getValue())); customTagName.addKeyDownHandler(this::preventSpaces); loadDefaultTagNames(); setTagsListItems(); }  }
VariableListItemWidgetViewImpl implements VariableListItemWidgetView,
                                                       ComboBoxView.ModelPresenter { @PostConstruct public void init() { name.setRegExp(StringUtils.ALPHA_NUM_REGEXP, StunnerFormsClientFieldsConstants.CONSTANTS.Removed_invalid_characters_from_name(), StunnerFormsClientFieldsConstants.CONSTANTS.Invalid_character_in_name()); name.addChangeHandler(event -> { String value = name.getText(); if (isDuplicateName(value)) { notification.fire(new NotificationEvent(StunnerFormsClientFieldsConstants.CONSTANTS.DuplicatedVariableNameError(value), NotificationEvent.NotificationType.ERROR)); name.setValue(currentName); ValueChangeEvent.fire(name, currentName); } else if (isBoundToNodes(currentName)) { errorPopupPresenter.showMessage(StunnerFormsClientFieldsConstants.CONSTANTS.RenameDiagramVariableError()); name.setValue(currentName); ValueChangeEvent.fire(name, currentName); } notifyModelChanged(); }); dataTypeComboBox.init(this, true, dataType, customDataType, false, true, CUSTOM_PROMPT, ENTER_TYPE_PROMPT); customDataType.setRegExp(StringUtils.ALPHA_NUM_UNDERSCORE_DOT_REGEXP, StunnerFormsClientFieldsConstants.CONSTANTS.Removed_invalid_characters_from_name(), StunnerFormsClientFieldsConstants.CONSTANTS.Invalid_character_in_name()); customDataType.addKeyDownHandler(this::preventSpaces); PopOver.jQuery(variableTagsSettings).popovers(); setTagTittle("Tags: "); variableTagsSettings.onclick = e -> { e.preventDefault(); openOverlayActions(); return null; }; customTagName.addFocusHandler(focusEvent -> setPreviousCustomValue(customTagName.getValue())); customTagName.addKeyDownHandler(this::preventSpaces); loadDefaultTagNames(); setTagsListItems(); }  Set<String> getTagSet(); void setTagSet(Set<String> tagSet); String getPreviousCustomValue(); void setPreviousCustomValue(String previousCustomValue); void setParentWidget(final VariablesEditorWidgetView.Presenter parentWidget); @Override void setTextBoxModelValue(final TextBox textBox,
                                     final String value); @Override void setListBoxModelValue(final ValueListBox<String> listBox,
                                     final String value); @Override String getModelValue(final ValueListBox<String> listBox); @PostConstruct void init(); @Override VariableRow getModel(); @Override void setModel(final VariableRow model); @Override VariableType getVariableType(); @Override String getDataTypeDisplayName(); @Override void setDataTypeDisplayName(final String dataTypeDisplayName); @Override String getCustomDataType(); @Override void setCustomDataType(final String customDataType); @Override void setCustomTags(final List<String> tags); @Override List<String> getCustomTags(); @Override void setDataTypes(final ListBoxValues dataTypeListBoxValues); @Override void setTagTypes(final List<String> tagTypes); @Override void setReadOnly(final boolean readOnly); @EventHandler("deleteButton") void handleDeleteButton(final ClickEvent e); @EventHandler("closeButton") void handleCloseButton(final ClickEvent e); @EventHandler("acceptButton") void handleAcceptButton(final ClickEvent e); @Override void notifyModelChanged(); @Override void setTagsNotEnabled(); }
VariableListItemWidgetViewImpl implements VariableListItemWidgetView,
                                                       ComboBoxView.ModelPresenter { @PostConstruct public void init() { name.setRegExp(StringUtils.ALPHA_NUM_REGEXP, StunnerFormsClientFieldsConstants.CONSTANTS.Removed_invalid_characters_from_name(), StunnerFormsClientFieldsConstants.CONSTANTS.Invalid_character_in_name()); name.addChangeHandler(event -> { String value = name.getText(); if (isDuplicateName(value)) { notification.fire(new NotificationEvent(StunnerFormsClientFieldsConstants.CONSTANTS.DuplicatedVariableNameError(value), NotificationEvent.NotificationType.ERROR)); name.setValue(currentName); ValueChangeEvent.fire(name, currentName); } else if (isBoundToNodes(currentName)) { errorPopupPresenter.showMessage(StunnerFormsClientFieldsConstants.CONSTANTS.RenameDiagramVariableError()); name.setValue(currentName); ValueChangeEvent.fire(name, currentName); } notifyModelChanged(); }); dataTypeComboBox.init(this, true, dataType, customDataType, false, true, CUSTOM_PROMPT, ENTER_TYPE_PROMPT); customDataType.setRegExp(StringUtils.ALPHA_NUM_UNDERSCORE_DOT_REGEXP, StunnerFormsClientFieldsConstants.CONSTANTS.Removed_invalid_characters_from_name(), StunnerFormsClientFieldsConstants.CONSTANTS.Invalid_character_in_name()); customDataType.addKeyDownHandler(this::preventSpaces); PopOver.jQuery(variableTagsSettings).popovers(); setTagTittle("Tags: "); variableTagsSettings.onclick = e -> { e.preventDefault(); openOverlayActions(); return null; }; customTagName.addFocusHandler(focusEvent -> setPreviousCustomValue(customTagName.getValue())); customTagName.addKeyDownHandler(this::preventSpaces); loadDefaultTagNames(); setTagsListItems(); }  Set<String> getTagSet(); void setTagSet(Set<String> tagSet); String getPreviousCustomValue(); void setPreviousCustomValue(String previousCustomValue); void setParentWidget(final VariablesEditorWidgetView.Presenter parentWidget); @Override void setTextBoxModelValue(final TextBox textBox,
                                     final String value); @Override void setListBoxModelValue(final ValueListBox<String> listBox,
                                     final String value); @Override String getModelValue(final ValueListBox<String> listBox); @PostConstruct void init(); @Override VariableRow getModel(); @Override void setModel(final VariableRow model); @Override VariableType getVariableType(); @Override String getDataTypeDisplayName(); @Override void setDataTypeDisplayName(final String dataTypeDisplayName); @Override String getCustomDataType(); @Override void setCustomDataType(final String customDataType); @Override void setCustomTags(final List<String> tags); @Override List<String> getCustomTags(); @Override void setDataTypes(final ListBoxValues dataTypeListBoxValues); @Override void setTagTypes(final List<String> tagTypes); @Override void setReadOnly(final boolean readOnly); @EventHandler("deleteButton") void handleDeleteButton(final ClickEvent e); @EventHandler("closeButton") void handleCloseButton(final ClickEvent e); @EventHandler("acceptButton") void handleAcceptButton(final ClickEvent e); @Override void notifyModelChanged(); @Override void setTagsNotEnabled();  }