@Test public void onValueChange() { reset(uploadWidgetMock); ValueChangeEvent eventMock = mock(ValueChangeEvent.class); doReturn(false).when(sourceTypeSelector).isDMNSelected(); sourceTypeSelector.onValueChange(eventMock); verify(uploadWidgetMock, never()).updateAssetList(); doReturn(true).when(sourceTypeSelector).isDMNSelected(); sourceTypeSelector.onValueChange(eventMock); verify(uploadWidgetMock, times(1)).updateAssetList(); }
@Override public void onValueChange(ValueChangeEvent<Boolean> event) { final boolean dmnSelected = isDMNSelected(); uploadWidget.setVisible(dmnSelected); if (dmnSelected) { uploadWidget.updateAssetList(); } }
SourceTypeSelector extends VerticalPanel implements ValueChangeHandler<Boolean> { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { final boolean dmnSelected = isDMNSelected(); uploadWidget.setVisible(dmnSelected); if (dmnSelected) { uploadWidget.updateAssetList(); } } }
SourceTypeSelector extends VerticalPanel implements ValueChangeHandler<Boolean> { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { final boolean dmnSelected = isDMNSelected(); uploadWidget.setVisible(dmnSelected); if (dmnSelected) { uploadWidget.updateAssetList(); } } SourceTypeSelector(TitledAttachmentFileWidget uploadWidget); }
SourceTypeSelector extends VerticalPanel implements ValueChangeHandler<Boolean> { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { final boolean dmnSelected = isDMNSelected(); uploadWidget.setVisible(dmnSelected); if (dmnSelected) { uploadWidget.updateAssetList(); } } SourceTypeSelector(TitledAttachmentFileWidget uploadWidget); @Override void onValueChange(ValueChangeEvent<Boolean> event); boolean validate(); boolean isDMNSelected(); ScenarioSimulationModel.Type getSelectedType(); }
SourceTypeSelector extends VerticalPanel implements ValueChangeHandler<Boolean> { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { final boolean dmnSelected = isDMNSelected(); uploadWidget.setVisible(dmnSelected); if (dmnSelected) { uploadWidget.updateAssetList(); } } SourceTypeSelector(TitledAttachmentFileWidget uploadWidget); @Override void onValueChange(ValueChangeEvent<Boolean> event); boolean validate(); boolean isDMNSelected(); ScenarioSimulationModel.Type getSelectedType();  }