getElement().updateZIndex(0);
if (modal) {
modalPreview = Event.addNativePreviewHandler(new NativePreviewHandler() {
public void onPreviewNativeEvent(NativePreviewEvent event) {
if (Element.is(event.getNativeEvent().getEventTarget())) {
XElement target = event.getNativeEvent().getEventTarget().<XElement> cast();
String tag = target.getTagName();
// ignore html and body because of frames
if (!resizing && !dragging && !tag.equalsIgnoreCase("html") && !tag.equalsIgnoreCase("body")
&& event.getTypeInt() != Event.ONLOAD && manager.getActive() == Window.this
&& (modalPanel == null || (modalPanel != null && !modalPanel.getElement().isOrHasChild(target)))
&& !Window.this.getElement().isOrHasChild(target)
&& target.findParent("." + CommonStyles.get().ignore(), -1) == null) {
// ArrayList<Component> col = new
// ArrayList<Component>(ComponentManager.get().getAll());
// for (Component c : col) {
// if (c instanceof TriggerField<?>) {
// triggerBlur((TriggerField<?>) c);
// } else if (c instanceof Menu) {
// ((Menu) c).hide(true);
// }
// }
// Window.this.focus();
}
}
}
// private native void triggerBlur(TriggerField<?> field) /*-{
// field.@com.extjs.gxt.ui.client.widget.form.TriggerField::triggerBlur(Lcom/extjs/gxt/ui/client/event/ComponentEvent;)(null);
// }-*/;
});
}
// missing cursor workaround
if (GXT.isGecko()) {
XElement e = getElement().selectNode("." + getStylePrimaryName() + "-bwrap");
if (e != null) {
e.getStyle().setProperty("overflow", "auto");
e.getStyle().setProperty("position", "static");
}
}
eventPreview.add();