@Test public void testDatePickerValueChangeHandler() { final DatePicker datePicker = mock(DatePicker.class); final Date datePickerValue = new Date(); doReturn(datePickerValue).when(datePicker).getValue(); factory.initDatePickerByRuleAttribute(datePicker, ruleAttribute); verify(datePicker).addValueChangeHandler(valueChangeHandlerArgumentCaptor.capture()); valueChangeHandlerArgumentCaptor.getValue().onValueChange(null); verify(ruleAttribute).setValue(anyString()); }
protected void initDatePickerByRuleAttribute(final DatePicker datePicker, final RuleAttribute ruleAttribute) { datePicker.addValueChangeHandler(event -> { final Date date = datePicker.getValue(); final String sDate = (date == null ? null : DATE_FORMATTER.format(datePicker.getValue())); ruleAttribute.setValue(sDate); }); datePicker.setFormat(DATE_FORMAT); datePicker.setValue(assertDateValue(ruleAttribute)); }
EditAttributeWidgetFactory { protected void initDatePickerByRuleAttribute(final DatePicker datePicker, final RuleAttribute ruleAttribute) { datePicker.addValueChangeHandler(event -> { final Date date = datePicker.getValue(); final String sDate = (date == null ? null : DATE_FORMATTER.format(datePicker.getValue())); ruleAttribute.setValue(sDate); }); datePicker.setFormat(DATE_FORMAT); datePicker.setValue(assertDateValue(ruleAttribute)); } }
EditAttributeWidgetFactory { protected void initDatePickerByRuleAttribute(final DatePicker datePicker, final RuleAttribute ruleAttribute) { datePicker.addValueChangeHandler(event -> { final Date date = datePicker.getValue(); final String sDate = (date == null ? null : DATE_FORMATTER.format(datePicker.getValue())); ruleAttribute.setValue(sDate); }); datePicker.setFormat(DATE_FORMAT); datePicker.setValue(assertDateValue(ruleAttribute)); } EditAttributeWidgetFactory(final boolean isReadOnly); }
EditAttributeWidgetFactory { protected void initDatePickerByRuleAttribute(final DatePicker datePicker, final RuleAttribute ruleAttribute) { datePicker.addValueChangeHandler(event -> { final Date date = datePicker.getValue(); final String sDate = (date == null ? null : DATE_FORMATTER.format(datePicker.getValue())); ruleAttribute.setValue(sDate); }); datePicker.setFormat(DATE_FORMAT); datePicker.setValue(assertDateValue(ruleAttribute)); } EditAttributeWidgetFactory(final boolean isReadOnly); TextBox textBox(final RuleAttribute ruleAttribute, final String dataType); DatePicker datePicker(final RuleAttribute ruleAttribute, final boolean allowEmptyValues); }
EditAttributeWidgetFactory { protected void initDatePickerByRuleAttribute(final DatePicker datePicker, final RuleAttribute ruleAttribute) { datePicker.addValueChangeHandler(event -> { final Date date = datePicker.getValue(); final String sDate = (date == null ? null : DATE_FORMATTER.format(datePicker.getValue())); ruleAttribute.setValue(sDate); }); datePicker.setFormat(DATE_FORMAT); datePicker.setValue(assertDateValue(ruleAttribute)); } EditAttributeWidgetFactory(final boolean isReadOnly); TextBox textBox(final RuleAttribute ruleAttribute, final String dataType); DatePicker datePicker(final RuleAttribute ruleAttribute, final boolean allowEmptyValues);  }