Gwt中為加載中的Frame加上wait
Gwt中調(diào)用panel的setUrl方法嵌入一個(gè)網(wǎng)頁
在網(wǎng)頁加載過程中加入wait 在頁面中加入javascript var ready = false; $j(document).ready(function(){ ready = true; });//這里用了jquery 然后再java中聲明 public native boolean ready(Element frame)/*-{ return frame.contentWindow.ready?true:false; }-*/; 然后在設(shè)置Frame的url時(shí) olapFrame = centerCp.setUrl(GWT.getHostPageBaseURL() + com.google.gwt.http.client.URL.encode("jsp/showOlap.jsp?dim=" + dims + "&dimname=" + colLabels + "")); final MessageBox box = MessageBox.wait("等待", "正在查詢數(shù)據(jù),請(qǐng)稍后...", "查詢中..."); final Element frame = olapFrame.getElement(); final Timer t = new Timer() { @Override public void run() { if (ready(frame)) { this.cancel(); box.close(); } } }; t.scheduleRepeating(100); |
posted on 2010-05-19 09:54 豬 閱讀(482) 評(píng)論(0) 編輯 收藏 所屬分類: gwt