use of org.kie.workbench.common.widgets.client.assets.dropdown.KieAssetsDropdownItem in project drools-wb by kiegroup.
the class SettingsPresenter method syncDmnFilePath.
@Override
public void syncDmnFilePath() {
String dmnFilePath = getCleanValue(() -> settingsScenarioSimulationDropdown.getValue().map(KieAssetsDropdownItem::getValue).orElse(""));
eventBus.fireEvent(new UpdateSettingsDataEvent(settingsToUpdate -> settingsToUpdate.setDmnFilePath(dmnFilePath), settingsToCheck -> !Objects.equals(settingsToCheck.getDmnFilePath(), dmnFilePath), true));
}
use of org.kie.workbench.common.widgets.client.assets.dropdown.KieAssetsDropdownItem 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());
}
}
Aggregations