Search in sources :

Example 6 with UpdateSettingsDataEvent

use of org.drools.workbench.screens.scenariosimulation.client.events.UpdateSettingsDataEvent in project drools-wb by kiegroup.

the class SettingsPresenter method syncDmoSession.

@Override
public void syncDmoSession() {
    String dmoSession = getCleanValue(() -> view.getDmoSession().getValue());
    eventBus.fireEvent(new UpdateSettingsDataEvent(settingsToUpdate -> settingsToUpdate.setDmoSession(dmoSession), settingsToCheck -> !Objects.equals(settingsToCheck.getDmoSession(), dmoSession)));
}
Also used : UpdateSettingsDataEvent(org.drools.workbench.screens.scenariosimulation.client.events.UpdateSettingsDataEvent) RULE(org.drools.scenariosimulation.api.model.ScenarioSimulationModel.Type.RULE) EventBus(com.google.gwt.event.shared.EventBus) ValidateSimulationEvent(org.drools.workbench.screens.scenariosimulation.client.events.ValidateSimulationEvent) ScenarioSimulationModel(org.drools.scenariosimulation.api.model.ScenarioSimulationModel) Settings(org.drools.scenariosimulation.api.model.Settings) DMN(org.drools.scenariosimulation.api.model.ScenarioSimulationModel.Type.DMN) DEFAULT_PREFERRED_WIDHT(org.drools.workbench.screens.scenariosimulation.client.rightpanel.SettingsPresenter.DEFAULT_PREFERRED_WIDHT) Supplier(java.util.function.Supplier) KieAssetsDropdownItem(org.kie.workbench.common.widgets.client.assets.dropdown.KieAssetsDropdownItem) Objects(java.util.Objects) Inject(javax.inject.Inject) Style(com.google.gwt.dom.client.Style) SettingsScenarioSimulationDropdown(org.drools.workbench.screens.scenariosimulation.client.dropdown.SettingsScenarioSimulationDropdown) IDENTIFIER(org.drools.workbench.screens.scenariosimulation.client.rightpanel.SettingsPresenter.IDENTIFIER) PostConstruct(javax.annotation.PostConstruct) Optional(java.util.Optional) ScenarioSimulationEditorConstants(org.drools.workbench.screens.scenariosimulation.client.resources.i18n.ScenarioSimulationEditorConstants) ApplicationScoped(javax.enterprise.context.ApplicationScoped) Named(javax.inject.Named) WorkbenchScreen(org.uberfire.client.annotations.WorkbenchScreen) Command(org.uberfire.mvp.Command) UpdateSettingsDataEvent(org.drools.workbench.screens.scenariosimulation.client.events.UpdateSettingsDataEvent)

Example 7 with UpdateSettingsDataEvent

use of org.drools.workbench.screens.scenariosimulation.client.events.UpdateSettingsDataEvent in project drools-wb by kiegroup.

the class SettingsPresenter method syncRuleFlowGroup.

@Override
public void syncRuleFlowGroup() {
    String ruleFlow = getCleanValue(() -> view.getRuleFlowGroup().getValue());
    eventBus.fireEvent(new UpdateSettingsDataEvent(settingsToUpdate -> settingsToUpdate.setRuleFlowGroup(ruleFlow), settingsToCheck -> !Objects.equals(settingsToCheck.getRuleFlowGroup(), ruleFlow)));
}
Also used : UpdateSettingsDataEvent(org.drools.workbench.screens.scenariosimulation.client.events.UpdateSettingsDataEvent) RULE(org.drools.scenariosimulation.api.model.ScenarioSimulationModel.Type.RULE) EventBus(com.google.gwt.event.shared.EventBus) ValidateSimulationEvent(org.drools.workbench.screens.scenariosimulation.client.events.ValidateSimulationEvent) ScenarioSimulationModel(org.drools.scenariosimulation.api.model.ScenarioSimulationModel) Settings(org.drools.scenariosimulation.api.model.Settings) DMN(org.drools.scenariosimulation.api.model.ScenarioSimulationModel.Type.DMN) DEFAULT_PREFERRED_WIDHT(org.drools.workbench.screens.scenariosimulation.client.rightpanel.SettingsPresenter.DEFAULT_PREFERRED_WIDHT) Supplier(java.util.function.Supplier) KieAssetsDropdownItem(org.kie.workbench.common.widgets.client.assets.dropdown.KieAssetsDropdownItem) Objects(java.util.Objects) Inject(javax.inject.Inject) Style(com.google.gwt.dom.client.Style) SettingsScenarioSimulationDropdown(org.drools.workbench.screens.scenariosimulation.client.dropdown.SettingsScenarioSimulationDropdown) IDENTIFIER(org.drools.workbench.screens.scenariosimulation.client.rightpanel.SettingsPresenter.IDENTIFIER) PostConstruct(javax.annotation.PostConstruct) Optional(java.util.Optional) ScenarioSimulationEditorConstants(org.drools.workbench.screens.scenariosimulation.client.resources.i18n.ScenarioSimulationEditorConstants) ApplicationScoped(javax.enterprise.context.ApplicationScoped) Named(javax.inject.Named) WorkbenchScreen(org.uberfire.client.annotations.WorkbenchScreen) Command(org.uberfire.mvp.Command) UpdateSettingsDataEvent(org.drools.workbench.screens.scenariosimulation.client.events.UpdateSettingsDataEvent)

