setTitle(uidl.getStringAttribute("description"));
}
+ if (uidl.hasAttribute("hideOnMouseOut")) {
+ popup.setHideOnMouseOut(uidl.getBooleanAttribute("hideOnMouseOut"));
+ }
+
// Render the popup if visible and show it.
if (hostPopupVisible) {
UIDL popupUIDL = uidl.getChildUIDL(0);
* @param host
* the widget to draw the popup on
*/
- // private void showPopupOnTop(final CustomPopup popup, final Widget host) {
- // popup.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
- // public void setPosition(int offsetWidth, int offsetHeight) {
- // int hostHorizontalCenter = host.getAbsoluteLeft()
- // + host.getOffsetWidth() / 2;
- // int hostVerticalCenter = host.getAbsoluteTop()
- // + host.getOffsetHeight() / 2;
- //
- // int left = hostHorizontalCenter - offsetWidth / 2;
- // int top = hostVerticalCenter - offsetHeight / 2;
- //
- // // Superclass takes care of top and left
- // if ((left + offsetWidth) > windowRight) {
- // left -= (left + offsetWidth) - windowRight;
- // }
- //
- // if ((top + offsetHeight) > windowBottom) {
- // top -= (top + offsetHeight) - windowBottom;
- // }
- //
- // popup.setPopupPosition(left, top);
- // }
- // });
- // }
+
public void updateWindowSize() {
windowTop = RootPanel.get().getAbsoluteTop();
windowLeft = RootPanel.get().getAbsoluteLeft();
private ICaptionWrapper captionWrapper = null;
private boolean hasHadMouseOver = false;
+ private boolean hideOnMouseOut = true;
private final Set<Element> activeChildren;
public CustomPopup() {
}
if (!eventTargetsPopup & type == Event.ONMOUSEMOVE) {
- if (hasHadMouseOver) {
+
+ if (hasHadMouseOver && hideOnMouseOut) {
hide();
- hasHadMouseOver = false;
return true;
}
}
}
activeChildren.clear();
remove(popupComponentWidget);
+ hasHadMouseOver = false;
super.hide();
}
return new RenderSpace(windowRight, windowBottom);
}
+ public boolean isHideOnMouseOut() {
+ return hideOnMouseOut;
+ }
+
+ public void setHideOnMouseOut(boolean hideOnMouseOut) {
+ this.hideOnMouseOut = hideOnMouseOut;
+ }
+
}// class CustomPopup
}// class IPopupView
private Content content;
private boolean popupVisible;
+ private boolean hideOnMouseOut;
private final ArrayList<Component> componentList;
/* Constructors */
public PopupView(PopupView.Content content) {
super();
popupVisible = false;
+ hideOnMouseOut = true;
componentList = new ArrayList<Component>(1);
setContent(content);
}
return popupVisible;
}
+ /**
+ * Check if this popup will be hidden when the user takes the mouse cursor
+ * out of the popup area.
+ *
+ * @return true if the popup is hidden on mouse out, false otherwise
+ */
+ public boolean isHideOnMouseOut() {
+ return hideOnMouseOut;
+ }
+
+ /**
+ * Should the popup automaticly hide when the user takes the mouse cursor
+ * out of the popup area? If this is false, the user must click outside the
+ * popup to close it. The default is true.
+ *
+ * @param hideOnMouseOut
+ *
+ */
+ public void setHideOnMouseOut(boolean hideOnMouseOut) {
+ this.hideOnMouseOut = hideOnMouseOut;
+ }
+
/*
* Methods inherited from AbstractComponentContainer. These are unnecessary
* (but mandatory). Most of them are not supported in this implementation.
"Recieved null when trying to paint minimized value.");
}
target.addAttribute("html", content.getMinimizedValueAsHTML());
+ target.addAttribute("hideOnMouseOut", hideOnMouseOut);
// Only paint component to client if we know that the popup is showing
if (popupVisible) {