use of org.uberfire.backend.vfs.ObservablePath in project drools-wb by kiegroup.
the class BaseGuidedDecisionTableEditorPresenter method getRefreshContentSuccessCallback.
private RemoteCallback<GuidedDecisionTableEditorContent> getRefreshContentSuccessCallback(final GuidedDecisionTableView.Presenter dtPresenter) {
final ObservablePath path = dtPresenter.getLatestPath();
final PlaceRequest place = dtPresenter.getPlaceRequest();
final boolean isReadOnly = dtPresenter.isReadOnly();
return (content) -> {
// Refresh Decision Table in modeller
modeller.refreshDecisionTable(dtPresenter, path, place, content, isReadOnly);
activateDocument(dtPresenter);
view.hideBusyIndicator();
};
}
use of org.uberfire.backend.vfs.ObservablePath in project drools-wb by kiegroup.
the class BaseGuidedDecisionTableEditorPresenter method refreshDocument.
@Override
public void refreshDocument(final GuidedDecisionTableView.Presenter dtPresenter) {
final ObservablePath versionPath = dtPresenter.getCurrentPath();
view.showLoading();
service.call(getRefreshContentSuccessCallback(dtPresenter), getNoSuchFileExceptionErrorCallback()).loadContent(versionPath);
}
use of org.uberfire.backend.vfs.ObservablePath in project drools-wb by kiegroup.
the class GuidedDecisionTableEditorPresenterTest method startUpSelectsDecisionTable.
@Test
public void startUpSelectsDecisionTable() {
final ObservablePath path = mock(ObservablePath.class);
final PlaceRequest placeRequest = mock(PlaceRequest.class);
final GuidedDecisionTableEditorContent content = makeDecisionTableContent();
final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable(path, path, placeRequest, content);
presenter.onStartup(path, placeRequest);
verify(decisionTableSelectedEvent, times(1)).fire(dtSelectedEventCaptor.capture());
final DecisionTableSelectedEvent dtSelectedEvent = dtSelectedEventCaptor.getValue();
assertNotNull(dtSelectedEvent);
assertTrue(dtSelectedEvent.getPresenter().isPresent());
assertEquals(dtPresenter, dtSelectedEvent.getPresenter().get());
verify(modellerGridPanel).setFocus(eq(true));
}
use of org.uberfire.backend.vfs.ObservablePath in project drools-wb by kiegroup.
the class BaseGuidedDecisionTableEditorPresenterTest method checkMayCloseWithDirtyDecisionTable.
@Test
public void checkMayCloseWithDirtyDecisionTable() {
final ObservablePath path = mock(ObservablePath.class);
final PlaceRequest placeRequest = mock(PlaceRequest.class);
final GuidedDecisionTableEditorContent content = makeDecisionTableContent();
final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable(path, path, placeRequest, content);
when(dtPresenter.getOriginalHashCode()).thenReturn(10);
when(modeller.getAvailableDecisionTables()).thenReturn(new HashSet<GuidedDecisionTableView.Presenter>() {
{
add(dtPresenter);
}
});
assertFalse(presenter.mayClose());
}
use of org.uberfire.backend.vfs.ObservablePath in project drools-wb by kiegroup.
the class BaseGuidedDecisionTableEditorPresenterTest method checkOnValidateWithoutErrors.
@Test
public void checkOnValidateWithoutErrors() {
final ObservablePath path = mock(ObservablePath.class);
final PlaceRequest placeRequest = mock(PlaceRequest.class);
final GuidedDecisionTableEditorContent content = makeDecisionTableContent();
final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable(path, path, placeRequest, content);
when(dtService.validate(any(Path.class), any(GuidedDecisionTable52.class))).thenReturn(Collections.emptyList());
presenter.onValidate(dtPresenter);
final ArgumentCaptor<GuidedDecisionTable52> modelCaptor = ArgumentCaptor.forClass(GuidedDecisionTable52.class);
verify(dtService, times(1)).validate(eq(path), modelCaptor.capture());
assertNotNull(modelCaptor.getValue());
assertEquals(dtPresenter.getModel(), modelCaptor.getValue());
verify(notification, times(1)).fire(any(NotificationEvent.class));
}
Aggregations