本文整理匯總了Java中com.google.gwt.user.client.rpc.AsyncCallback類的典型用法代碼示例。如果您正苦於以下問題:Java AsyncCallback類的具體用法?Java AsyncCallback怎麽用?Java AsyncCallback使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
AsyncCallback類屬於com.google.gwt.user.client.rpc包,在下文中一共展示了AsyncCallback類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: goToOozInstance
import com.google.gwt.user.client.rpc.AsyncCallback; //導入依賴的package包/類
/**
* Jump to a oozie instance( which need to synchronize current oozie job actions before jumping)
*
* @param oozJobId oozie job id
* @param message page url
*/
public void goToOozInstance(final String oozJobId,final String message)
{
jobSrv.updateJobActionStatus(oozJobId, new AsyncCallback<Void>(){
@Override
public void onFailure(Throwable caught) {
// TODO Auto-generated method stub
logger.warning("Synchronize current oozie instance actions status failed! Oozie job id ="+oozJobId);
}
@Override
public void onSuccess(Void result) {
// TODO Auto-generated method stub
eventBus.fireEvent(new ToMonitorEvent(message));
}
});
}
示例2: returnSuggestions
import com.google.gwt.user.client.rpc.AsyncCallback; //導入依賴的package包/類
public void returnSuggestions(final List<Chip> chips, final String text, final List<Suggestion> suggestions, final AsyncCallback<Collection<Suggestion>> callback) {
if (iNext == null)
callback.onSuccess(suggestions);
else
iNext.getSuggestions(chips, text, new AsyncCallback<Collection<Suggestion>>() {
@Override
public void onFailure(Throwable caught) {
callback.onSuccess(suggestions);
}
@Override
public void onSuccess(Collection<Suggestion> result) {
if (result != null) suggestions.addAll(result);
callback.onSuccess(suggestions);
}
});
}
示例3: showMenu
import com.google.gwt.user.client.rpc.AsyncCallback; //導入依賴的package包/類
public void showMenu() {
if (iLoaded) showMenuPopup();
else {
RPC.execute(new MenuInterface.MenuRpcRequest(), new AsyncCallback<GwtRpcResponseList<MenuInterface>>() {
@Override
public void onSuccess(GwtRpcResponseList<MenuInterface> result) {
initMenu(result);
showMenuPopup();
}
@Override
public void onFailure(Throwable caught) {
UniTimeNotifications.error(caught.getMessage(), caught);
}
});
}
}
示例4: setCompany
import com.google.gwt.user.client.rpc.AsyncCallback; //導入依賴的package包/類
public void setCompany(Integer company) {
this.company = company;
companyService.getCompany(company, new AsyncCallback<CompanyInfo>() {
@Override
public void onFailure(Throwable caught) {
Window.alert(caught.getMessage());
}
@Override
public void onSuccess(CompanyInfo result) {
resetFaultMessages();
name.setText(result.getName());
total.setText(Double.toString(result.getTotal()));
}
});
}
示例5: ensureInitialized
import com.google.gwt.user.client.rpc.AsyncCallback; //導入依賴的package包/類
protected void ensureInitialized(final AsyncCallback<Boolean> callback) {
if (iClassifications != null)
callback.onSuccess(true);
iCurriculaService.loadAcademicClassifications(new AsyncCallback<TreeSet<AcademicClassificationInterface>>() {
@Override
public void onSuccess(TreeSet<AcademicClassificationInterface> result) {
iClassifications = result;
if (callback != null) callback.onSuccess(true);
}
@Override
public void onFailure(Throwable caught) {
iHeader.setErrorMessage(MESSAGES.failedToLoadClassifications(caught.getMessage()));
UniTimeNotifications.error(MESSAGES.failedToLoadClassifications(caught.getMessage()), caught);
if (callback != null) callback.onFailure(caught);
}
});
}
示例6: requestSuggestions
import com.google.gwt.user.client.rpc.AsyncCallback; //導入依賴的package包/類
@Override
public void requestSuggestions(final Request request, final Callback callback) {
if (!request.getQuery().isEmpty()) {
iFilter.getWidget().getSuggestionsProvider().getSuggestions(iFilter.getWidget().getChips(null), request.getQuery(), new AsyncCallback<Collection<FilterBox.Suggestion>>() {
@Override
public void onFailure(Throwable caught) {
}
@Override
public void onSuccess(Collection<FilterBox.Suggestion> result) {
if (result == null) return;
List<CourseSuggestion> suggestions = new ArrayList<CourseSuggestion>();
for (FilterBox.Suggestion suggestion: result) {
if (suggestion.getChipToAdd() != null && "course".equals(suggestion.getChipToAdd().getCommand())) {
suggestions.add(new CourseSuggestion(suggestion));
}
}
callback.onSuggestionsReady(request, new Response(suggestions));
}
});
}
}
示例7: SolverStatus
import com.google.gwt.user.client.rpc.AsyncCallback; //導入依賴的package包/類
public SolverStatus() {
super("unitime-SolverStatus");
iStatus = new P("status-label");
iIcon = new Image(RESOURCES.helpIcon()); iIcon.addStyleName("status-icon");
iIcon.setVisible(false);
add(iStatus); add(iIcon);
RPC.execute(new PageNameRpcRequest("Solver Status"), new AsyncCallback<PageNameInterface>() {
@Override
public void onFailure(Throwable caught) {}
@Override
public void onSuccess(final PageNameInterface result) {
iIcon.setTitle(MESSAGES.pageHelp(result.getName()));
iIcon.setVisible(true);
iIcon.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if (result.getHelpUrl() == null || result.getHelpUrl().isEmpty()) return;
UniTimeFrameDialog.openDialog(MESSAGES.pageHelp(result.getName()), result.getHelpUrl());
}
});
}
});
}
示例8: insert
import com.google.gwt.user.client.rpc.AsyncCallback; //導入依賴的package包/類
public void insert(final RootPanel panel, Long eventAvailability) {
String[] ids = panel.getElement().getInnerHTML().trim().split(":");
Long locationId = Long.valueOf(ids[0]);
Long examTypeId = Long.valueOf(ids[1]);
RPC.execute(RoomInterface.PeriodPreferenceRequest.load(locationId, examTypeId), new AsyncCallback<PeriodPreferenceModel>() {
@Override
public void onFailure(Throwable caught) {
UniTimeNotifications.error(MESSAGES.failedToLoadPeriodPreferences(caught.getMessage()));
}
@Override
public void onSuccess(PeriodPreferenceModel result) {
panel.getElement().setInnerText(null);
setModel(result);
panel.add(PeriodPreferencesWidget.this);
panel.setVisible(true);
}
});
}
示例9: drawEnvelope
import com.google.gwt.user.client.rpc.AsyncCallback; //導入依賴的package包/類
private void drawEnvelope(final VectorFeature... vectorFeatures) {
final WKT wktFormat = new WKT();
final List<String> wktElements = new ArrayList<String>();
for (final VectorFeature feature : vectorFeatures) {
wktElements.add(wktFormat.write(feature));
}
JTS_SERVICE_ASYNC.getEnvelope(wktElements, new AsyncCallback<List<String>>() {
public void onFailure(final Throwable caught) {
progressBar.hide();
messageDialogBuilder.createError(UIMessages.INSTANCE.fail(), "Error: " + caught.getMessage()).show();
}
public void onSuccess(final List<String> wktEnvelopes) {
final VectorLayer vector = getEnvelopeLayer();
for (final String wktEnvelope : wktEnvelopes) {
final VectorFeature newVectorFeature = new VectorFeature(Geometry.fromWKT(wktEnvelope));
vector.addFeature(newVectorFeature);
}
progressBar.hide();
}
});
}
示例10: execute
import com.google.gwt.user.client.rpc.AsyncCallback; //導入依賴的package包/類
private void execute(final int index, final AsyncCallback<Boolean> callback) {
if (index >= iInitializations.length) {
callback.onSuccess(true);
} else {
iInitializations[index].execute(new AsyncCallback<Boolean>() {
@Override
public void onFailure(Throwable caught) {
callback.onFailure(caught);
}
@Override
public void onSuccess(Boolean result) {
if (result) {
execute(1 + index, callback);
} else {
callback.onSuccess(false);
}
}
});
}
}
示例11: updateKeystoreFileMenuButtons
import com.google.gwt.user.client.rpc.AsyncCallback; //導入依賴的package包/類
/**
* Enables or disables buttons based on whether the user has an android.keystore file.
*/
public void updateKeystoreFileMenuButtons() {
Ode.getInstance().getUserInfoService().hasUserFile(StorageUtil.ANDROID_KEYSTORE_FILENAME,
new AsyncCallback<Boolean>() {
@Override
public void onSuccess(Boolean keystoreFileExists) {
isKeystoreCached = true;
isKeystorePresent = keystoreFileExists;
fileDropDown.setItemEnabled(MESSAGES.deleteKeystoreMenuItem(), keystoreFileExists);
fileDropDown.setItemEnabled(MESSAGES.downloadKeystoreMenuItem(), keystoreFileExists);
}
@Override
public void onFailure(Throwable caught) {
// Enable the MenuItems. If they are clicked, we'll check again if the keystore exists.
fileDropDown.setItemEnabled(MESSAGES.deleteKeystoreMenuItem(), true);
fileDropDown.setItemEnabled(MESSAGES.downloadKeystoreMenuItem(), true);
}
});
}
示例12: showInstructorDetail
import com.google.gwt.user.client.rpc.AsyncCallback; //導入依賴的package包/類
public void showInstructorDetail(Long id) {
iAssignmentTable.clearTable(1);
LoadingWidget.getInstance().show(MESSAGES.waitLoadTeachingRequestDetail());
ToolBox.setMaxHeight(iScroll.getElement().getStyle(), Math.round(0.9 * Window.getClientHeight()) + "px");
RPC.execute(new TeachingAssignmentsDetailRequest(id), new AsyncCallback<InstructorInfo>() {
@Override
public void onFailure(Throwable caught) {
LoadingWidget.getInstance().hide();
UniTimeNotifications.error(MESSAGES.failedToLoadTeachingRequestDetail(caught.getMessage()), caught);
ToolBox.checkAccess(caught);
}
@Override
public void onSuccess(InstructorInfo result) {
LoadingWidget.getInstance().hide();
populate(null, null, result);
GwtHint.hideHint();
center();
RootPanel.getBodyElement().getStyle().setOverflow(Overflow.HIDDEN);
}
});
}
示例13: getDefaultAsyncCallback
import com.google.gwt.user.client.rpc.AsyncCallback; //導入依賴的package包/類
protected AsyncCallback<List<String>> getDefaultAsyncCallback() {
return new AsyncCallback<List<String>>() {
@Override
public void onFailure(final Throwable caught) {
finishProgressbar();
onError(caught.getMessage());
}
public void onSuccess(final List<String> wktElements) {
finishProgressbar();
onSucess(getResultLayer(wktElements));
}
};
}
示例14: init
import com.google.gwt.user.client.rpc.AsyncCallback; //導入依賴的package包/類
protected void init() {
RPC.execute(new NotAssignedClassesFilterRequest(), new AsyncCallback<NotAssignedClassesFilterResponse>() {
@Override
public void onFailure(Throwable caught) {
iFilter.getFooter().setErrorMessage(MESSAGES.failedToInitialize(caught.getMessage()));
UniTimeNotifications.error(MESSAGES.failedToInitialize(caught.getMessage()), caught);
ToolBox.checkAccess(caught);
}
@Override
public void onSuccess(NotAssignedClassesFilterResponse result) {
iLegend = new PreferenceLegend(result.getPreferences());
iFilter.getFooter().clearMessage();
iFilter.setValue(result);
iFilter.getFooter().setEnabled("search", true);
createTriggers();
if (iFilter.getHeader().isCollapsible() != null && !iFilter.getHeader().isCollapsible())
search(null);
}
});
}
示例15: requestSuggestions
import com.google.gwt.user.client.rpc.AsyncCallback; //導入依賴的package包/類
@Override
public void requestSuggestions(final Request request, final Callback callback) {
if (!request.getQuery().isEmpty()) {
iFilter.getWidget().getSuggestionsProvider().getSuggestions(iFilter.getWidget().getChips(null), request.getQuery(), new AsyncCallback<Collection<FilterBox.Suggestion>>() {
@Override
public void onFailure(Throwable caught) {
}
@Override
public void onSuccess(Collection<FilterBox.Suggestion> result) {
if (result == null) return;
List<RequestedBySuggestion> suggestions = new ArrayList<RequestedBySuggestion>();
for (FilterBox.Suggestion suggestion: result) {
if (suggestion.getChipToAdd() != null && "requested".equals(suggestion.getChipToAdd().getCommand())) {
suggestions.add(new RequestedBySuggestion(suggestion));
}
}
callback.onSuggestionsReady(request, new Response(suggestions));
}
});
}
}