@Test public void testInitDatePickerByRuleAttribute() { final DatePicker datePicker = mock(DatePicker.class); final String attributeValue = "31-May-2018"; doReturn(attributeValue).when(ruleAttribute).getValue(); factory.initDatePickerByRuleAttribute(datePicker, ruleAttribute); verify(datePicker).setFormat(any()); verify(datePicker).setValue(notNull(Date.class)); }
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);  }