@Test public void testDataTypeHandlerSpace() { view.init(); verify(customDataType, times(1)).setRegExp(eq(StringUtils.ALPHA_NUM_UNDERSCORE_DOT_REGEXP), anyString(), anyString()); verify(customDataType, times(1)).addKeyDownHandler(keyDownHandlerCaptor.capture()); KeyDownHandler handler = keyDownHandlerCaptor.getValue(); doReturn((int) ' ').when(keyDownEvent).getNativeKeyCode(); handler.onKeyDown(keyDownEvent); verify(keyDownEvent, times(1)).preventDefault(); }
@PostConstruct public void init() { name.setRegExp(ALLOWED_CHARS, StunnerFormsClientFieldsConstants.CONSTANTS.Removed_invalid_characters_from_name(), StunnerFormsClientFieldsConstants.CONSTANTS.Invalid_character_in_name()); name.addChangeHandler(event -> { String value = name.getText(); String notifyMessage = null; if (isMultipleInstanceVariable(value)) { notifyMessage = StunnerFormsClientFieldsConstants.CONSTANTS.AssignmentNameAlreadyInUseAsMultipleInstanceInputOutputVariable(value); } else if (!allowDuplicateNames && isDuplicateName(value)) { notifyMessage = duplicateNameErrorMessage; } if (notifyMessage != null) { notification.fire(new NotificationEvent(notifyMessage, NotificationEvent.NotificationType.ERROR)); name.setValue(EMPTY_VALUE); ValueChangeEvent.fire(name, EMPTY_VALUE); } }); customDataType.setRegExp(StringUtils.ALPHA_NUM_UNDERSCORE_DOT_REGEXP, StunnerFormsClientFieldsConstants.CONSTANTS.Removed_invalid_characters_from_name(), StunnerFormsClientFieldsConstants.CONSTANTS.Invalid_character_in_name()); customDataType.addKeyDownHandler(event -> { int iChar = event.getNativeKeyCode(); if (iChar == ' ') { event.preventDefault(); } }); dataTypeComboBox.init(this, false, dataType, customDataType, false, true, CUSTOM_PROMPT, ENTER_TYPE_PROMPT); processVarComboBox.init(this, false, processVar, expression, true, true, EXPRESSION_PROMPT, ENTER_EXPRESSION_PROMPT); }
AssignmentListItemWidgetViewImpl extends Composite implements AssignmentListItemWidgetView,
                                                                           ComboBoxView.ModelPresenter { @PostConstruct public void init() { name.setRegExp(ALLOWED_CHARS, StunnerFormsClientFieldsConstants.CONSTANTS.Removed_invalid_characters_from_name(), StunnerFormsClientFieldsConstants.CONSTANTS.Invalid_character_in_name()); name.addChangeHandler(event -> { String value = name.getText(); String notifyMessage = null; if (isMultipleInstanceVariable(value)) { notifyMessage = StunnerFormsClientFieldsConstants.CONSTANTS.AssignmentNameAlreadyInUseAsMultipleInstanceInputOutputVariable(value); } else if (!allowDuplicateNames && isDuplicateName(value)) { notifyMessage = duplicateNameErrorMessage; } if (notifyMessage != null) { notification.fire(new NotificationEvent(notifyMessage, NotificationEvent.NotificationType.ERROR)); name.setValue(EMPTY_VALUE); ValueChangeEvent.fire(name, EMPTY_VALUE); } }); customDataType.setRegExp(StringUtils.ALPHA_NUM_UNDERSCORE_DOT_REGEXP, StunnerFormsClientFieldsConstants.CONSTANTS.Removed_invalid_characters_from_name(), StunnerFormsClientFieldsConstants.CONSTANTS.Invalid_character_in_name()); customDataType.addKeyDownHandler(event -> { int iChar = event.getNativeKeyCode(); if (iChar == ' ') { event.preventDefault(); } }); dataTypeComboBox.init(this, false, dataType, customDataType, false, true, CUSTOM_PROMPT, ENTER_TYPE_PROMPT); processVarComboBox.init(this, false, processVar, expression, true, true, EXPRESSION_PROMPT, ENTER_EXPRESSION_PROMPT); } }
