Wednesday, January 26, 2011

zIndex of submenu in MenuBar

Hello,

I have a multi layer application and try to use a menubar with
submenus.
The menubar itself is displayed on to after setting the zIndex, but
the submenus are created behind my other components.

I tried to set the zIndex on the submenu items, but the setting seems
to be ignored.
Only in IE it works correctly, in FF and Chrome the submenu is
displayed with the wrong zIndex.

Here's a small code snippet how I create the menu in my popup and set
the zIndex:

protected void showPopup(CodeViewerDto value, int x, int y) {
int layer = indexOfTopWindow() + 1;
DOM.setIntStyleAttribute(popup.getElement(), "zIndex", layer +
20);
popup.setWidth("150px");
MenuBar menu = new MenuBar(true);
MenuItem item = null;
DOM.setIntStyleAttribute(menu.getElement(), "zIndex", layer +
30);

popup.setWidget(menu);
int left = 0;
int top = 0;
popup.setPopupPosition(left, top);
popup.show();

Map<String, MenuBar> submenus = new HashMap<String,
MenuBar>();
for (LineMarker lm : value.getLineMarkers()) {
MenuBar submenu;
if (submenus.containsKey(lm.getViolationType())) {
submenu = submenus.get(lm.getViolationType());
} else {
submenu = new MenuBar();
submenus.put(lm.getViolationType(), submenu);
}

SafeHtmlBuilder sb = new SafeHtmlBuilder();
sb.appendEscaped(lm.getMessage());
MenuItem item2 = new MenuItem(sb.toSafeHtml());
submenu.addItem(item2);
}
for (String s : submenus.keySet()) {
MenuBar submenu = submenus.get(s);
DOM.setIntStyleAttribute(submenu.getElement(), "zIndex",
layer + 40);
item = new MenuItem(s, submenu);
DOM.setIntStyleAttribute(item.getElement(), "zIndex",
layer + 50);
menu.addItem(item);
}
}

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate