From: Matti Tahvonen Date: Fri, 9 Jan 2009 10:48:16 +0000 (+0000) Subject: cleaning X-Git-Tag: 6.7.0.beta1~3376 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=91e6aa019792937b0c315e8c321488829f8ad298;p=vaadin-framework.git cleaning svn changeset:6475/svn branch:trunk --- diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/IPopupView.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/IPopupView.java index b47c5ecb98..01c16930a7 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/ui/IPopupView.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/IPopupView.java @@ -1,7 +1,6 @@ package com.itmill.toolkit.terminal.gwt.client.ui; import java.util.HashSet; -import java.util.Iterator; import java.util.Set; import com.google.gwt.user.client.DOM; @@ -31,9 +30,6 @@ public class IPopupView extends HTML implements Paintable { private String uidlId; private ApplicationConnection client; - /** For inner classes */ - private final IPopupView hostReference = this; - /** This variable helps to communicate popup visibility to the server */ private boolean hostPopupVisible; @@ -104,9 +100,9 @@ public class IPopupView extends HTML implements Paintable { UIDL popupUIDL = uidl.getChildUIDL(0); // showPopupOnTop(popup, hostReference); - preparePopup(popup, hostReference); + preparePopup(popup); popup.updateFromUIDL(popupUIDL, client); - showPopup(popup, hostReference); + showPopup(popup); // The popup shouldn't be visible, try to hide it. } else { @@ -122,17 +118,17 @@ public class IPopupView extends HTML implements Paintable { private void updateState(boolean visible) { // If we know the server connection // then update the current situation - if (uidlId != null && client != null && this.isAttached()) { + if (uidlId != null && client != null && isAttached()) { client.updateVariable(uidlId, "popupVisibility", visible, true); } } - private void preparePopup(final CustomPopup popup, final Widget host) { + private void preparePopup(final CustomPopup popup) { popup.setVisible(false); popup.show(); } - private void showPopup(final CustomPopup popup, final Widget host) { + private void showPopup(final CustomPopup popup) { int windowTop = RootPanel.get().getAbsoluteTop(); int windowLeft = RootPanel.get().getAbsoluteLeft(); int windowRight = windowLeft + RootPanel.get().getOffsetWidth(); @@ -141,10 +137,10 @@ public class IPopupView extends HTML implements Paintable { int offsetWidth = popup.getOffsetWidth(); int offsetHeight = popup.getOffsetHeight(); - int hostHorizontalCenter = host.getAbsoluteLeft() - + host.getOffsetWidth() / 2; - int hostVerticalCenter = host.getAbsoluteTop() + host.getOffsetHeight() - / 2; + int hostHorizontalCenter = IPopupView.this.getAbsoluteLeft() + + IPopupView.this.getOffsetWidth() / 2; + int hostVerticalCenter = IPopupView.this.getAbsoluteTop() + + IPopupView.this.getOffsetHeight() / 2; int left = hostHorizontalCenter - offsetWidth / 2; int top = hostVerticalCenter - offsetHeight / 2; @@ -177,7 +173,7 @@ public class IPopupView extends HTML implements Paintable { private static native void nativeBlur(Element e) /*-{ - if(e.focus) { + if(e && e.blur) { e.blur(); } }-*/; @@ -190,11 +186,10 @@ public class IPopupView extends HTML implements Paintable { private boolean hasHadMouseOver = false; private boolean hideOnMouseOut = true; - private final Set activeChildren; + private final Set activeChildren = new HashSet(); public CustomPopup() { super(true, false, true); // autoHide, not modal, dropshadow - activeChildren = new HashSet(); } // For some reason ONMOUSEOUT events are not always recieved, so we have @@ -246,10 +241,9 @@ public class IPopupView extends HTML implements Paintable { } // Notify children that have used the keyboard - for (Iterator iterator = activeChildren.iterator(); iterator - .hasNext();) { + for (Element e : activeChildren) { try { - nativeBlur(iterator.next()); + nativeBlur(e); } catch (Exception ignored) { } }