|
|
@@ -11,6 +11,8 @@ import java.util.Set; |
|
|
|
import com.google.gwt.event.dom.client.ClickEvent; |
|
|
|
import com.google.gwt.event.dom.client.ClickHandler; |
|
|
|
import com.google.gwt.event.dom.client.KeyCodes; |
|
|
|
import com.google.gwt.event.dom.client.KeyDownEvent; |
|
|
|
import com.google.gwt.event.dom.client.KeyDownHandler; |
|
|
|
import com.google.gwt.event.logical.shared.CloseEvent; |
|
|
|
import com.google.gwt.event.logical.shared.CloseHandler; |
|
|
|
import com.google.gwt.user.client.DOM; |
|
|
@@ -33,6 +35,7 @@ import com.vaadin.terminal.gwt.client.Util; |
|
|
|
import com.vaadin.terminal.gwt.client.VCaption; |
|
|
|
import com.vaadin.terminal.gwt.client.VCaptionWrapper; |
|
|
|
import com.vaadin.terminal.gwt.client.VTooltip; |
|
|
|
import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner; |
|
|
|
import com.vaadin.terminal.gwt.client.ui.richtextarea.VRichTextArea; |
|
|
|
|
|
|
|
public class VPopupView extends HTML implements Container, Iterable<Widget> { |
|
|
@@ -239,8 +242,22 @@ public class VPopupView extends HTML implements Container, Iterable<Widget> { |
|
|
|
private final Set<Element> activeChildren = new HashSet<Element>(); |
|
|
|
private boolean hiding = false; |
|
|
|
|
|
|
|
private ShortcutActionHandler shortcutActionHandler; |
|
|
|
|
|
|
|
public CustomPopup() { |
|
|
|
super(true, false, true); // autoHide, not modal, dropshadow |
|
|
|
|
|
|
|
// Delegate popup keyboard events to the relevant handler. The |
|
|
|
// events do not propagate automatically because the popup is |
|
|
|
// directly attached to the RootPanel. |
|
|
|
addDomHandler(new KeyDownHandler() { |
|
|
|
public void onKeyDown(KeyDownEvent event) { |
|
|
|
if (shortcutActionHandler != null) { |
|
|
|
shortcutActionHandler.handleKeyboardEvent(Event |
|
|
|
.as(event.getNativeEvent())); |
|
|
|
} |
|
|
|
} |
|
|
|
}, KeyDownEvent.getType()); |
|
|
|
} |
|
|
|
|
|
|
|
// For some reason ONMOUSEOUT events are not always received, so we have |
|
|
@@ -290,12 +307,26 @@ public class VPopupView extends HTML implements Container, Iterable<Widget> { |
|
|
|
remove(popupComponentWidget); |
|
|
|
} |
|
|
|
hasHadMouseOver = false; |
|
|
|
shortcutActionHandler = null; |
|
|
|
super.hide(autoClosed); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void show() { |
|
|
|
hiding = false; |
|
|
|
|
|
|
|
// Find the shortcut action handler that should handle keyboard |
|
|
|
// events from the popup. The events do not propagate automatically |
|
|
|
// because the popup is directly attached to the RootPanel. |
|
|
|
Widget widget = VPopupView.this; |
|
|
|
while (shortcutActionHandler == null && widget != null) { |
|
|
|
if (widget instanceof ShortcutActionHandlerOwner) { |
|
|
|
shortcutActionHandler = ((ShortcutActionHandlerOwner) widget) |
|
|
|
.getShortcutActionHandler(); |
|
|
|
} |
|
|
|
widget = widget.getParent(); |
|
|
|
} |
|
|
|
|
|
|
|
super.show(); |
|
|
|
} |
|
|
|
|