diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-07-31 12:00:44 +0300 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2012-07-31 12:00:44 +0300 |
commit | e6ba86347ce0aea0b2dd7aa064586ce4fe7f2096 (patch) | |
tree | 5d07d002edd4984536ade795c8c42451651d6f5c /src/com/vaadin/terminal | |
parent | 569a82a7bfc4958a9ac164e16caecc3fb47fdbc7 (diff) | |
parent | 64c7bbb569d5194eb9c5c083726a8c96053368e8 (diff) | |
download | vaadin-framework-e6ba86347ce0aea0b2dd7aa064586ce4fe7f2096.tar.gz vaadin-framework-e6ba86347ce0aea0b2dd7aa064586ce4fe7f2096.zip |
Merge remote-tracking branch 'origin/6.8'
Conflicts:
src/com/vaadin/terminal/gwt/client/ui/popupview/VPopupView.java
tests/testbench/com/vaadin/tests/components/popupview/PopupViewClickShortcut.java
tests/testbench/com/vaadin/tests/containers/sqlcontainer/CheckboxUpdateProblem.java
Diffstat (limited to 'src/com/vaadin/terminal')
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/popupview/VPopupView.java | 33 | ||||
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/splitpanel/VAbstractSplitPanel.java | 19 |
2 files changed, 42 insertions, 10 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/popupview/VPopupView.java b/src/com/vaadin/terminal/gwt/client/ui/popupview/VPopupView.java index c923c5d0ab..1b7cfd091f 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/popupview/VPopupView.java +++ b/src/com/vaadin/terminal/gwt/client/ui/popupview/VPopupView.java @@ -10,6 +10,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; @@ -26,6 +28,8 @@ import com.vaadin.terminal.gwt.client.ApplicationConnection; import com.vaadin.terminal.gwt.client.ComponentConnector; import com.vaadin.terminal.gwt.client.UIDL; import com.vaadin.terminal.gwt.client.VCaptionWrapper; +import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler; +import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner; import com.vaadin.terminal.gwt.client.ui.VOverlay; import com.vaadin.terminal.gwt.client.ui.richtextarea.VRichTextArea; @@ -183,8 +187,23 @@ public class VPopupView extends HTML { 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() { + @Override + 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 @@ -233,12 +252,26 @@ public class VPopupView extends HTML { 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(); } diff --git a/src/com/vaadin/terminal/gwt/client/ui/splitpanel/VAbstractSplitPanel.java b/src/com/vaadin/terminal/gwt/client/ui/splitpanel/VAbstractSplitPanel.java index 1c14ce2a73..a20c0476a5 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/splitpanel/VAbstractSplitPanel.java +++ b/src/com/vaadin/terminal/gwt/client/ui/splitpanel/VAbstractSplitPanel.java @@ -255,23 +255,22 @@ public class VAbstractSplitPanel extends ComplexPanel { * @return */ private float convertToPercentage(String pos) { - float posAsFloat = 0; - - if (pos.indexOf("px") > 0) { - int posAsInt = Integer.parseInt(pos.substring(0, pos.length() - 2)); + if (pos.endsWith("px")) { + float pixelPosition = Float.parseFloat(pos.substring(0, + pos.length() - 2)); int offsetLength = orientation == ORIENTATION_HORIZONTAL ? getOffsetWidth() : getOffsetHeight(); - // 100% needs special handling - if (posAsInt + getSplitterSize() >= offsetLength) { - posAsInt = offsetLength; + // Take splitter size into account at the edge + if (pixelPosition + getSplitterSize() >= offsetLength) { + return 100; } - posAsFloat = ((float) posAsInt / (float) offsetLength * 100); + return pixelPosition / offsetLength * 100; } else { - posAsFloat = Float.parseFloat(pos.substring(0, pos.length() - 1)); + assert pos.endsWith("%"); + return Float.parseFloat(pos.substring(0, pos.length() - 1)); } - return posAsFloat; } /** |