summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2014-11-28 11:42:54 +0200
committerTeemu Suo-Anttila <teemusa@vaadin.com>2014-11-28 11:43:26 +0200
commit4e1b181a699efcd083b14270145bd2e540a2f772 (patch)
tree52917ae7c5f0e97777be8133b6f3109d90a2f2d1 /client
parentfbfca1e9fc7a77e02c4262f0dfbe7ff408633499 (diff)
parenta0f4c3dfb37b1e742b74a78d8133b1bb4a399052 (diff)
downloadvaadin-framework-4e1b181a699efcd083b14270145bd2e540a2f772.tar.gz
vaadin-framework-4e1b181a699efcd083b14270145bd2e540a2f772.zip
Merge remote-tracking branch 'origin/master' into grid
Change-Id: I1983d8a8c86caf75c4f5d32ee9367bbd6d58057c
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/ApplicationConnection.java80
-rw-r--r--client/src/com/vaadin/client/VTooltip.java23
-rw-r--r--client/src/com/vaadin/client/ui/VPopupCalendar.java79
-rw-r--r--client/src/com/vaadin/client/ui/VScrollTable.java4
-rw-r--r--client/src/com/vaadin/client/ui/VTreeTable.java2
5 files changed, 88 insertions, 100 deletions
diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java
index dd780406fa..e1b2ec0c14 100644
--- a/client/src/com/vaadin/client/ApplicationConnection.java
+++ b/client/src/com/vaadin/client/ApplicationConnection.java
@@ -136,6 +136,11 @@ public class ApplicationConnection implements HasHandlers {
* Needed to know where captions might need to get updated
*/
private FastStringSet parentChangedIds = FastStringSet.create();
+
+ /**
+ * Connectors for which the parent has been set to null
+ */
+ private FastStringSet detachedConnectorIds = FastStringSet.create();
}
public static final String MODIFIED_CLASSNAME = "v-modified";
@@ -1627,7 +1632,7 @@ public class ApplicationConnection implements HasHandlers {
json.getValueMap("dd"));
}
- unregisterRemovedConnectors();
+ unregisterRemovedConnectors(connectorHierarchyUpdateResult.detachedConnectorIds);
VConsole.log("handleUIDLMessage: "
+ (Duration.currentTimeMillis() - processUidlStart)
@@ -1727,7 +1732,7 @@ public class ApplicationConnection implements HasHandlers {
sendHierarchyChangeEvents(connectorHierarchyUpdateResult.events);
// Unregister all the old connectors that have now been removed
- unregisterRemovedConnectors();
+ unregisterRemovedConnectors(connectorHierarchyUpdateResult.detachedConnectorIds);
getLayoutManager().cleanMeasuredSizes();
}
@@ -1882,47 +1887,63 @@ public class ApplicationConnection implements HasHandlers {
Profiler.leave("sendStateChangeEvents");
}
- private void unregisterRemovedConnectors() {
- Profiler.enter("unregisterRemovedConnectors");
+ private void verifyConnectorHierarchy() {
+ Profiler.enter("verifyConnectorHierarchy - this is only performed in debug mode");
- int unregistered = 0;
JsArrayObject<ServerConnector> currentConnectors = connectorMap
.getConnectorsAsJsArray();
int size = currentConnectors.size();
for (int i = 0; i < size; i++) {
ServerConnector c = currentConnectors.get(i);
if (c.getParent() != null) {
- // only do this check if debug mode is active
- if (ApplicationConfiguration.isDebugMode()) {
- Profiler.enter("unregisterRemovedConnectors check parent - this is only performed in debug mode");
- // this is slow for large layouts, 25-30% of total
- // time for some operations even on modern browsers
- if (!c.getParent().getChildren().contains(c)) {
- VConsole.error("ERROR: Connector is connected to a parent but the parent does not contain the connector");
- }
- Profiler.leave("unregisterRemovedConnectors check parent - this is only performed in debug mode");
+ if (!c.getParent().getChildren().contains(c)) {
+ VConsole.error("ERROR: Connector "
+ + c.getConnectorId()
+ + " is connected to a parent but the parent ("
+ + c.getParent().getConnectorId()
+ + ") does not contain the connector");
}
} else if (c == getUIConnector()) {
- // UIConnector for this connection, leave as-is
+ // UIConnector for this connection, ignore
} else if (c instanceof WindowConnector
&& getUIConnector().hasSubWindow(
(WindowConnector) c)) {
- // Sub window attached to this UIConnector, leave
- // as-is
+ // Sub window attached to this UIConnector, ignore
} else {
// The connector has been detached from the
- // hierarchy, unregister it and any possible
- // children. The UIConnector should never be
- // unregistered even though it has no parent.
- Profiler.enter("unregisterRemovedConnectors unregisterConnector");
- connectorMap.unregisterConnector(c);
- Profiler.leave("unregisterRemovedConnectors unregisterConnector");
- unregistered++;
+ // hierarchy but was not unregistered.
+ VConsole.error("ERROR: Connector "
+ + c.getConnectorId()
+ + " is not attached to a parent but has not been unregistered");
}
}
- VConsole.log("* Unregistered " + unregistered + " connectors");
+ Profiler.leave("verifyConnectorHierarchy - this is only performed in debug mode");
+ }
+
+ private void unregisterRemovedConnectors(
+ FastStringSet detachedConnectors) {
+ Profiler.enter("unregisterRemovedConnectors");
+
+ JsArrayString detachedArray = detachedConnectors.dump();
+ for (int i = 0; i < detachedArray.length(); i++) {
+ ServerConnector connector = connectorMap
+ .getConnector(detachedArray.get(i));
+
+ Profiler.enter("unregisterRemovedConnectors unregisterConnector");
+ connectorMap.unregisterConnector(connector);
+ Profiler.leave("unregisterRemovedConnectors unregisterConnector");
+ }
+
+ if (ApplicationConfiguration.isDebugMode()) {
+ // Do some extra checking if we're in debug mode (i.e. debug
+ // window is open)
+ verifyConnectorHierarchy();
+ }
+
+ VConsole.log("* Unregistered " + detachedArray.length()
+ + " connectors");
Profiler.leave("unregisterRemovedConnectors");
}
@@ -2357,7 +2378,8 @@ public class ApplicationConnection implements HasHandlers {
for (int i = 0; i < maybeDetachedArray.length(); i++) {
ServerConnector removed = connectorMap
.getConnector(maybeDetachedArray.get(i));
- recursivelyDetach(removed, result.events);
+ recursivelyDetach(removed, result.events,
+ result.detachedConnectorIds);
}
Profiler.leave("updateConnectorHierarchy detach removed connectors");
@@ -2373,7 +2395,9 @@ public class ApplicationConnection implements HasHandlers {
}
private void recursivelyDetach(ServerConnector connector,
- JsArrayObject<ConnectorHierarchyChangeEvent> events) {
+ JsArrayObject<ConnectorHierarchyChangeEvent> events,
+ FastStringSet detachedConnectors) {
+ detachedConnectors.add(connector.getConnectorId());
/*
* Reset state in an attempt to keep it consistent with the
@@ -2434,7 +2458,7 @@ public class ApplicationConnection implements HasHandlers {
if (child.getParent() != connector) {
continue;
}
- recursivelyDetach(child, events);
+ recursivelyDetach(child, events, detachedConnectors);
}
Profiler.leave("ApplicationConnection recursivelyDetach perform detach");
diff --git a/client/src/com/vaadin/client/VTooltip.java b/client/src/com/vaadin/client/VTooltip.java
index edd1273bf5..47a1b71228 100644
--- a/client/src/com/vaadin/client/VTooltip.java
+++ b/client/src/com/vaadin/client/VTooltip.java
@@ -210,6 +210,14 @@ public class VTooltip extends VOverlay {
x = Window.getClientWidth() - offsetWidth - MARGIN
+ Window.getScrollLeft();
}
+
+ if (tooltipEventMouseX != EVENT_XY_POSITION_OUTSIDE) {
+ // Do not allow x to be zero, for otherwise the tooltip
+ // does not close when the mouse is moved (see
+ // isTooltipOpen()). #15129
+ int minX = Window.getScrollLeft() + MARGIN;
+ x = Math.max(x, minX);
+ }
return x;
}
@@ -245,6 +253,14 @@ public class VTooltip extends VOverlay {
y = Window.getScrollTop();
}
}
+
+ if (tooltipEventMouseY != EVENT_XY_POSITION_OUTSIDE) {
+ // Do not allow y to be zero, for otherwise the tooltip
+ // does not close when the mouse is moved (see
+ // isTooltipOpen()). #15129
+ int minY = Window.getScrollTop() + MARGIN;
+ y = Math.max(y, minY);
+ }
return y;
}
});
@@ -323,6 +339,7 @@ public class VTooltip extends VOverlay {
setPopupPosition(tooltipEventMouseX, tooltipEventMouseY);
}
+ private int EVENT_XY_POSITION_OUTSIDE = -5000;
private int tooltipEventMouseX;
private int tooltipEventMouseY;
@@ -332,11 +349,13 @@ public class VTooltip extends VOverlay {
}
private int getEventX(Event event, boolean isFocused) {
- return isFocused ? -5000 : DOM.eventGetClientX(event);
+ return isFocused ? EVENT_XY_POSITION_OUTSIDE : DOM
+ .eventGetClientX(event);
}
private int getEventY(Event event, boolean isFocused) {
- return isFocused ? -5000 : DOM.eventGetClientY(event);
+ return isFocused ? EVENT_XY_POSITION_OUTSIDE : DOM
+ .eventGetClientY(event);
}
@Override
diff --git a/client/src/com/vaadin/client/ui/VPopupCalendar.java b/client/src/com/vaadin/client/ui/VPopupCalendar.java
index fbd66cff09..51b2ee22ec 100644
--- a/client/src/com/vaadin/client/ui/VPopupCalendar.java
+++ b/client/src/com/vaadin/client/ui/VPopupCalendar.java
@@ -27,10 +27,6 @@ import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.DomEvent;
import com.google.gwt.event.dom.client.KeyCodes;
-import com.google.gwt.event.dom.client.MouseOutEvent;
-import com.google.gwt.event.dom.client.MouseOutHandler;
-import com.google.gwt.event.dom.client.MouseOverEvent;
-import com.google.gwt.event.dom.client.MouseOverHandler;
import com.google.gwt.event.logical.shared.CloseEvent;
import com.google.gwt.event.logical.shared.CloseHandler;
import com.google.gwt.i18n.client.DateTimeFormat;
@@ -64,8 +60,7 @@ import com.vaadin.shared.ui.datefield.Resolution;
*
*/
public class VPopupCalendar extends VTextualDate implements Field,
- ClickHandler, MouseOverHandler, MouseOutHandler,
- CloseHandler<PopupPanel>, SubPartAware {
+ ClickHandler, CloseHandler<PopupPanel>, SubPartAware {
/** For internal use only. May be removed or replaced in the future. */
public final Button calendarToggle = new Button();
@@ -80,20 +75,6 @@ public class VPopupCalendar extends VTextualDate implements Field,
public boolean parsable = true;
private boolean open = false;
- /*
- * To resolve #14857. If to click on calendarToggle button when calendar
- * popup is opened (*1) then we have the following chain of calls:
- *
- * 1) onClose() 2) onClick()
- *
- * In this case we should prevent calling openCalendarPanel() in onClick.
- */
- private boolean preventOpenPopupCalendar = false;
- /*
- * To resolve #14857. To determine this situation (*1) we use onMouseOver
- * and OnMouseOut (for calendarToggle button).
- */
- private boolean cursorOverCalendarToggleButton = false;
private boolean textFieldEnabled = true;
@@ -108,10 +89,6 @@ public class VPopupCalendar extends VTextualDate implements Field,
calendarToggle.setText("");
calendarToggle.addClickHandler(this);
-
- calendarToggle.addMouseOverHandler(this);
- calendarToggle.addMouseOutHandler(this);
-
// -2 instead of -1 to avoid FocusWidget.onAttach to reset it
calendarToggle.getElement().setTabIndex(-2);
@@ -464,10 +441,7 @@ public class VPopupCalendar extends VTextualDate implements Field,
@Override
public void onClick(ClickEvent event) {
if (event.getSource() == calendarToggle && isEnabled()) {
- if (!preventOpenPopupCalendar) {
- openCalendarPanel();
- }
- preventOpenPopupCalendar = false;
+ openCalendarPanel();
}
}
@@ -490,22 +464,15 @@ public class VPopupCalendar extends VTextualDate implements Field,
focus();
}
- open = false;
-
- if (cursorOverCalendarToggleButton) {
- preventOpenPopupCalendar = true;
-
- // To resolve the problem: onMouseOut event not triggered when
- // moving mouse fast (GWT - all browsers)
- Timer unPreventClickTimer = new Timer() {
- @Override
- public void run() {
- preventOpenPopupCalendar = false;
- }
- };
-
- unPreventClickTimer.schedule(300);
- }
+ // TODO resolve what the "Sigh." is all about and document it here
+ // Sigh.
+ Timer t = new Timer() {
+ @Override
+ public void run() {
+ open = false;
+ }
+ };
+ t.schedule(100);
}
}
@@ -675,28 +642,4 @@ public class VPopupCalendar extends VTextualDate implements Field,
calendar.setRangeEnd(rangeEnd);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * com.google.gwt.event.dom.client.MouseOverHandler#onMouseOver(com.google
- * .gwt.event.dom.client.MouseOverEvent)
- */
- @Override
- public void onMouseOver(MouseOverEvent event) {
- cursorOverCalendarToggleButton = true;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * com.google.gwt.event.dom.client.MouseOutHandler#onMouseOut(com.google
- * .gwt.event.dom.client.MouseOutEvent)
- */
- @Override
- public void onMouseOut(MouseOutEvent event) {
- cursorOverCalendarToggleButton = false;
- }
-
}
diff --git a/client/src/com/vaadin/client/ui/VScrollTable.java b/client/src/com/vaadin/client/ui/VScrollTable.java
index b07d2dc9c0..14e4c658ad 100644
--- a/client/src/com/vaadin/client/ui/VScrollTable.java
+++ b/client/src/com/vaadin/client/ui/VScrollTable.java
@@ -3636,7 +3636,6 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
c.setWidth(widthWithoutAddedIndent, true);
}
} else if (col.hasAttribute("er")) {
- c.setUndefinedWidth();
c.setExpandRatio(col.getFloatAttribute("er"));
} else if (recalcWidths) {
@@ -5393,6 +5392,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
private Map<TableCellElement, TooltipInfo> cellToolTips = new HashMap<TableCellElement, TooltipInfo>();
private boolean isDragging = false;
private String rowStyle = null;
+ protected boolean applyZeroWidthFix = true;
private VScrollTableRow(int rowKey) {
this.rowKey = rowKey;
@@ -5498,7 +5498,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
* definition of zero width table cells. Instead, use 1px
* and compensate with a negative margin.
*/
- if (width == 0) {
+ if (applyZeroWidthFix && width == 0) {
wrapperWidth = 1;
wrapperStyle.setMarginRight(-1, Unit.PX);
} else {
diff --git a/client/src/com/vaadin/client/ui/VTreeTable.java b/client/src/com/vaadin/client/ui/VTreeTable.java
index 9b7e9702b2..9e5940a2f2 100644
--- a/client/src/com/vaadin/client/ui/VTreeTable.java
+++ b/client/src/com/vaadin/client/ui/VTreeTable.java
@@ -155,6 +155,8 @@ public class VTreeTable extends VScrollTable {
public VTreeTableRow(UIDL uidl, char[] aligns2) {
super(uidl, aligns2);
+ // this fix causes #15118 and doesn't work for treetable anyway
+ applyZeroWidthFix = false;
}
@Override