use of edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceCallback in project webprotege by protegeproject.
the class ChangeListViewPresenter method revertChanges.
private void revertChanges(ProjectChange projectChange) {
GWT.log("Reverting revision " + projectChange.getRevisionNumber().getValue());
projectId.ifPresent(theProjectId -> {
final RevisionNumber revisionNumber = projectChange.getRevisionNumber();
dispatchServiceManager.execute(new RevertRevisionAction(theProjectId, revisionNumber), new DispatchServiceCallback<RevertRevisionResult>() {
@Override
public void handleSuccess(RevertRevisionResult revertRevisionResult) {
MessageBox.showMessage("Changes in revision " + revisionNumber.getValue() + " have been reverted");
lastAction.ifPresent(action -> setChangesForProject(action.getProjectId()));
}
});
});
}
use of edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceCallback in project webprotege by protegeproject.
the class PerspectiveLinkManagerImpl method addLinkedPerspective.
public void addLinkedPerspective(final PerspectiveId perspectiveId, final Callback callback) {
final UserId userId = loggedInUserProvider.getCurrentUserId();
dispatchServiceManager.execute(new GetPerspectivesAction(projectId, userId), new DispatchServiceCallback<GetPerspectivesResult>() {
@Override
public void handleSuccess(GetPerspectivesResult result) {
List<PerspectiveId> ids = new ArrayList<>(result.getPerspectives());
ids.add(perspectiveId);
final ImmutableList<PerspectiveId> perspectiveIds = ImmutableList.copyOf(ids);
dispatchServiceManager.execute(new SetPerspectivesAction(projectId, userId, perspectiveIds), new DispatchServiceCallback<SetPerspectivesResult>() {
@Override
public void handleSuccess(SetPerspectivesResult setPerspectivesResult) {
callback.handlePerspectives(perspectiveIds);
}
});
}
});
}
use of edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceCallback in project webprotege by protegeproject.
the class WatchPresenter method start.
public void start(final OWLEntity forEntity) {
final UserId userId = loggedInUserProvider.getCurrentUserId();
dispatchServiceManager.execute(new GetWatchesAction(projectId, userId, forEntity), new DispatchServiceCallback<GetWatchesResult>() {
@Override
public void handleSuccess(GetWatchesResult result) {
Set<Watch> watches = result.getWatches();
updateDialog(watches);
WebProtegeDialog<WatchTypeSelection> dlg = new WebProtegeDialog<>(controller);
dlg.show();
controller.setDialogButtonHandler(DialogButton.OK, (data, closer) -> {
closer.hide();
handleWatchTypeForEntity(data, forEntity);
});
}
});
}
use of edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceCallback in project webprotege by protegeproject.
the class MetricsPresenterTestCase method setUp.
// @Before
public void setUp() {
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocationOnMock) throws Throwable {
DispatchServiceCallback<GetMetricsResult> action = (DispatchServiceCallback<GetMetricsResult>) invocationOnMock.getArguments()[1];
action.onSuccess(result);
return null;
}
}).when(dispatchServiceManager).execute(any(GetMetricsAction.class), any(DispatchServiceCallback.class));
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocationOnMock) throws Throwable {
handler = (RequestRefreshEventHandler) invocationOnMock.getArguments()[0];
return null;
}
}).when(view).setRequestRefreshEventHandler(any(RequestRefreshEventHandler.class));
when(result.getMetricValues()).thenReturn(metricValues);
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocationOnMock) throws Throwable {
metricsChangedHandler = (MetricsChangedHandler) invocationOnMock.getArguments()[0];
return null;
}
}).when(eventManager).addProjectEventHandler(eq(projectId), any(MetricsChangedEvent.getType().getClass()), any(MetricsChangedHandler.class));
presenter = new MetricsPresenter(projectId, view, dispatchServiceManager);
presenter.start();
}
use of edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceCallback in project webprotege by protegeproject.
the class PerspectiveLinkManagerImpl method removeLinkedPerspective.
public void removeLinkedPerspective(final PerspectiveId perspectiveId, final Callback callback) {
final UserId userId = loggedInUserProvider.getCurrentUserId();
dispatchServiceManager.execute(new GetPerspectivesAction(projectId, userId), new DispatchServiceCallback<GetPerspectivesResult>() {
@Override
public void handleSuccess(GetPerspectivesResult result) {
final List<PerspectiveId> ids = new ArrayList<>(result.getPerspectives());
ids.remove(perspectiveId);
dispatchServiceManager.execute(new SetPerspectivesAction(projectId, userId, ImmutableList.copyOf(ids)), new DispatchServiceCallback<SetPerspectivesResult>() {
@Override
public void handleSuccess(SetPerspectivesResult setPerspectivesResult) {
callback.handlePerspectives(ids);
}
});
}
});
}
Aggregations