diff options
author | Artur Signell <artur@vaadin.com> | 2013-04-23 14:54:48 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2013-04-23 14:54:48 +0300 |
commit | ed79188e0dd8876496c9848ca40479256e08c6c3 (patch) | |
tree | 53ec00a284329cdf68d413cfa2c65bbb9a40e3eb /client/src | |
parent | 53b5766731b678694ee83ce8dd3592185ba36105 (diff) | |
parent | feb9a8c3510afc76c079fafcd9e507205bde139c (diff) | |
download | vaadin-framework-ed79188e0dd8876496c9848ca40479256e08c6c3.tar.gz vaadin-framework-ed79188e0dd8876496c9848ca40479256e08c6c3.zip |
Merge commit 'feb9a8c3510afc76c079fafcd9e507205bde139c'
Conflicts:
WebContent/release-notes.html
theme-compiler/src/com/vaadin/sass/internal/parser/Parser.java
Change-Id: Iad9ee95b2f399ff93f0e426a0810b18d923f8ff6
Diffstat (limited to 'client/src')
7 files changed, 92 insertions, 10 deletions
diff --git a/client/src/com/vaadin/client/ui/AbstractClickEventHandler.java b/client/src/com/vaadin/client/ui/AbstractClickEventHandler.java index bd2654df75..2f97d30ece 100644 --- a/client/src/com/vaadin/client/ui/AbstractClickEventHandler.java +++ b/client/src/com/vaadin/client/ui/AbstractClickEventHandler.java @@ -33,6 +33,7 @@ import com.google.gwt.user.client.Event.NativePreviewEvent; import com.google.gwt.user.client.Event.NativePreviewHandler; import com.vaadin.client.ComponentConnector; import com.vaadin.client.Util; +import com.vaadin.client.VConsole; public abstract class AbstractClickEventHandler implements MouseDownHandler, MouseUpHandler, DoubleClickHandler, ContextMenuHandler { @@ -77,7 +78,7 @@ public abstract class AbstractClickEventHandler implements MouseDownHandler, && elementUnderMouse == lastMouseDownTarget) { mouseUpPreviewMatched = true; } else { - System.out.println("Ignoring mouseup from " + VConsole.log("Ignoring mouseup from " + elementUnderMouse + " when mousedown was on " + lastMouseDownTarget); } diff --git a/client/src/com/vaadin/client/ui/VAbstractSplitPanel.java b/client/src/com/vaadin/client/ui/VAbstractSplitPanel.java index 45c5cb6453..1cc25c741e 100644 --- a/client/src/com/vaadin/client/ui/VAbstractSplitPanel.java +++ b/client/src/com/vaadin/client/ui/VAbstractSplitPanel.java @@ -499,6 +499,9 @@ public class VAbstractSplitPanel extends ComplexPanel { /** For internal use only. May be removed or replaced in the future. */ public void setFirstWidget(Widget w) { + if (firstChild == w) { + return; + } if (firstChild != null) { firstChild.removeFromParent(); } @@ -510,6 +513,9 @@ public class VAbstractSplitPanel extends ComplexPanel { /** For internal use only. May be removed or replaced in the future. */ public void setSecondWidget(Widget w) { + if (secondChild == w) { + return; + } if (secondChild != null) { secondChild.removeFromParent(); } diff --git a/client/src/com/vaadin/client/ui/VAccordion.java b/client/src/com/vaadin/client/ui/VAccordion.java index 6c4bd06b6d..f87186fe37 100644 --- a/client/src/com/vaadin/client/ui/VAccordion.java +++ b/client/src/com/vaadin/client/ui/VAccordion.java @@ -34,6 +34,7 @@ import com.vaadin.client.Util; import com.vaadin.client.VCaption; import com.vaadin.client.ui.TouchScrollDelegate.TouchScrollHandler; import com.vaadin.shared.ui.tabsheet.TabsheetBaseConstants; +import com.vaadin.shared.ui.tabsheet.TabsheetConstants; public class VAccordion extends VTabsheetBase { @@ -76,6 +77,9 @@ public class VAccordion extends VTabsheetBase { } item.updateCaption(tabUidl); + item.updateTabStyleName(tabUidl + .getStringAttribute(TabsheetConstants.TAB_STYLE_NAME)); + item.setVisible(!hidden); if (selected) { @@ -290,6 +294,7 @@ public class VAccordion extends VTabsheetBase { private boolean open = false; private Element content = DOM.createDiv(); private Element captionNode = DOM.createDiv(); + private String styleName; public StackItem(UIDL tabUidl) { setElement(DOM.createDiv()); @@ -312,6 +317,7 @@ public class VAccordion extends VTabsheetBase { captionNode.removeClassName(getStylePrimaryName() + "-caption"); setStylePrimaryName(primaryStyleName + "-item"); + updateTabStyleName(getStylePrimaryName()); captionNode.addClassName(getStylePrimaryName() + "-caption"); content.addClassName(getStylePrimaryName() + "-content"); @@ -399,6 +405,32 @@ public class VAccordion extends VTabsheetBase { uidl.getStringAttribute(TabsheetBaseConstants.ATTRIBUTE_TAB_ICON)); } + /** + * Updates a tabs stylename from the child UIDL + * + * @param uidl + * The child uidl of the tab + */ + private void updateTabStyleName(String newStyleName) { + if (newStyleName != null && newStyleName.length() != 0) { + if (!newStyleName.equals(styleName)) { + // If we have a new style name + if (styleName != null && styleName.length() != 0) { + // Remove old style name if present + removeStyleDependentName(styleName); + } + // Set new style name + addStyleDependentName(newStyleName); + styleName = newStyleName; + } + } else if (styleName != null) { + // Remove the set stylename if no stylename is present in the + // uidl + removeStyleDependentName(styleName); + styleName = null; + } + } + public int getWidgetWidth() { return DOM.getFirstChild(content).getOffsetWidth(); } diff --git a/client/src/com/vaadin/client/ui/VNativeButton.java b/client/src/com/vaadin/client/ui/VNativeButton.java index 6fd5d8d2ee..6e1c5bae77 100644 --- a/client/src/com/vaadin/client/ui/VNativeButton.java +++ b/client/src/com/vaadin/client/ui/VNativeButton.java @@ -16,9 +16,14 @@ package com.vaadin.client.ui; +import com.google.gwt.core.client.Scheduler; +import com.google.gwt.core.client.Scheduler.ScheduledCommand; +import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Element; +import com.google.gwt.dom.client.NativeEvent; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.event.dom.client.MouseEvent; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Event; import com.google.gwt.user.client.ui.Button; @@ -26,6 +31,7 @@ import com.vaadin.client.ApplicationConnection; import com.vaadin.client.BrowserInfo; import com.vaadin.client.MouseEventDetailsBuilder; import com.vaadin.client.Util; +import com.vaadin.client.VConsole; import com.vaadin.shared.MouseEventDetails; import com.vaadin.shared.ui.button.ButtonServerRpc; @@ -60,6 +66,8 @@ public class VNativeButton extends Button implements ClickHandler { */ private boolean clickPending; + private boolean cancelNextClick = false; + /** For internal use only. May be removed or replaced in the future. */ public boolean disableOnClick = false; @@ -71,8 +79,8 @@ public class VNativeButton extends Button implements ClickHandler { addClickHandler(this); - sinkEvents(Event.ONMOUSEDOWN); - sinkEvents(Event.ONMOUSEUP); + sinkEvents(Event.ONMOUSEDOWN | Event.ONLOAD | Event.ONMOUSEMOVE + | Event.ONFOCUS); } @Override @@ -95,6 +103,7 @@ public class VNativeButton extends Button implements ClickHandler { } else if (DOM.eventGetType(event) == Event.ONMOUSEDOWN && event.getButton() == Event.BUTTON_LEFT) { clickPending = true; + } else if (DOM.eventGetType(event) == Event.ONMOUSEMOVE) { clickPending = false; } else if (DOM.eventGetType(event) == Event.ONMOUSEOUT) { @@ -102,6 +111,21 @@ public class VNativeButton extends Button implements ClickHandler { click(); } clickPending = false; + } else if (event.getTypeInt() == Event.ONFOCUS) { + if (BrowserInfo.get().isIE() && clickPending) { + /* + * The focus event will mess up IE and IE will not trigger the + * mouse up event (which in turn triggers the click event) until + * the mouse is moved. This will result in it appearing as a + * native button not triggering the event. So we manually + * trigger the click here and cancel the next original event + * which will occur on the next mouse move. See ticket #11094 + * for details. + */ + click(); + clickPending = false; + cancelNextClick = true; + } } } @@ -120,7 +144,8 @@ public class VNativeButton extends Button implements ClickHandler { */ @Override public void onClick(ClickEvent event) { - if (paintableId == null || client == null) { + if (paintableId == null || client == null || cancelNextClick) { + cancelNextClick = false; return; } diff --git a/client/src/com/vaadin/client/ui/VUI.java b/client/src/com/vaadin/client/ui/VUI.java index b07593896f..9a73aa5f8f 100644 --- a/client/src/com/vaadin/client/ui/VUI.java +++ b/client/src/com/vaadin/client/ui/VUI.java @@ -133,10 +133,16 @@ public class VUI extends SimplePanel implements ResizeHandler, // Send the location to the server if the fragment has changed // and flush active connectors in UI. if (!newFragment.equals(currentFragment) && connection != null) { + + // Ensure the fragment is properly encoded in all browsers + // (#10769) + String location = Window.Location.createUrlBuilder() + .buildString(); + currentFragment = newFragment; connection.flushActiveConnector(); connection.updateVariable(id, UIConstants.LOCATION_VARIABLE, - Window.Location.getHref(), true); + location, true); } } }; diff --git a/client/src/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java b/client/src/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java index 93176f67bb..d8b0888936 100644 --- a/client/src/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java +++ b/client/src/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java @@ -29,6 +29,7 @@ import com.google.gwt.user.client.Element; import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.RequiresResize; import com.google.gwt.user.client.ui.Widget; +import com.vaadin.client.BrowserInfo; import com.vaadin.client.LayoutManager; import com.vaadin.client.Util; import com.vaadin.shared.ui.MarginInfo; @@ -411,10 +412,19 @@ public class VAbstractOrderedLayout extends FlowPanel { } else { // Non-relative child without expansion should be unconstrained - if (vertical) { - slotStyle.clearHeight(); + if (BrowserInfo.get().isIE8()) { + // unconstrained in IE8 is auto + if (vertical) { + slot.setHeight("auto"); + } else { + slot.setWidth("auto"); + } } else { - slotStyle.clearWidth(); + if (vertical) { + slotStyle.clearHeight(); + } else { + slotStyle.clearWidth(); + } } } } diff --git a/client/src/com/vaadin/client/ui/ui/UIConnector.java b/client/src/com/vaadin/client/ui/ui/UIConnector.java index e7c4c5b4a8..601349d244 100644 --- a/client/src/com/vaadin/client/ui/ui/UIConnector.java +++ b/client/src/com/vaadin/client/ui/ui/UIConnector.java @@ -32,6 +32,7 @@ import com.google.gwt.event.dom.client.ScrollEvent; import com.google.gwt.event.dom.client.ScrollHandler; import com.google.gwt.event.logical.shared.ResizeEvent; import com.google.gwt.event.logical.shared.ResizeHandler; +import com.google.gwt.http.client.URL; import com.google.gwt.user.client.Command; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Element; @@ -317,8 +318,9 @@ public class UIConnector extends AbstractSingleComponentContainerConnector .getStringAttribute(UIConstants.LOCATION_VARIABLE); int fragmentIndex = location.indexOf('#'); if (fragmentIndex >= 0) { - getWidget().currentFragment = location - .substring(fragmentIndex + 1); + // Decode fragment to avoid double encoding (#10769) + getWidget().currentFragment = URL.decodePathSegment(location + .substring(fragmentIndex + 1)); } if (!getWidget().currentFragment.equals(History.getToken())) { History.newItem(getWidget().currentFragment, true); |