當前位置: 首頁>>代碼示例>>Java>>正文


Java GWT.runAsync方法代碼示例

本文整理匯總了Java中com.google.gwt.core.client.GWT.runAsync方法的典型用法代碼示例。如果您正苦於以下問題:Java GWT.runAsync方法的具體用法?Java GWT.runAsync怎麽用?Java GWT.runAsync使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.gwt.core.client.GWT的用法示例。


在下文中一共展示了GWT.runAsync方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initPageAsync

import com.google.gwt.core.client.GWT; //導入方法依賴的package包/類
public void initPageAsync(final String page) {
	GWT.runAsync(new RunAsyncCallback() {
		public void onSuccess() {
			init(page);
			LoadingWidget.getInstance().hide();
		}
		public void onFailure(Throwable reason) {
			Label error = new Label(MESSAGES.failedToLoadPage(reason.getMessage()));
			error.setStyleName("unitime-ErrorMessage");
			RootPanel loading = RootPanel.get("UniTimeGWT:Loading");
			if (loading != null) loading.setVisible(false);
			RootPanel.get("UniTimeGWT:Body").add(error);
			LoadingWidget.getInstance().hide();
			UniTimeNotifications.error(MESSAGES.failedToLoadPage(reason.getMessage()), reason);
		}
	});
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:18,代碼來源:Client.java

示例2: runAsync

import com.google.gwt.core.client.GWT; //導入方法依賴的package包/類
@Override
public void runAsync(AsyncTask asyncTask) {
    GWT.runAsync(new RunAsyncCallback() {
        @Override
        public void onFailure(Throwable reason) {
            asyncTask.onFailed(reason);
        }

        @Override
        public void onSuccess() {
            asyncTask.onSuccess();
        }
    });
}
 
開發者ID:GwtDomino,項目名稱:domino,代碼行數:15,代碼來源:GwtAsyncRunner.java

示例3: onModuleLoadDeferred

import com.google.gwt.core.client.GWT; //導入方法依賴的package包/類
public void onModuleLoadDeferred() {
	// register triggers
	GWT.runAsync(new RunAsyncCallback() {
		@Override
		public void onSuccess() {
			for (Triggers t: Triggers.values())
				t.register();
			callGwtOnLoadIfExists();
		}
		@Override
		public void onFailure(Throwable reason) {
		}
	});
	
	// load page
	if (RootPanel.get("UniTimeGWT:Body") != null) {
		LoadingWidget.getInstance().show(MESSAGES.waitLoadingPage());
		Scheduler.get().scheduleDeferred(new ScheduledCommand() {
			@Override
			public void execute() {
				initPageAsync(Window.Location.getParameter("page"));
			}
		});
	}
	
	// load components
	for (final Components c: Components.values()) {
		final RootPanel p = RootPanel.get(c.id());
		if (p != null) {
			Scheduler.get().scheduleDeferred(new ScheduledCommand() {
				@Override
				public void execute() {
					initComponentAsync(p, c);
				}
			});
		}
		if (p == null && c.isMultiple()) {
			NodeList<Element> x = getElementsByName(c.id());
			if (x != null && x.getLength() > 0)
				for (int i = 0; i < x.getLength(); i++) {
					Element e = x.getItem(i);
					e.setId(DOM.createUniqueId());
					final RootPanel q = RootPanel.get(e.getId());
					Scheduler.get().scheduleDeferred(new ScheduledCommand() {
						@Override
						public void execute() {
							initComponentAsync(q, c);
						}
					});
				}
		}
	}
	
	Window.addWindowClosingHandler(new Window.ClosingHandler() {
		@Override
		public void onWindowClosing(Window.ClosingEvent event) {
			if (isLoadingDisplayed() || LoadingWidget.getInstance().isShowing()) return;
			LoadingWidget.showLoading(MESSAGES.waitPlease());
			iPageLoadingTimer = new Timer() {
				@Override
				public void run() {
					RPC.execute(new IsSessionBusyRpcRequest(), new AsyncCallback<GwtRpcResponseBoolean>() {
						@Override
						public void onFailure(Throwable caught) {
							LoadingWidget.hideLoading();
						}
						@Override
						public void onSuccess(GwtRpcResponseBoolean result) {
							if (result.getValue()) {
								iPageLoadingTimer.schedule(500);
							} else {
								LoadingWidget.hideLoading();
							}
						}
					});
				}
			};
			iPageLoadingTimer.schedule(500);
		}
	});
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:82,代碼來源:Client.java

示例4: initComponentAsync

import com.google.gwt.core.client.GWT; //導入方法依賴的package包/類
public void initComponentAsync(final RootPanel panel, final Components comp) {
	GWT.runAsync(new RunAsyncCallback() {
		public void onSuccess() {
			comp.insert(panel);
		}
		public void onFailure(Throwable reason) {
		}
	});
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:10,代碼來源:Client.java

示例5: openDialogAsync

import com.google.gwt.core.client.GWT; //導入方法依賴的package包/類
private void openDialogAsync() {
       GWT.runAsync(new RunAsyncCallback() {
       	public void onSuccess() {
       		openDialog();
       	}
       	public void onFailure(Throwable reason) {
       		UniTimeNotifications.error(MESSAGES.failedToLoadTheApp(reason.getMessage()));
       	}
       });
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:11,代碼來源:CourseSelectionSuggestBox.java

示例6: showSuggestionsAsync

import com.google.gwt.core.client.GWT; //導入方法依賴的package包/類
public void showSuggestionsAsync(final int rowIndex) {
	if (rowIndex < 0) return;
	GWT.runAsync(new RunAsyncCallback() {
		public void onSuccess() {
			openSuggestionsBox(rowIndex);
		}
		public void onFailure(Throwable caught) {
			iStatus.error(MESSAGES.exceptionSuggestionsFailed(caught.getMessage()), caught);
		}
	});
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:12,代碼來源:StudentSectioningWidget.java


注:本文中的com.google.gwt.core.client.GWT.runAsync方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。