@Test public void testTextBoxValueChangeHandler() { final TextBox textBox = mock(TextBox.class); final String textBoxValue = "123"; doReturn(textBoxValue).when(textBox).getValue(); factory.initTextBoxByRuleAttribute(textBox, ruleAttribute); verify(textBox).addValueChangeHandler(valueChangeHandlerArgumentCaptor.capture()); valueChangeHandlerArgumentCaptor.getValue().onValueChange(null); verify(ruleAttribute).setValue(textBoxValue); }
protected void initTextBoxByRuleAttribute(final TextBox textBox, final RuleAttribute ruleAttribute) { textBox.setEnabled(!isReadOnly); if (!isReadOnly) { textBox.addValueChangeHandler(event -> ruleAttribute.setValue(textBox.getValue())); } textBox.setValue(ruleAttribute.getValue()); }
EditAttributeWidgetFactory { protected void initTextBoxByRuleAttribute(final TextBox textBox, final RuleAttribute ruleAttribute) { textBox.setEnabled(!isReadOnly); if (!isReadOnly) { textBox.addValueChangeHandler(event -> ruleAttribute.setValue(textBox.getValue())); } textBox.setValue(ruleAttribute.getValue()); } }
EditAttributeWidgetFactory { protected void initTextBoxByRuleAttribute(final TextBox textBox, final RuleAttribute ruleAttribute) { textBox.setEnabled(!isReadOnly); if (!isReadOnly) { textBox.addValueChangeHandler(event -> ruleAttribute.setValue(textBox.getValue())); } textBox.setValue(ruleAttribute.getValue()); } EditAttributeWidgetFactory(final boolean isReadOnly); }
EditAttributeWidgetFactory { protected void initTextBoxByRuleAttribute(final TextBox textBox, final RuleAttribute ruleAttribute) { textBox.setEnabled(!isReadOnly); if (!isReadOnly) { textBox.addValueChangeHandler(event -> ruleAttribute.setValue(textBox.getValue())); } textBox.setValue(ruleAttribute.getValue()); } EditAttributeWidgetFactory(final boolean isReadOnly); TextBox textBox(final RuleAttribute ruleAttribute, final String dataType); DatePicker datePicker(final RuleAttribute ruleAttribute, final boolean allowEmptyValues); }
EditAttributeWidgetFactory { protected void initTextBoxByRuleAttribute(final TextBox textBox, final RuleAttribute ruleAttribute) { textBox.setEnabled(!isReadOnly); if (!isReadOnly) { textBox.addValueChangeHandler(event -> ruleAttribute.setValue(textBox.getValue())); } textBox.setValue(ruleAttribute.getValue()); } EditAttributeWidgetFactory(final boolean isReadOnly); TextBox textBox(final RuleAttribute ruleAttribute, final String dataType); DatePicker datePicker(final RuleAttribute ruleAttribute, final boolean allowEmptyValues);  }