use of com.google.gwt.user.client.rpc.AsyncCallback in project activityinfo by bedatadriven.
the class DataEntryPage method requestToNavigateAway.
@Override
public void requestToNavigateAway(PageState place, final NavigationCallback callback) {
if (monthlyPanel.isModified()) {
final SavePromptMessageBox box = new SavePromptMessageBox();
box.show(new SaveChangesCallback() {
@Override
public void save(AsyncMonitor monitor) {
monthlyPanel.save().then(new AsyncCallback<Void>() {
@Override
public void onFailure(Throwable caught) {
// handled by monitor
}
@Override
public void onSuccess(Void result) {
box.hide();
callback.onDecided(true);
}
});
}
@Override
public void cancel() {
box.hide();
callback.onDecided(false);
}
@Override
public void discard() {
box.hide();
callback.onDecided(true);
}
});
} else {
callback.onDecided(true);
}
}
use of com.google.gwt.user.client.rpc.AsyncCallback in project activityinfo by bedatadriven.
the class MonthlyReportsPanel method confirmUnsavedData.
private void confirmUnsavedData(final Function function) {
if (isModified()) {
final SavePromptMessageBox box = new SavePromptMessageBox();
box.show(new SaveChangesCallback() {
@Override
public void save(AsyncMonitor monitor) {
MonthlyReportsPanel.this.save().then(new AsyncCallback<Void>() {
@Override
public void onFailure(Throwable caught) {
// handled by monitor
}
@Override
public void onSuccess(Void result) {
box.hide();
function.apply(null);
}
});
}
@Override
public void cancel() {
box.hide();
function.apply(null);
}
@Override
public void discard() {
box.hide();
function.apply(null);
}
});
}
}
use of com.google.gwt.user.client.rpc.AsyncCallback in project webprotege by protegeproject.
the class PrimitiveDataParserImpl_LiteralParsing_TestCase method setUp.
@Before
@SuppressWarnings("unchecked")
public void setUp() {
primitiveTypes = Sets.newHashSet();
primitiveTypes.add(PrimitiveType.LITERAL);
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocationOnMock) throws Throwable {
AsyncCallback<Optional<OWLEntityData>> callback = (AsyncCallback<Optional<OWLEntityData>>) invocationOnMock.getArguments()[2];
callback.onSuccess(Optional.empty());
return null;
}
}).when(lookupHandler).lookupEntity(any(String.class), any(Set.class), any(AsyncCallback.class));
parser = new PrimitiveDataParserImpl(lookupHandler);
}
use of com.google.gwt.user.client.rpc.AsyncCallback in project webprotege by protegeproject.
the class PrimitiveDataParserImpl_EntityParsing_TestCase method setUp.
@Before
@SuppressWarnings("unchecked")
public void setUp() {
primitiveTypes = Sets.newHashSet();
lookupMap = Maps.newHashMap();
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocationOnMock) throws Throwable {
AsyncCallback<Optional<OWLEntityData>> callback = (AsyncCallback<Optional<OWLEntityData>>) invocationOnMock.getArguments()[2];
callback.onSuccess(Optional.of(lookupMap.get(invocationOnMock.getArguments()[0])));
return null;
}
}).when(lookupHandler).lookupEntity(any(String.class), any(Set.class), any(AsyncCallback.class));
parser = new PrimitiveDataParserImpl(lookupHandler);
}
use of com.google.gwt.user.client.rpc.AsyncCallback in project blogwt by billy1380.
the class PageController method getPage.
/**
* @param page
*/
public void getPage(Page page, boolean includePosts) {
final GetPageRequest input = ApiHelper.setAccessCode(new GetPageRequest());
input.session = SessionController.get().sessionForApiCall();
input.page = page;
input.includePosts = Boolean.valueOf(includePosts);
if (getPageRequest != null) {
getPageRequest.cancel();
}
getPageRequest = ApiHelper.createPageClient().getPage(input, new AsyncCallback<GetPageResponse>() {
@Override
public void onSuccess(GetPageResponse output) {
getPageRequest = null;
if (output.status == StatusType.StatusTypeSuccess) {
}
DefaultEventBus.get().fireEventFromSource(new GetPageSuccess(input, output), PageController.this);
}
@Override
public void onFailure(Throwable caught) {
getPageRequest = null;
DefaultEventBus.get().fireEventFromSource(new GetPageFailure(input, caught), PageController.this);
}
});
}
Aggregations