AssignmentListItemWidgetViewImpl extends Composite implements AssignmentListItemWidgetView,
                                                                           ComboBoxView.ModelPresenter { @PostConstruct public void init() { name.setRegExp(ALLOWED_CHARS, StunnerFormsClientFieldsConstants.CONSTANTS.Removed_invalid_characters_from_name(), StunnerFormsClientFieldsConstants.CONSTANTS.Invalid_character_in_name()); name.addChangeHandler(event -> { String value = name.getText(); String notifyMessage = null; if (isMultipleInstanceVariable(value)) { notifyMessage = StunnerFormsClientFieldsConstants.CONSTANTS.AssignmentNameAlreadyInUseAsMultipleInstanceInputOutputVariable(value); } else if (!allowDuplicateNames && isDuplicateName(value)) { notifyMessage = duplicateNameErrorMessage; } if (notifyMessage != null) { notification.fire(new NotificationEvent(notifyMessage, NotificationEvent.NotificationType.ERROR)); name.setValue(EMPTY_VALUE); ValueChangeEvent.fire(name, EMPTY_VALUE); } }); customDataType.setRegExp(StringUtils.ALPHA_NUM_UNDERSCORE_DOT_REGEXP, StunnerFormsClientFieldsConstants.CONSTANTS.Removed_invalid_characters_from_name(), StunnerFormsClientFieldsConstants.CONSTANTS.Invalid_character_in_name()); customDataType.addKeyDownHandler(event -> { int iChar = event.getNativeKeyCode(); if (iChar == ' ') { event.preventDefault(); } }); dataTypeComboBox.init(this, false, dataType, customDataType, false, true, CUSTOM_PROMPT, ENTER_TYPE_PROMPT); processVarComboBox.init(this, false, processVar, expression, true, true, EXPRESSION_PROMPT, ENTER_EXPRESSION_PROMPT); }  }
