两个屏幕之间的加载指示器GWT
我在GWT的主页上有一个按钮。单击此按钮时,屏幕将更新为新的GWT元素,而不发送RPC调用。但是在这两个屏幕之间,有一段很长的时间。所以我想制作一个加载指示器(比如动画gif)两个屏幕之间的加载指示器GWT,gwt,Gwt,我在GWT的主页上有一个按钮。单击此按钮时,屏幕将更新为新的GWT元素,而不发送RPC调用。但是在这两个屏幕之间,有一段很长的时间。所以我想制作一个加载指示器(比如动画gif) 我该怎么做呢?GWT类PopupPanel有一个可选的“玻璃面板”,可以阻止与下面页面的交互 final PopupPanel popup = new PopupPanel(false, true); // Create a modal dialog box that will not auto-hide popup.a
我该怎么做呢?GWT类PopupPanel有一个可选的“玻璃面板”,可以阻止与下面页面的交互
final PopupPanel popup = new PopupPanel(false, true); // Create a modal dialog box that will not auto-hide
popup.add(new Label("Please wait"));
popup.setGlassEnabled(true); // Enable the glass panel
popup.center(); // Center the popup and make it visible
嗨,我已经实现了同样的目标。在加载其他屏幕之前,我已附加加载图像。以下是代码:
public class Utility {
private static LoadingDlg dlg=new LoadingDlg(false, true);
public static void showLoading(){
if(count <= 0){
dlg.center();
count = 1;
}
else
count++;
}
public static void hideLoading(){
if(count <= 1){
dlg.hide();
count = 0;
}
else{
count--;
}
}
}
public LoadingDlg(boolean autoHide, boolean modal) {
super(autoHide, modal);
this.setGlassEnabled(true);
this.setTitle("Press Esc Key to Hide.");
this.setGlassStyleName("loadingstyle");
FlowPanel hp=new FlowPanel();
hp.setStyleName("loadingImg");
this.getElement().getStyle().setZIndex(500);
this.setWidget(hp);
}
}
}
您必须在图像文件夹中添加loadingimage.gif,并相应地调用showLoading和hideLoading函数。在尝试解决您的问题之前,我会开始挖掘并理解为什么这样做很慢。”原因显示装载指示器可能与显示第二个屏幕一样慢。另外,不要在DevMode中判断性能。问题是在4秒左右阻止应用程序!!!但你是说你不做RPC(我更广泛地理解为“没有与服务器通信,等待响应”),那么什么会阻止4秒钟呢?谢谢你,托马斯。正如您所说,问题不会出现在生产模式中。
.loadingstyle{
display: block !important;
visibility: visible !important;
z-index: 500 !important;
background-color: #000;
opacity: 0.3;
filter: alpha(opacity=30);
.loadingImg{
background-image:url(images/loadingimage.gif);
background-repeat:no-repeat;
display: block;
height: 24px;
width: 161px;