Example 8 with UpdateSettingsDataEvent

use of org.drools.workbench.screens.scenariosimulation.client.events.UpdateSettingsDataEvent in project drools-wb by kiegroup.

the class ScenarioSimulationEventHandlerTest method onUpdateSettingDataEventNoChangedValue.

@Test
public void onUpdateSettingDataEventNoChangedValue() {
    Predicate<Settings> predicateMock = mock(Predicate.class);
    when(predicateMock.test(eq(settingsLocal))).thenReturn(false);
    Consumer<Settings> consumerMock = mock(Consumer.class);
    UpdateSettingsDataEvent event = new UpdateSettingsDataEvent(consumerMock, predicateMock);
    scenarioSimulationEventHandler.onEvent(event);
    verify(predicateMock, times(1)).test(eq(settingsLocal));
    verify(scenarioSimulationEventHandler, never()).commonExecution(isA(UpdateSettingsDataCommand.class), eq(false));
    verify(scenarioSimulationEditorPresenterMock, never()).unpublishTestResultsAlerts();
}
Also used : UpdateSettingsDataCommand(org.drools.workbench.screens.scenariosimulation.client.commands.actualcommands.UpdateSettingsDataCommand) UpdateSettingsDataEvent(org.drools.workbench.screens.scenariosimulation.client.events.UpdateSettingsDataEvent) Settings(org.drools.scenariosimulation.api.model.Settings) Test(org.junit.Test) AbstractScenarioSimulationTest(org.drools.workbench.screens.scenariosimulation.client.AbstractScenarioSimulationTest)

Aggregations

Settings (org.drools.scenariosimulation.api.model.Settings)8 UpdateSettingsDataEvent (org.drools.workbench.screens.scenariosimulation.client.events.UpdateSettingsDataEvent)8 Style (com.google.gwt.dom.client.Style)5 EventBus (com.google.gwt.event.shared.EventBus)5 Objects (java.util.Objects)5 Optional (java.util.Optional)5 Supplier (java.util.function.Supplier)5 PostConstruct (javax.annotation.PostConstruct)5 ApplicationScoped (javax.enterprise.context.ApplicationScoped)5 Inject (javax.inject.Inject)5 Named (javax.inject.Named)5 ScenarioSimulationModel (org.drools.scenariosimulation.api.model.ScenarioSimulationModel)5 DMN (org.drools.scenariosimulation.api.model.ScenarioSimulationModel.Type.DMN)5 RULE (org.drools.scenariosimulation.api.model.ScenarioSimulationModel.Type.RULE)5 SettingsScenarioSimulationDropdown (org.drools.workbench.screens.scenariosimulation.client.dropdown.SettingsScenarioSimulationDropdown)5 ValidateSimulationEvent (org.drools.workbench.screens.scenariosimulation.client.events.ValidateSimulationEvent)5 ScenarioSimulationEditorConstants (org.drools.workbench.screens.scenariosimulation.client.resources.i18n.ScenarioSimulationEditorConstants)5 DEFAULT_PREFERRED_WIDHT (org.drools.workbench.screens.scenariosimulation.client.rightpanel.SettingsPresenter.DEFAULT_PREFERRED_WIDHT)5 IDENTIFIER (org.drools.workbench.screens.scenariosimulation.client.rightpanel.SettingsPresenter.IDENTIFIER)5 KieAssetsDropdownItem (org.kie.workbench.common.widgets.client.assets.dropdown.KieAssetsDropdownItem)5