AssignmentListItemWidgetViewImpl extends Composite implements AssignmentListItemWidgetView,
                                                                           ComboBoxView.ModelPresenter { @PostConstruct public void init() { name.setRegExp(ALLOWED_CHARS, StunnerFormsClientFieldsConstants.CONSTANTS.Removed_invalid_characters_from_name(), StunnerFormsClientFieldsConstants.CONSTANTS.Invalid_character_in_name()); name.addChangeHandler(event -> { String value = name.getText(); String notifyMessage = null; if (isMultipleInstanceVariable(value)) { notifyMessage = StunnerFormsClientFieldsConstants.CONSTANTS.AssignmentNameAlreadyInUseAsMultipleInstanceInputOutputVariable(value); } else if (!allowDuplicateNames && isDuplicateName(value)) { notifyMessage = duplicateNameErrorMessage; } if (notifyMessage != null) { notification.fire(new NotificationEvent(notifyMessage, NotificationEvent.NotificationType.ERROR)); name.setValue(EMPTY_VALUE); ValueChangeEvent.fire(name, EMPTY_VALUE); } }); customDataType.setRegExp(StringUtils.ALPHA_NUM_UNDERSCORE_DOT_REGEXP, StunnerFormsClientFieldsConstants.CONSTANTS.Removed_invalid_characters_from_name(), StunnerFormsClientFieldsConstants.CONSTANTS.Invalid_character_in_name()); customDataType.addKeyDownHandler(event -> { int iChar = event.getNativeKeyCode(); if (iChar == ' ') { event.preventDefault(); } }); dataTypeComboBox.init(this, false, dataType, customDataType, false, true, CUSTOM_PROMPT, ENTER_TYPE_PROMPT); processVarComboBox.init(this, false, processVar, expression, true, true, EXPRESSION_PROMPT, ENTER_EXPRESSION_PROMPT); }  void setParentWidget(final ActivityDataIOEditorWidget 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 AssignmentRow getModel(); @Override void setModel(final AssignmentRow model); @Override VariableType getVariableType(); @Override String getDataType(); @Override void setDataType(final String dataType); @Override String getCustomDataType(); @Override void setCustomDataType(final String customDataType); @Override String getProcessVar(); @Override void setProcessVar(final String processVar); @Override String getExpression(); @Override void setExpression(final String expression); @Override void setDataTypes(final ListBoxValues dataTypeListBoxValues); @Override void setProcessVariables(final ListBoxValues processVarListBoxValues); @Override void setShowExpressions(final boolean showExpressions); @Override void setDisallowedNames(final Set<String> disallowedNames,
                                   final String disallowedNameErrorMessage); @Override void setAllowDuplicateNames(final boolean allowDuplicateNames,
                                       final String duplicateNameErrorMessage); @Override boolean isDuplicateName(final String name); @Override boolean isMultipleInstanceVariable(final String name); @Override void setReadOnly(final boolean readOnly); @EventHandler("deleteButton") void handleDeleteButton(final ClickEvent e); void notifyModelChanged(); }
AssignmentListItemWidgetViewImpl extends Composite implements AssignmentListItemWidgetView,
                                                                           ComboBoxView.ModelPresenter { @PostConstruct public void init() { name.setRegExp(ALLOWED_CHARS, StunnerFormsClientFieldsConstants.CONSTANTS.Removed_invalid_characters_from_name(), StunnerFormsClientFieldsConstants.CONSTANTS.Invalid_character_in_name()); name.addChangeHandler(event -> { String value = name.getText(); String notifyMessage = null; if (isMultipleInstanceVariable(value)) { notifyMessage = StunnerFormsClientFieldsConstants.CONSTANTS.AssignmentNameAlreadyInUseAsMultipleInstanceInputOutputVariable(value); } else if (!allowDuplicateNames && isDuplicateName(value)) { notifyMessage = duplicateNameErrorMessage; } if (notifyMessage != null) { notification.fire(new NotificationEvent(notifyMessage, NotificationEvent.NotificationType.ERROR)); name.setValue(EMPTY_VALUE); ValueChangeEvent.fire(name, EMPTY_VALUE); } }); customDataType.setRegExp(StringUtils.ALPHA_NUM_UNDERSCORE_DOT_REGEXP, StunnerFormsClientFieldsConstants.CONSTANTS.Removed_invalid_characters_from_name(), StunnerFormsClientFieldsConstants.CONSTANTS.Invalid_character_in_name()); customDataType.addKeyDownHandler(event -> { int iChar = event.getNativeKeyCode(); if (iChar == ' ') { event.preventDefault(); } }); dataTypeComboBox.init(this, false, dataType, customDataType, false, true, CUSTOM_PROMPT, ENTER_TYPE_PROMPT); processVarComboBox.init(this, false, processVar, expression, true, true, EXPRESSION_PROMPT, ENTER_EXPRESSION_PROMPT); }  void setParentWidget(final ActivityDataIOEditorWidget 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 AssignmentRow getModel(); @Override void setModel(final AssignmentRow model); @Override VariableType getVariableType(); @Override String getDataType(); @Override void setDataType(final String dataType); @Override String getCustomDataType(); @Override void setCustomDataType(final String customDataType); @Override String getProcessVar(); @Override void setProcessVar(final String processVar); @Override String getExpression(); @Override void setExpression(final String expression); @Override void setDataTypes(final ListBoxValues dataTypeListBoxValues); @Override void setProcessVariables(final ListBoxValues processVarListBoxValues); @Override void setShowExpressions(final boolean showExpressions); @Override void setDisallowedNames(final Set<String> disallowedNames,
                                   final String disallowedNameErrorMessage); @Override void setAllowDuplicateNames(final boolean allowDuplicateNames,
                                       final String duplicateNameErrorMessage); @Override boolean isDuplicateName(final String name); @Override boolean isMultipleInstanceVariable(final String name); @Override void setReadOnly(final boolean readOnly); @EventHandler("deleteButton") void handleDeleteButton(final ClickEvent e); void notifyModelChanged();  }