use of org.drools.workbench.screens.scenariosimulation.client.events.ValidateSimulationEvent in project drools-wb by kiegroup.
the class SettingsPresenter method validateSimulation.
/**
* It checks if a user selected DMN path is valid or not. If valid, it clears the <code>dmnPathErrorLabel</code>
* span element and it validates the whole Simulation. If not valid, the otherwise.
* This method should be called everytime a value is selected in <code>{@link SettingsScenarioSimulationDropdown}</code> widget
*/
protected void validateSimulation() {
final Optional<KieAssetsDropdownItem> value = settingsScenarioSimulationDropdown.getValue();
String selectedPath = value.map(KieAssetsDropdownItem::getValue).orElse(null);
boolean isValid = selectedPath != null && !selectedPath.isEmpty();
if (!isValid) {
view.getDmnFilePathErrorLabel().getStyle().setDisplay(Style.Display.INLINE);
view.getDmnFilePathErrorLabel().setInnerText(ScenarioSimulationEditorConstants.INSTANCE.chooseValidDMNAsset());
} else {
this.syncDmnFilePath();
view.getDmnFilePathErrorLabel().getStyle().setDisplay(Style.Display.NONE);
view.getDmnFilePathErrorLabel().setInnerText("");
eventBus.fireEvent(new ValidateSimulationEvent());
}
}
use of org.drools.workbench.screens.scenariosimulation.client.events.ValidateSimulationEvent in project drools-wb by kiegroup.
the class ScenarioSimulationEventHandlerTest method onValidateEvent.
@Test
public void onValidateEvent() {
ValidateSimulationEvent event = new ValidateSimulationEvent();
scenarioSimulationEventHandler.onEvent(event);
verify(scenarioSimulationEditorPresenterMock, times(1)).validateSimulation();
}
Aggregations