我是 GWT 和网络方面的新手。
我正在根据以下内容制定自己的项目 http://code.google.com/p/cloud-tasks-io/source/browse/#svn%2Ftrunk%2FCloudTasks-AppEngine%2Fsrc%2Fcom%2Fcloudtasks%2Fclient
我正在尝试使用弹出窗口/对话框。弹出窗口和对话框始终显示在小部件后面。我一直在谷歌上搜索,发现最相关的是这个 http://groups.google.com/group/gwt-google-apis/browse_thread/thread/40db4fcbe10d2060这没有提供任何答案。不管怎样,我有第 3 方库,bst-player 1.3,它使用 flash。所以我禁用了它(后来也将其删除),弹出窗口就不会出现在顶部!它仍然隐藏在小部件后面。
我了解到 popuppanel/dialogpanel 类似 do not need to get added to another widget 。另一种说法是,从某种意义上说,它不是一个普通的小部件,它不能附加到父级,但它会将自己附加到 dom 以保证位于顶部(来自 GWT composite widget )
我已经无计可施了,我在这里……
更新
这是我的 Popup 类
public class PopUp {
static PopupPanel simplePopup;
public static void init() {
simplePopup = new PopupPanel(true);
simplePopup.hide();
simplePopup.setVisible(false);
// DOM.setIntStyleAttribute(simplePopup.getElement(), "zIndex", 3);
}
public static void showpopupmsg(String msg, int left, int top) {
if (simplePopup == null) {
init();
}
if (msg != null && !msg.equalsIgnoreCase("")) {
simplePopup.ensureDebugId("cwBasicPopup-simplePopup");
simplePopup.setWidget(new HTML(msg));
simplePopup.setVisible(true);
simplePopup.setPopupPosition(left, top);
simplePopup.setWidth("475px"); //575
simplePopup.setGlassEnabled(true);
simplePopup.show();
}
}
public static void show(String message){
if (simplePopup == null) {
init();
}
simplePopup.setGlassEnabled(true);
simplePopup.setTitle(message);
simplePopup.center();
}
}
这是我的通话方式
tasksTable.doneColumn.setFieldUpdater(new FieldUpdater<TaskProxy, Boolean>() {
public void update(int index, TaskProxy task, Boolean value) {
String msg = "Here is the popup. All the way underneath";
Widget source = tasksTable;
int left = source.getAbsoluteLeft() - 50;
// source.getAbsoluteLeft() + 25;
int top = source.getAbsoluteTop() - 25;
PopUp.showpopupmsg(msg, left, top); //Here is the calling method
TaskRequest request = requestFactory.taskRequest();
TaskProxy updatedTask = request.edit(task);
updatedTask.setDone(value);
request.updateTask(updatedTask).fire();
}
});
以下是弹出窗口位于小部件下方的方式。
最佳答案
问题的根源一直难以捉摸,因为我对网络应用程序还是个新手,但我最终自己解决了它。罪魁祸首是CSS。它将整个事物的 z-index 定义得相当高,如以下代码行 1333 所示。
我之前对 z-index 表示怀疑,并尝试使用微不足道的值 3 进行尝试,如相关 Popup 类的注释掉代码段中所示。我必须取消注释并将其设置为 101。
DOM.setIntStyleAttribute(simplePopup.getElement(), "zIndex", 101);
我是,你知道,#$%#@#$*。
关于gwt - 弹出面板显示在小部件下方,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10068633/