use of org.uberfire.backend.vfs.ObservablePath in project drools-wb by kiegroup.
the class BaseGuidedDecisionTableEditorPresenter method onSourceTabSelected.
@Override
public void onSourceTabSelected(final GuidedDecisionTableView.Presenter dtPresenter) {
final ObservablePath path = dtPresenter.getCurrentPath();
final GuidedDecisionTable52 model = dtPresenter.getModel();
service.call(new RemoteCallback<String>() {
@Override
public void callback(String source) {
updateSource(source);
}
}, getCouldNotGenerateSourceErrorCallback()).toSource(path, model);
}
use of org.uberfire.backend.vfs.ObservablePath in project drools-wb by kiegroup.
the class EnumLoaderUtilities method getEnumsFromServer.
private void getEnumsFromServer(final DropDownData enumDefinition, final Callback<Map<String, String>> callback, final GuidedDecisionTablePresenter presenter, final Command onFetchCommand, final Command onFetchCompleteCommand) {
final String key = buildKey(enumDefinition);
if (enumCache.containsKey(key)) {
callback.callback(enumCache.get(key));
return;
}
// Cache empty value to prevent recurrent calls to the server for the same data.
// The View will be redrawn once by the batch() command in the success callback.
enumCache.put(key, Collections.emptyMap());
final GuidedDecisionTableView view = presenter.getView();
final ObservablePath currentPath = presenter.getCurrentPath();
onFetchCommand.execute();
enumDropdownService.call(new RemoteCallback<String[]>() {
@Override
public void callback(final String[] items) {
onFetchCompleteCommand.execute();
final Map<String, String> convertedDropDownData = convertDropDownData(items);
enumCache.put(key, convertedDropDownData);
callback.callback(convertedDropDownData);
view.batch();
}
}, new HasBusyIndicatorDefaultErrorCallback(view)).loadDropDownExpression(currentPath, enumDefinition.getValuePairs(), enumDefinition.getQueryExpression());
}
use of org.uberfire.backend.vfs.ObservablePath in project drools-wb by kiegroup.
the class DecisionTableXLSEditorPresenterTest method testOnUploadSuccess.
@Test
public void testOnUploadSuccess() {
final ObservablePath path = mock(ObservablePath.class);
doReturn(null).when(versionRecordManager).getCurrentPath();
doReturn(path).when(versionRecordManager).getPathToLatest();
presenter.onUploadSuccess();
verify(versionRecordManager).getPathToLatest();
verify(versionRecordManager, never()).getCurrentPath();
verify(versionRecordManager).reloadVersions(path);
}
use of org.uberfire.backend.vfs.ObservablePath in project drools-wb by kiegroup.
the class GuidedDecisionTableLockManagerImpl method fireChangeTitleEvent.
@Override
public void fireChangeTitleEvent() {
final Path path = getLockInfo().getFile();
if (path == null) {
return;
}
presenter.getActiveDecisionTable().ifPresent(dtPresenter -> {
final ObservablePath dtPath = dtPresenter.getCurrentPath();
if (dtPath == null) {
return;
}
if (dtPath.equals(path)) {
super.fireChangeTitleEvent();
}
});
}
use of org.uberfire.backend.vfs.ObservablePath in project drools-wb by kiegroup.
the class GuidedDecisionTableModellerPresenterTest method refreshingDecisionTableRetainsExistingLocation.
@Test
public void refreshingDecisionTableRetainsExistingLocation() {
final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable();
final GuidedDecisionTableEditorContent dtContent = makeDecisionTableContent();
final GuidedDecisionTableView dtView = dtPresenter.getView();
final ObservablePath path = mock(ObservablePath.class);
final PlaceRequest placeRequest = mock(PlaceRequest.class);
final Point2D dtLocation = new Point2D(100, 100);
when(dtView.getLocation()).thenReturn(dtLocation);
final ArgumentCaptor<Command> afterRemovalCommandCaptor = ArgumentCaptor.forClass(Command.class);
presenter.refreshDecisionTable(dtPresenter, path, placeRequest, dtContent, false);
verify(dtView, times(1)).getLocation();
verify(view, times(1)).removeDecisionTable(eq(dtView), afterRemovalCommandCaptor.capture());
final Command afterRemovalCommand = afterRemovalCommandCaptor.getValue();
assertNotNull(afterRemovalCommand);
afterRemovalCommand.execute();
verify(dtView, times(1)).setLocation(eq(dtLocation));
}
Aggregations