summaryrefslogtreecommitdiffstats
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
parentfbfca1e9fc7a77e02c4262f0dfbe7ff408633499 (diff)
parenta0f4c3dfb37b1e742b74a78d8133b1bb4a399052 (diff)
downloadvaadin-framework-4e1b181a699efcd083b14270145bd2e540a2f772.tar.gz
vaadin-framework-4e1b181a699efcd083b14270145bd2e540a2f772.zip
Merge remote-tracking branch 'origin/master' into grid
Change-Id: I1983d8a8c86caf75c4f5d32ee9367bbd6d58057c
-rw-r--r--WebContent/VAADIN/themes/tests-valo-disabled-animations/_variables.scss3
-rw-r--r--WebContent/VAADIN/themes/tests-valo-disabled-animations/styles.scss6
-rw-r--r--WebContent/VAADIN/themes/tests-valo-textfield-bevel/_variables.scss3
-rw-r--r--WebContent/VAADIN/themes/tests-valo-textfield-bevel/styles.scss6
-rw-r--r--WebContent/VAADIN/themes/valo/components/_table.scss61
-rw-r--r--WebContent/VAADIN/themes/valo/components/_textfield.scss2
-rw-r--r--WebContent/VAADIN/themes/valo/components/_valo-menu.scss3
-rw-r--r--WebContent/VAADIN/themes/valo/components/_window.scss11
-rw-r--r--build.properties2
-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
-rw-r--r--gwt-files.xml11
-rw-r--r--server/src/com/vaadin/data/util/sqlcontainer/ReadOnlyRowId.java11
-rw-r--r--server/src/com/vaadin/data/util/sqlcontainer/RowId.java46
-rw-r--r--server/src/com/vaadin/data/util/sqlcontainer/TemporaryRowId.java2
-rw-r--r--server/src/com/vaadin/server/AbstractExtension.java20
-rw-r--r--server/src/com/vaadin/server/AbstractJavaScriptExtension.java21
-rw-r--r--server/src/com/vaadin/server/communication/UIInitHandler.java8
-rw-r--r--server/src/com/vaadin/ui/AbstractSplitPanel.java14
-rw-r--r--server/tests/src/com/vaadin/data/util/sqlcontainer/ReadOnlyRowIdTest.java8
-rw-r--r--server/tests/src/com/vaadin/data/util/sqlcontainer/RowIdTest.java7
-rw-r--r--uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java24
-rw-r--r--uitest/src/com/vaadin/tests/components/TooltipPosition.java70
-rw-r--r--uitest/src/com/vaadin/tests/components/TooltipPositionTest.java173
-rw-r--r--uitest/src/com/vaadin/tests/components/datefield/DateFieldPopupClosingTest.java42
-rw-r--r--uitest/src/com/vaadin/tests/components/menubar/MenuTooltipTest.java1
-rw-r--r--uitest/src/com/vaadin/tests/components/table/SetCurrentPageFirstItemIndex.html43
-rw-r--r--uitest/src/com/vaadin/tests/components/table/SetCurrentPageFirstItemIndexTest.java63
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableDropIndicatorValo.java53
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableDropIndicatorValoTest.java81
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableExpandRatio.java110
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableExpandRatioTest.java88
-rw-r--r--uitest/src/com/vaadin/tests/components/treetable/MinimalWidthColumns.java44
-rw-r--r--uitest/src/com/vaadin/tests/components/treetable/MinimalWidthColumnsTest.java31
-rw-r--r--uitest/src/com/vaadin/tests/performance/BasicPerformanceTest.java25
-rw-r--r--uitest/src/com/vaadin/tests/tb3/AffectedTB3TestLocator.java21
-rw-r--r--uitest/src/com/vaadin/tests/tb3/ChangedTB3TestLocator.java18
-rw-r--r--uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java19
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/ModalWindowTest.java34
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/TextFieldBevel.java (renamed from uitest/src/com/vaadin/tests/components/datefield/DateFieldPopupClosing.java)33
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/TextFieldBevelTest.java69
-rw-r--r--uitest/tb3test.xml6
45 files changed, 953 insertions, 528 deletions
diff --git a/WebContent/VAADIN/themes/tests-valo-disabled-animations/_variables.scss b/WebContent/VAADIN/themes/tests-valo-disabled-animations/_variables.scss
new file mode 100644
index 0000000000..d2411c675c
--- /dev/null
+++ b/WebContent/VAADIN/themes/tests-valo-disabled-animations/_variables.scss
@@ -0,0 +1,3 @@
+$v-animations-enabled: false;
+
+@import "../valo/valo";
diff --git a/WebContent/VAADIN/themes/tests-valo-disabled-animations/styles.scss b/WebContent/VAADIN/themes/tests-valo-disabled-animations/styles.scss
new file mode 100644
index 0000000000..b941c1b3d1
--- /dev/null
+++ b/WebContent/VAADIN/themes/tests-valo-disabled-animations/styles.scss
@@ -0,0 +1,6 @@
+@import "variables";
+@import "../tests-valo/valotest";
+
+.tests-valo-disabled-animations {
+ @include valotest;
+}
diff --git a/WebContent/VAADIN/themes/tests-valo-textfield-bevel/_variables.scss b/WebContent/VAADIN/themes/tests-valo-textfield-bevel/_variables.scss
new file mode 100644
index 0000000000..b1b215a40c
--- /dev/null
+++ b/WebContent/VAADIN/themes/tests-valo-textfield-bevel/_variables.scss
@@ -0,0 +1,3 @@
+$v-bevel: false;
+
+@import "../valo/valo";
diff --git a/WebContent/VAADIN/themes/tests-valo-textfield-bevel/styles.scss b/WebContent/VAADIN/themes/tests-valo-textfield-bevel/styles.scss
new file mode 100644
index 0000000000..96a3ca63b6
--- /dev/null
+++ b/WebContent/VAADIN/themes/tests-valo-textfield-bevel/styles.scss
@@ -0,0 +1,6 @@
+@import "variables";
+@import "../tests-valo/valotest";
+
+.tests-valo-textfield-bevel {
+ @include valotest;
+}
diff --git a/WebContent/VAADIN/themes/valo/components/_table.scss b/WebContent/VAADIN/themes/valo/components/_table.scss
index a70532ccfd..019d8673ce 100644
--- a/WebContent/VAADIN/themes/valo/components/_table.scss
+++ b/WebContent/VAADIN/themes/valo/components/_table.scss
@@ -238,6 +238,7 @@ $v-table-background-color: null !default;
border-left: $v-table-border-width solid $border-color;
overflow: hidden;
height: $v-table-row-height;
+ vertical-align: middle;
&:first-child {
border-left: none;
@@ -520,46 +521,28 @@ $v-table-background-color: null !default;
}
}
- .#{$primary-stylename}-row-drag-middle td:first-child:before {
- content: "";
- display: block;
- position: absolute;
- z-index: 1;
- height: $v-table-row-height + $v-table-border-width;
- left: 0;
- right: 0;
- background: $v-focus-color;
- @include opacity(.2);
+ .#{$primary-stylename}-row-drag-middle .#{$primary-stylename}-cell-content {
+ $bg: mix($v-focus-color, $background-color, 20%);
+ background-color: $bg;
+ color: valo-font-color($bg);
}
- .#{$primary-stylename}-row-drag-top td:first-child:before,
- .#{$primary-stylename}-row-drag-bottom td:first-child:after {
- content: "\2022";
- display: block;
- position: absolute;
- height: 2px;
- left: 0;
- right: 0;
- background: $v-focus-color;
- font-size: $v-font-size * 2;
- line-height: 2px;
- color: $v-focus-color;
- text-indent: round($v-font-size/-4);
- text-shadow: 0 0 1px $background-color, 0 0 1px $background-color;
+ .#{$primary-stylename}-row-drag-bottom td.#{$primary-stylename}-cell-content {
+ border-bottom: 2px solid $v-focus-color;
+ height: $v-table-row-height - 2px;
}
- .#{$primary-stylename}-row-drag-top td:first-child:before {
- margin-top: -$v-table-border-width;
+ .#{$primary-stylename}-row-drag-bottom .#{$primary-stylename}-cell-wrapper {
+ margin-bottom: -2px;
}
- .v-ff & .#{$primary-stylename}-row-drag-top td:first-child:before,
- .v-ff & .#{$primary-stylename}-row-drag-bottom td:first-child:after {
- line-height: 1px;
+ .#{$primary-stylename}-row-drag-top td.#{$primary-stylename}-cell-content {
+ border-top: 2px solid $v-focus-color;
+ height: $v-table-row-height - 2px + $v-table-border-width;
}
- .v-ie & .#{$primary-stylename}-row-drag-top td:first-child:before,
- .v-ie & .#{$primary-stylename}-row-drag-bottom td:first-child:after {
- line-height: 0;
+ .#{$primary-stylename}-row-drag-top .#{$primary-stylename}-cell-wrapper {
+ margin-top: -1px;
}
@@ -700,6 +683,11 @@ $v-table-background-color: null !default;
border-top: none;
border-bottom: none;
}
+
+ .#{$primary-stylename}-row-drag-top .#{$primary-stylename}-cell-content,
+ .#{$primary-stylename}-row-drag-bottom .#{$primary-stylename}-cell-content {
+ height: $v-table-row-height - 1px;
+ }
}
@@ -814,10 +802,6 @@ $v-table-background-color: null !default;
margin-top: round($row-height/-2);
}
- .#{$primary-stylename}-row-drag-middle td:first-child:before {
- height: $row-height + $v-table-border-width;
- }
-
&.v-treetable {
.#{$primary-stylename}-cell-wrapper {
padding-left: 0;
@@ -839,4 +823,9 @@ $v-table-background-color: null !default;
padding-right: $cell-padding-horizontal;
}
}
+
+ .#{$primary-stylename}-row-drag-top .#{$primary-stylename}-cell-content,
+ .#{$primary-stylename}-row-drag-bottom .#{$primary-stylename}-cell-content {
+ height: $row-height - 1px;
+ }
}
diff --git a/WebContent/VAADIN/themes/valo/components/_textfield.scss b/WebContent/VAADIN/themes/valo/components/_textfield.scss
index 58f69e5e4c..50cb7b8042 100644
--- a/WebContent/VAADIN/themes/valo/components/_textfield.scss
+++ b/WebContent/VAADIN/themes/valo/components/_textfield.scss
@@ -14,7 +14,7 @@ $v-textfield-background-color--readonly: darkest-color($v-app-background-color,
* The bevel style for text fields. See the documentation for $v-bevel.
* @group textfield
*/
-$v-textfield-bevel: inset 0 1px 0 v-shade !default;
+$v-textfield-bevel: if($v-bevel and ($v-bevel != none), inset 0 1px 0 v-shade, $v-bevel) !default;
/**
* The shadow style for text fields. See the documentation for $v-shadow.
diff --git a/WebContent/VAADIN/themes/valo/components/_valo-menu.scss b/WebContent/VAADIN/themes/valo/components/_valo-menu.scss
index 071aceb971..5ed125b909 100644
--- a/WebContent/VAADIN/themes/valo/components/_valo-menu.scss
+++ b/WebContent/VAADIN/themes/valo/components/_valo-menu.scss
@@ -193,6 +193,7 @@ $valo-menu-background-color: scale-color($v-app-background-color, $lightness: if
height: $v-unit-size !important;
padding-top: 0;
padding-bottom: 0;
+ -webkit-backface-visibility: hidden;
}
.valo-menu .v-menubar-user-menu {
@@ -205,6 +206,7 @@ $valo-menu-background-color: scale-color($v-app-background-color, $lightness: if
height: $v-unit-size;
color: valo-font-color($v-selection-color, 0.5);
max-width: 30%;
+ -webkit-backface-visibility: hidden;
.v-menubar-menuitem {
line-height: $v-unit-size - 1px;
@@ -328,6 +330,7 @@ $valo-menu-background-color: scale-color($v-app-background-color, $lightness: if
padding: 0 round($v-unit-size) 0 round($v-unit-size/2);
cursor: pointer;
position: relative;
+ overflow: hidden;
text-shadow: valo-text-shadow($font-color: $font-color, $background-color: $bg, $offset: 2px);
@include transition(background-color 300ms, color 60ms);
diff --git a/WebContent/VAADIN/themes/valo/components/_window.scss b/WebContent/VAADIN/themes/valo/components/_window.scss
index ce7a530c98..23fa5338c2 100644
--- a/WebContent/VAADIN/themes/valo/components/_window.scss
+++ b/WebContent/VAADIN/themes/valo/components/_window.scss
@@ -89,11 +89,12 @@ $v-window-modality-curtain-background-color: #222 !default;
left: 0;
@include radial-gradient(circle at 50% 50%, $v-window-modality-curtain-background-color, darken($v-window-modality-curtain-background-color, valo-gradient-opacity()), $fallback: $v-window-modality-curtain-background-color);
@include opacity(max(0.2, 0.8 - valo-gradient-opacity()/100%));
- @include valo-animate-in-fade($duration: 400ms, $delay: 100ms);
-
- .v-op12 & {
- // Opera 12 has a shitbreak with the fade-in (flickers)
- @include animation(none);
+ @if $v-animations-enabled {
+ @include valo-animate-in-fade($duration: 400ms, $delay: 100ms);
+ .v-op12 & {
+ // Opera 12 has a shitbreak with the fade-in (flickers)
+ @include animation(none);
+ }
}
}
diff --git a/build.properties b/build.properties
index 9df1c8d767..286713b616 100644
--- a/build.properties
+++ b/build.properties
@@ -6,5 +6,5 @@ vaadin.url=http://vaadin.com
vaadin.java.version=1.6
vaadin.version=0.0.0.unversioned-development-build
vaadin.sass.version=0.9.10
-gwt.version=2.7.0.beta1vaadin1
+gwt.version=2.7.0.vaadin1
commons-io.version=2.4
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
diff --git a/gwt-files.xml b/gwt-files.xml
index c0ef583177..26126a7ffb 100644
--- a/gwt-files.xml
+++ b/gwt-files.xml
@@ -7,44 +7,37 @@
<ivy:cachepath pathid="gwt-dev.classpath" conf="gwt-dev" />
<ivy:cachepath pathid="gwt-user.classpath" conf="gwt-user" />
<ivy:cachepath pathid="gwt-elemental.classpath" conf="gwt-elemental" />
- <ivy:cachepath pathid="gwt-codeserver.classpath" conf="gwt-codeserver" />
<property name="gwt.eclipse.basedir" location="${gwt.basedir}/eclipse" />
<property name="gwt.user.jar" refid="gwt-user.classpath" />
<property name="gwt.dev.jar" refid="gwt-dev.classpath" />
<property name="gwt.elemental.jar" refid="gwt-elemental.classpath" />
- <property name="gwt.codeserver.jar" refid="gwt-codeserver.classpath" />
<available file="${gwt.dev.jar}" property="gwt.dev.jar.found" />
<available file="${gwt.user.jar}" property="gwt.user.jar.found" />
<available file="${gwt.elemental.jar}" property="gwt.elemental.jar.found" />
- <available file="${gwt.codeserver.jar}" property="gwt.codeserver.jar.found" />
<property name="gwt.unpack.dir" location="${vaadin.basedir}/build/gwt" />
<property name="gwt.user.jar.files" location="${gwt.unpack.dir}/gwt-user.jar" />
<property name="gwt.dev.jar.files" location="${gwt.unpack.dir}/gwt-dev.jar" />
<property name="gwt.elemental.jar.files" location="${gwt.unpack.dir}/gwt-elemental.jar" />
- <property name="gwt.codeserver.jar.files" location="${gwt.unpack.dir}/gwt-codeserver.jar" />
<target name="unpack.gwt">
<fail unless="gwt.dev.jar.found" message="Could not find gwt-dev.jar at ${gwt.dev.jar}" />
<fail unless="gwt.user.jar.found" message="Could not find gwt-user.jar at ${gwt.user.jar}" />
<fail unless="gwt.elemental.jar.found" message="Could not find gwt-elemental.jar at ${gwt.elemental.jar}" />
- <fail unless="gwt.codeserver.jar.found" message="Could not find gwt-codeserver.jar at ${gwt.codeserver.jar}" />
<delete dir="${gwt.unpack.dir}" />
<mkdir dir="${gwt.user.jar.files}" />
<mkdir dir="${gwt.dev.jar.files}" />
<mkdir dir="${gwt.elemental.jar.files}" />
- <mkdir dir="${gwt.codeserver.jar.files}" />
<unzip dest="${gwt.user.jar.files}" src="${gwt.user.jar}" />
<unzip dest="${gwt.dev.jar.files}" src="${gwt.dev.jar}" />
<unzip dest="${gwt.elemental.jar.files}" src="${gwt.elemental.jar}" />
- <unzip dest="${gwt.codeserver.jar.files}" src="${gwt.codeserver.jar}" />
</target>
<union id="client-compiler.gwt.includes">
@@ -124,10 +117,6 @@
</fileset>
- <!-- GWT SuperDevMode -->
- <fileset dir="${gwt.codeserver.jar.files}">
- <exclude name="META-INF/**" />
- </fileset>
</union>
<union id="client-compiled-cache.gwt.includes">
diff --git a/server/src/com/vaadin/data/util/sqlcontainer/ReadOnlyRowId.java b/server/src/com/vaadin/data/util/sqlcontainer/ReadOnlyRowId.java
index dcad8f7c5d..c845cadc7a 100644
--- a/server/src/com/vaadin/data/util/sqlcontainer/ReadOnlyRowId.java
+++ b/server/src/com/vaadin/data/util/sqlcontainer/ReadOnlyRowId.java
@@ -26,18 +26,23 @@ public class ReadOnlyRowId extends RowId {
@Override
public int hashCode() {
- return rowNum.hashCode();
+ return getRowNum();
}
@Override
public boolean equals(Object obj) {
- if (obj == null || !(obj instanceof ReadOnlyRowId)) {
+ if (obj == null || !(ReadOnlyRowId.class.equals(obj.getClass()))) {
return false;
}
- return rowNum.equals(((ReadOnlyRowId) obj).rowNum);
+ return getRowNum() == (((ReadOnlyRowId) obj).getRowNum());
}
public int getRowNum() {
return rowNum;
}
+
+ @Override
+ public String toString() {
+ return String.valueOf(getRowNum());
+ }
}
diff --git a/server/src/com/vaadin/data/util/sqlcontainer/RowId.java b/server/src/com/vaadin/data/util/sqlcontainer/RowId.java
index 8674b9dca0..79c16b0f60 100644
--- a/server/src/com/vaadin/data/util/sqlcontainer/RowId.java
+++ b/server/src/com/vaadin/data/util/sqlcontainer/RowId.java
@@ -16,6 +16,7 @@
package com.vaadin.data.util.sqlcontainer;
import java.io.Serializable;
+import java.util.Arrays;
/**
* RowId represents identifiers of a single database result set row.
@@ -47,47 +48,30 @@ public class RowId implements Serializable {
@Override
public int hashCode() {
- int result = 31;
- if (id != null) {
- for (Object o : id) {
- if (o != null) {
- result += o.hashCode();
- }
- }
- }
- return result;
+ return Arrays.hashCode(getId());
}
@Override
public boolean equals(Object obj) {
- if (obj == null || !(obj instanceof RowId)) {
- return false;
- }
- Object[] compId = ((RowId) obj).getId();
- if (id == null && compId == null) {
- return true;
- }
- if (id.length != compId.length) {
+ if (obj == null || !(RowId.class.equals(obj.getClass()))) {
return false;
}
- for (int i = 0; i < id.length; i++) {
- if ((id[i] == null && compId[i] != null)
- || (id[i] != null && !id[i].equals(compId[i]))) {
- return false;
- }
- }
- return true;
+ return Arrays.equals(getId(), ((RowId) obj).getId());
}
@Override
public String toString() {
- StringBuffer s = new StringBuffer();
- for (int i = 0; i < id.length; i++) {
- s.append(id[i]);
- if (i < id.length - 1) {
- s.append("/");
- }
+ if (getId() == null) {
+ return "";
+ }
+ StringBuilder builder = new StringBuilder();
+ for (Object id : getId()) {
+ builder.append(id);
+ builder.append('/');
+ }
+ if (builder.length() > 0) {
+ return builder.substring(0, builder.length() - 1);
}
- return s.toString();
+ return builder.toString();
}
}
diff --git a/server/src/com/vaadin/data/util/sqlcontainer/TemporaryRowId.java b/server/src/com/vaadin/data/util/sqlcontainer/TemporaryRowId.java
index 6c1e07756f..ca2f25963e 100644
--- a/server/src/com/vaadin/data/util/sqlcontainer/TemporaryRowId.java
+++ b/server/src/com/vaadin/data/util/sqlcontainer/TemporaryRowId.java
@@ -29,7 +29,7 @@ public class TemporaryRowId extends RowId {
@Override
public boolean equals(Object obj) {
- if (obj == null || !(obj instanceof TemporaryRowId)) {
+ if (obj == null || !(TemporaryRowId.class.equals(obj.getClass()))) {
return false;
}
Object[] compId = ((TemporaryRowId) obj).getId();
diff --git a/server/src/com/vaadin/server/AbstractExtension.java b/server/src/com/vaadin/server/AbstractExtension.java
index 7148e6e84c..6395daebd1 100644
--- a/server/src/com/vaadin/server/AbstractExtension.java
+++ b/server/src/com/vaadin/server/AbstractExtension.java
@@ -36,6 +36,26 @@ public abstract class AbstractExtension extends AbstractClientConnector
private ClientConnector parent;
/**
+ * Creates a new extension instance without extending any connector.
+ */
+ public AbstractExtension() {
+ // Empty default constructor
+ }
+
+ /**
+ * Creates a new extension instance that extends the provided connector.
+ *
+ * @since
+ *
+ * @param target
+ * the connector to extend
+ */
+ public AbstractExtension(AbstractClientConnector target) {
+ this();
+ extend(target);
+ }
+
+ /**
* Gets a type that the parent must be an instance of. Override this if the
* extension only support certain targets, e.g. if only TextFields can be
* extended.
diff --git a/server/src/com/vaadin/server/AbstractJavaScriptExtension.java b/server/src/com/vaadin/server/AbstractJavaScriptExtension.java
index 410eea3c01..2f2752c317 100644
--- a/server/src/com/vaadin/server/AbstractJavaScriptExtension.java
+++ b/server/src/com/vaadin/server/AbstractJavaScriptExtension.java
@@ -127,6 +127,27 @@ public abstract class AbstractJavaScriptExtension extends AbstractExtension {
private JavaScriptCallbackHelper callbackHelper = new JavaScriptCallbackHelper(
this);
+ /**
+ * Creates a new JavasScript extension instance without extending any
+ * connector.
+ */
+ public AbstractJavaScriptExtension() {
+ // Empty default constructor
+ }
+
+ /**
+ * Creates a new JavaScript extension extending the provided connector.
+ *
+ * @since
+ *
+ * @param target
+ * the connector to extend
+ */
+ public AbstractJavaScriptExtension(AbstractClientConnector target) {
+ this();
+ extend(target);
+ }
+
@Override
protected <T extends ServerRpc> void registerRpc(T implementation,
Class<T> rpcInterfaceType) {
diff --git a/server/src/com/vaadin/server/communication/UIInitHandler.java b/server/src/com/vaadin/server/communication/UIInitHandler.java
index 356ad25219..8e61370d85 100644
--- a/server/src/com/vaadin/server/communication/UIInitHandler.java
+++ b/server/src/com/vaadin/server/communication/UIInitHandler.java
@@ -65,8 +65,6 @@ public abstract class UIInitHandler extends SynchronizedRequestHandler {
@Override
public boolean synchronizedHandleRequest(VaadinSession session,
VaadinRequest request, VaadinResponse response) throws IOException {
- StringWriter stringWriter = new StringWriter();
-
try {
assert UI.getCurrent() == null;
@@ -82,14 +80,10 @@ public abstract class UIInitHandler extends SynchronizedRequestHandler {
String initialUIDL = getInitialUidl(request, uI);
params.put("uidl", initialUIDL);
- stringWriter.write(JsonUtil.stringify(params));
+ return commitJsonResponse(request, response, JsonUtil.stringify(params));
} catch (JsonException e) {
throw new IOException("Error producing initial UIDL", e);
- } finally {
- stringWriter.close();
}
-
- return commitJsonResponse(request, response, stringWriter.toString());
}
/**
diff --git a/server/src/com/vaadin/ui/AbstractSplitPanel.java b/server/src/com/vaadin/ui/AbstractSplitPanel.java
index 09f881cf46..e9b37f8cff 100644
--- a/server/src/com/vaadin/ui/AbstractSplitPanel.java
+++ b/server/src/com/vaadin/ui/AbstractSplitPanel.java
@@ -342,12 +342,26 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer {
* Returns the unit of position of the splitter
*
* @return unit of position of the splitter
+ * @see #setSplitPosition(float, Unit)
*/
public Unit getSplitPositionUnit() {
return posUnit;
}
/**
+ * Is the split position reversed. By default the split position is measured
+ * by the first region, but if split position is reversed the measuring is
+ * done by the second region instead.
+ *
+ * @since
+ * @return {@code true} if reversed, {@code false} otherwise.
+ * @see #setSplitPosition(float, boolean)
+ */
+ public boolean isSplitPositionReversed() {
+ return getSplitterState(false).positionReversed;
+ }
+
+ /**
* Sets the minimum split position to the given position and unit. If the
* split position is reversed, maximum and minimum are also reversed.
*
diff --git a/server/tests/src/com/vaadin/data/util/sqlcontainer/ReadOnlyRowIdTest.java b/server/tests/src/com/vaadin/data/util/sqlcontainer/ReadOnlyRowIdTest.java
index 248dc62d93..29968ecf94 100644
--- a/server/tests/src/com/vaadin/data/util/sqlcontainer/ReadOnlyRowIdTest.java
+++ b/server/tests/src/com/vaadin/data/util/sqlcontainer/ReadOnlyRowIdTest.java
@@ -44,4 +44,12 @@ public class ReadOnlyRowIdTest {
ReadOnlyRowId rid2 = new ReadOnlyRowId(42);
Assert.assertFalse(rid.equals(rid2));
}
+
+ @Test
+ public void toString_rowNumberIsReturned() {
+ int i = 1;
+ ReadOnlyRowId rowId = new ReadOnlyRowId(i);
+ Assert.assertEquals("Unexpected toString value", String.valueOf(i),
+ rowId.toString());
+ }
}
diff --git a/server/tests/src/com/vaadin/data/util/sqlcontainer/RowIdTest.java b/server/tests/src/com/vaadin/data/util/sqlcontainer/RowIdTest.java
index e4ee28ba9e..73f7be9fb2 100644
--- a/server/tests/src/com/vaadin/data/util/sqlcontainer/RowIdTest.java
+++ b/server/tests/src/com/vaadin/data/util/sqlcontainer/RowIdTest.java
@@ -50,4 +50,11 @@ public class RowIdTest {
Assert.assertFalse(id.equals("Tudiluu"));
Assert.assertFalse(id.equals(new Integer(1337)));
}
+
+ @Test
+ public void toString_defaultCtor_noException() {
+ RowId rowId = new RowId();
+ Assert.assertTrue("Unexpected to string for empty Row Id", rowId
+ .toString().isEmpty());
+ }
}
diff --git a/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java b/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java
index 22b075b890..f00a05e810 100644
--- a/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java
+++ b/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java
@@ -257,6 +257,7 @@ public class DevelopmentServerLauncher {
webappcontext.stop();
server.stop();
webappcontext.start();
+ disableAtmosphereAnnotationScan(webappcontext);
server.start();
}
});
@@ -277,15 +278,7 @@ public class DevelopmentServerLauncher {
// Read web.xml to find all configured servlets
webappcontext.start();
- // Reconfigure all servlets to avoid startup delay
- for (ServletHolder servletHolder : webappcontext.getServletHandler()
- .getServlets()) {
- if (servletHolder
- .getInitParameter("org.atmosphere.cpr.scanClassPath") == null) {
- servletHolder.setInitParameter(
- "org.atmosphere.cpr.scanClassPath", "false");
- }
- }
+ disableAtmosphereAnnotationScan(webappcontext);
try {
server.start();
@@ -358,6 +351,19 @@ public class DevelopmentServerLauncher {
return "http://localhost:" + port + serverArgs.get("context");
}
+ private static void disableAtmosphereAnnotationScan(
+ WebAppContext webappcontext) {
+ // Reconfigure all servlets to avoid startup delay
+ for (ServletHolder servletHolder : webappcontext.getServletHandler()
+ .getServlets()) {
+ if (servletHolder
+ .getInitParameter("org.atmosphere.cpr.scanClassPath") == null) {
+ servletHolder.setInitParameter(
+ "org.atmosphere.cpr.scanClassPath", "false");
+ }
+ }
+ }
+
/**
* Assign default value for given key.
*
diff --git a/uitest/src/com/vaadin/tests/components/TooltipPosition.java b/uitest/src/com/vaadin/tests/components/TooltipPosition.java
new file mode 100644
index 0000000000..30222722d9
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/TooltipPosition.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalLayout;
+
+/**
+ * This UI is used for testing that a tooltip is not positioned partially
+ * outside the browser window when there is enough space to display it.
+ *
+ * @author Vaadin Ltd
+ */
+public class TooltipPosition extends AbstractTestUI {
+
+ public static final int NUMBER_OF_BUTTONS = 5;
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ // These tooltip delay settings can be removed once #13854 is resolved.
+ getTooltipConfiguration().setOpenDelay(0);
+ getTooltipConfiguration().setQuickOpenDelay(0);
+ getTooltipConfiguration().setCloseTimeout(1000);
+
+ VerticalLayout layout = new VerticalLayout();
+ layout.setSpacing(true);
+ layout.setHeight(UI.getCurrent().getPage().getBrowserWindowHeight(),
+ Unit.PIXELS);
+ addComponent(layout);
+ for (int i = 0; i < NUMBER_OF_BUTTONS; i++) {
+ Button button = new Button("Button");
+ button.setDescription(generateTooltipText());
+ layout.addComponent(button);
+ }
+ }
+
+ private String generateTooltipText() {
+ StringBuilder result = new StringBuilder();
+ for (int i = 0; i < 50; i++) {
+ result.append("This is the line ").append(i)
+ .append(" of the long tooltip text.<br>");
+ }
+ return result.toString();
+ }
+
+ @Override
+ public String getTestDescription() {
+ return "The tooltips of the buttons should not be clipped when there is enough space to display them.";
+ }
+
+ @Override
+ public Integer getTicketNumber() {
+ return 15129;
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/TooltipPositionTest.java b/uitest/src/com/vaadin/tests/components/TooltipPositionTest.java
new file mode 100644
index 0000000000..4106374d64
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/TooltipPositionTest.java
@@ -0,0 +1,173 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components;
+
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.Dimension;
+import org.openqa.selenium.Point;
+import org.openqa.selenium.StaleElementReferenceException;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebDriver.Window;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+import org.openqa.selenium.support.ui.ExpectedCondition;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Tests that the tooltip is positioned so that it fits in the displayed area.
+ *
+ * @author Vaadin Ltd
+ */
+public class TooltipPositionTest extends MultiBrowserTest {
+
+ @Test
+ public void testRegression_EmptyTooltipShouldNotBeAppearedDuringInitialization()
+ throws Exception {
+ openTestURL();
+
+ waitForElementVisible(By.cssSelector(".v-tooltip"));
+ WebElement tooltip = driver.findElement(By.cssSelector(".v-tooltip"));
+
+ Assert.assertTrue(
+ "This init tooltip with text ' ' is present in the DOM and should be entirely outside the browser window",
+ isOutsideOfWindow(tooltip));
+ }
+
+ @Test
+ public void testTooltipPosition() throws Exception {
+ openTestURL();
+ for (int i = 0; i < TooltipPosition.NUMBER_OF_BUTTONS; i++) {
+ ButtonElement button = $(ButtonElement.class).get(i);
+ // Move the mouse to display the tooltip.
+ Actions actions = new Actions(driver);
+ actions.moveToElement(button, 10, 10);
+ actions.build().perform();
+ waitUntil(tooltipToBeInsideWindow(By.cssSelector(".v-tooltip"),
+ driver.manage().window()));
+
+ if (i < TooltipPosition.NUMBER_OF_BUTTONS - 1) {
+ // Remove the tooltip by moving the mouse.
+ actions = new Actions(driver);
+ actions.moveByOffset(300, 0);
+ actions.build().perform();
+ waitUntil(tooltipNotToBeShown(By.cssSelector(".v-tooltip"),
+ driver.manage().window()));
+ }
+ }
+ }
+
+ /*
+ * An expectation for checking that the tooltip found by the given locator
+ * is present in the DOM and entirely inside the browser window. The
+ * coordinate of the top left corner of the window is supposed to be (0, 0).
+ */
+ private ExpectedCondition<Boolean> tooltipToBeInsideWindow(
+ final By tooltipLocator, final Window window) {
+ return new ExpectedCondition<Boolean>() {
+
+ @Override
+ public Boolean apply(WebDriver input) {
+ List<WebElement> elements = findElements(tooltipLocator);
+ if (elements.isEmpty()) {
+ return false;
+ }
+ WebElement element = elements.get(0);
+ try {
+ if (!element.isDisplayed()) {
+ return false;
+ }
+ Point topLeft = element.getLocation();
+ int xLeft = topLeft.getX();
+ int yTop = topLeft.getY();
+ if (xLeft < 0 || yTop < 0) {
+ return false;
+ }
+ Dimension elementSize = element.getSize();
+ int xRight = xLeft + elementSize.getWidth() - 1;
+ int yBottom = yTop + elementSize.getHeight() - 1;
+ Dimension browserSize = window.getSize();
+ return xRight < browserSize.getWidth()
+ && yBottom < browserSize.getHeight();
+ } catch (StaleElementReferenceException e) {
+ return false;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "the tooltip to be displayed inside the window";
+ }
+ };
+ };
+
+ /*
+ * An expectation for checking that the tooltip found by the given locator
+ * is not shown in the window, even partially. The top left corner of window
+ * should have coordinates (0, 0).
+ */
+ private ExpectedCondition<Boolean> tooltipNotToBeShown(
+ final By tooltipLocator, final Window window) {
+ return new ExpectedCondition<Boolean>() {
+
+ @Override
+ public Boolean apply(WebDriver input) {
+ List<WebElement> elements = findElements(tooltipLocator);
+ if (elements.isEmpty()) {
+ return true;
+ }
+ WebElement tooltip = elements.get(0);
+ try {
+ return isOutsideOfWindow(tooltip);
+ } catch (StaleElementReferenceException e) {
+ return true;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "the tooltip not to be displayed inside the window";
+ }
+
+ };
+ }
+
+ private boolean isOutsideOfWindow(WebElement tooltip) {
+ if (!tooltip.isDisplayed()) {
+ return true;
+ }
+ // The tooltip is shown, at least partially, if
+ // its intervals of both horizontal and vertical coordinates
+ // overlap those of the window.
+ Point topLeft = tooltip.getLocation();
+ Dimension tooltipSize = tooltip.getSize();
+ Dimension windowSize = driver.manage().window().getSize();
+ int xLeft = topLeft.getX();
+ int yTop = topLeft.getY();
+ int xRight = xLeft + tooltipSize.getWidth() - 1;
+ int yBottom = yTop + tooltipSize.getHeight() - 1;
+ boolean overlapHorizontally = !(xRight < 0 || xLeft >= windowSize
+ .getWidth());
+ boolean overlapVertically = !(yBottom < 0 || yTop >= windowSize
+ .getHeight());
+ return !(overlapHorizontally && overlapVertically);
+ }
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldPopupClosingTest.java b/uitest/src/com/vaadin/tests/components/datefield/DateFieldPopupClosingTest.java
deleted file mode 100644
index ecbd6dd667..0000000000
--- a/uitest/src/com/vaadin/tests/components/datefield/DateFieldPopupClosingTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.vaadin.tests.components.datefield;
-
-import java.io.IOException;
-
-import org.junit.Test;
-import org.openqa.selenium.By;
-import org.openqa.selenium.support.ui.ExpectedConditions;
-
-import com.vaadin.testbench.elements.DateFieldElement;
-import com.vaadin.tests.tb3.MultiBrowserTest;
-
-public class DateFieldPopupClosingTest extends MultiBrowserTest {
- /*
- * try to open/close many times (not one time) because this defect is
- * reproduced randomly (depends on timer)
- */
- private static final int N = 100;
-
- @Test
- public void testDateFieldPopupClosing() throws InterruptedException,
- IOException {
- openTestURL();
-
- for (int i = 0; i < N; i++) {
- clickDateDatePickerButton();
-
- waitUntil(ExpectedConditions.visibilityOfElementLocated(By
- .className("v-datefield-popup")));
-
- clickDateDatePickerButton();
-
- waitUntil(ExpectedConditions.invisibilityOfElementLocated(By
- .className("v-datefield-popup")));
- }
- }
-
- private void clickDateDatePickerButton() {
- DateFieldElement dateField = $(DateFieldElement.class).first();
- dateField.findElement(By.tagName("button")).click();
- }
-
-} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/menubar/MenuTooltipTest.java b/uitest/src/com/vaadin/tests/components/menubar/MenuTooltipTest.java
index 24025b9f39..091f7be954 100644
--- a/uitest/src/com/vaadin/tests/components/menubar/MenuTooltipTest.java
+++ b/uitest/src/com/vaadin/tests/components/menubar/MenuTooltipTest.java
@@ -49,6 +49,7 @@ public class MenuTooltipTest extends MultiBrowserTest {
Coordinates elementCoordinates = getCoordinates($(MenuBarElement.class)
.first());
+ sleep(1000);
Mouse mouse = ((HasInputDevices) getDriver()).getMouse();
diff --git a/uitest/src/com/vaadin/tests/components/table/SetCurrentPageFirstItemIndex.html b/uitest/src/com/vaadin/tests/components/table/SetCurrentPageFirstItemIndex.html
deleted file mode 100644
index 904f3b0470..0000000000
--- a/uitest/src/com/vaadin/tests/components/table/SetCurrentPageFirstItemIndex.html
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<link rel="selenium.base" href="http://localhost:8888/" />
-<title>New Test</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">New Test</td></tr>
-</thead><tbody>
-
-<tr>
- <td>open</td>
- <td>run/com.vaadin.tests.components.table.SetCurrentPageFirstItemIndex?restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentstableSetCurrentPageFirstItemIndex::/VVerticalLayout[0]/Slot[1]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentstableSetCurrentPageFirstItemIndex::/VVerticalLayout[0]/Slot[1]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>pause</td>
- <td>500</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentstableSetCurrentPageFirstItemIndex::/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td>
- <td>6</td>
-</tr>
-
-</tbody></table>
-</body>
-</html> \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/table/SetCurrentPageFirstItemIndexTest.java b/uitest/src/com/vaadin/tests/components/table/SetCurrentPageFirstItemIndexTest.java
new file mode 100644
index 0000000000..8102f82834
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/SetCurrentPageFirstItemIndexTest.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.table;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import junit.framework.Assert;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.openqa.selenium.NoSuchElementException;
+
+import com.vaadin.testbench.TestBenchElement;
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.TableElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+@Ignore
+// Enable after #15286 is fixed.
+public class SetCurrentPageFirstItemIndexTest extends MultiBrowserTest {
+
+ @Test
+ public void currentPageIndexChangesTwice() {
+ openTestURL();
+
+ ButtonElement button = $(ButtonElement.class).first();
+ button.click(); // change to 20
+ button.click(); // change to 5
+
+ // When failing, the index stays on 20.
+ assertThatRowIsVisible(5);
+ }
+
+ private void assertThatRowIsVisible(int index) {
+ try {
+ TableElement table = $(TableElement.class).first();
+ TestBenchElement cell = table.getCell(index, 0);
+
+ assertThat(cell.getText(), is(Integer.toString(index + 1)));
+ } catch (NoSuchElementException e) {
+ Assert.fail(String.format("Can't locate row for index: %s", index));
+ }
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/table/TableDropIndicatorValo.java b/uitest/src/com/vaadin/tests/components/table/TableDropIndicatorValo.java
new file mode 100644
index 0000000000..e3848bb152
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/TableDropIndicatorValo.java
@@ -0,0 +1,53 @@
+package com.vaadin.tests.components.table;
+
+import com.vaadin.annotations.Theme;
+import com.vaadin.event.dd.DragAndDropEvent;
+import com.vaadin.event.dd.DropHandler;
+import com.vaadin.event.dd.acceptcriteria.AcceptAll;
+import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Table;
+
+@Theme("valo")
+@SuppressWarnings("serial")
+public class TableDropIndicatorValo extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+
+ Table table = new Table();
+
+ table.addContainerProperty("foo", Integer.class, 0);
+ table.addContainerProperty("bar", Integer.class, 0);
+ // table.addContainerProperty("button", Button.class, null);
+
+ for (int i = 0; i < 40; i++) {
+ // Button b = new Button("testbutton");
+ // b.setHeight("50px");
+ table.addItem(new Object[] { i, i }, i);
+ }
+
+ table.setDragMode(Table.TableDragMode.ROW);
+ table.setSelectable(true);
+
+ table.setDropHandler(new DropHandler() {
+ @Override
+ public void drop(DragAndDropEvent dragAndDropEvent) {
+
+ }
+
+ @Override
+ public AcceptCriterion getAcceptCriterion() {
+ return AcceptAll.get();
+ }
+ });
+
+ addComponent(table);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Tests if the drop indicator appears between two rows as it should";
+ }
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/table/TableDropIndicatorValoTest.java b/uitest/src/com/vaadin/tests/components/table/TableDropIndicatorValoTest.java
new file mode 100644
index 0000000000..82a66eba07
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/TableDropIndicatorValoTest.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.tests.components.table;
+
+import java.util.List;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+
+import com.vaadin.testbench.elements.TableElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Tests that clicking on active fields doesn't change Table selection, nor does
+ * dragging rows.
+ *
+ * @author Vaadin Ltd
+ */
+
+public class TableDropIndicatorValoTest extends MultiBrowserTest {
+
+ @Override
+ public void setup() throws Exception {
+
+ super.setup();
+ openTestURL();
+ }
+
+ @Test
+ public void indicator() throws Exception {
+
+ dragRowWithoutDropping(1);
+ compareScreen("indicator");
+ }
+
+ private List<WebElement> getCellContents(WebElement row) {
+
+ return row.findElements(By.className("v-table-cell-content"));
+ }
+
+ private List<WebElement> getRows() {
+
+ return getTable().findElement(By.className("v-table-body"))
+ .findElements(By.tagName("tr"));
+ }
+
+ private TableElement getTable() {
+
+ return $(TableElement.class).first();
+ }
+
+ private void dragRowWithoutDropping(int from) {
+
+ List<WebElement> rows = getRows();
+ WebElement row = rows.get(from);
+ List<WebElement> cellContents = getCellContents(row);
+
+ int rowHeight = row.getSize().getHeight();
+ int halfRowHeight = (int) (rowHeight + 0.5) / 2; // rounded off
+ int oneAndAHalfRow = rowHeight + halfRowHeight;
+
+ new Actions(getDriver()).moveToElement(cellContents.get(1))
+ .clickAndHold().moveByOffset(0, oneAndAHalfRow).perform();
+ }
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/table/TableExpandRatio.java b/uitest/src/com/vaadin/tests/components/table/TableExpandRatio.java
deleted file mode 100644
index 92c9b8d988..0000000000
--- a/uitest/src/com/vaadin/tests/components/table/TableExpandRatio.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright 2000-2014 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.tests.components.table;
-
-import java.util.Arrays;
-
-import com.vaadin.annotations.PreserveOnRefresh;
-import com.vaadin.annotations.Theme;
-import com.vaadin.data.util.BeanItemContainer;
-import com.vaadin.server.VaadinRequest;
-import com.vaadin.tests.components.AbstractTestUI;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Table;
-import com.vaadin.ui.VerticalLayout;
-
-@PreserveOnRefresh
-@Theme("valo")
-public class TableExpandRatio extends AbstractTestUI {
-
- @Override
- protected void setup(VaadinRequest request) {
-
- BeanItemContainer<MyItem> container = new BeanItemContainer<TableExpandRatio.MyItem>(
- MyItem.class, Arrays.asList(new MyItem("one", 1), new MyItem(
- "two", 2)));
-
- final Table table = new Table(null, container);
-
- table.setWidth("800px");
- table.setImmediate(true);
-
- Button widthButton = new Button("Set Width",
- new Button.ClickListener() {
-
- @Override
- public void buttonClick(ClickEvent event) {
- table.setColumnWidth("value", 300);
-
- }
- });
-
- Button expandButton = new Button("Set Expand Ratio",
- new Button.ClickListener() {
-
- @Override
- public void buttonClick(ClickEvent event) {
- table.setColumnExpandRatio("value", 1);
-
- }
- });
-
- widthButton.setId("widthbutton");
- expandButton.setId("expandbutton");
-
- VerticalLayout layout = new VerticalLayout(widthButton, expandButton,
- table);
- addComponent(layout);
- }
-
- public class MyItem {
-
- private String name;
- private Integer value;
-
- public MyItem(String name, Integer value) {
- this.name = name;
- this.value = value;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Integer getValue() {
- return value;
- }
-
- public void setValue(Integer value) {
- this.value = value;
- }
- }
-
- @Override
- protected String getTestDescription() {
- return "When a column has fixed width and it is changed to expand ratio, the width should update accordingly";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 15101;
- }
-}
diff --git a/uitest/src/com/vaadin/tests/components/table/TableExpandRatioTest.java b/uitest/src/com/vaadin/tests/components/table/TableExpandRatioTest.java
deleted file mode 100644
index 3cf66d4e4b..0000000000
--- a/uitest/src/com/vaadin/tests/components/table/TableExpandRatioTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2000-2014 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.tests.components.table;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.number.IsCloseTo.closeTo;
-
-import java.util.List;
-
-import org.junit.Test;
-import org.openqa.selenium.By;
-import org.openqa.selenium.WebElement;
-
-import com.vaadin.testbench.elements.ButtonElement;
-import com.vaadin.testbench.elements.TableElement;
-import com.vaadin.tests.tb3.MultiBrowserTest;
-
-public class TableExpandRatioTest extends MultiBrowserTest {
-
- @Override
- public void setup() throws Exception {
- super.setup();
-
- openTestURL();
- }
-
- /*
- * Needed for IE to get focus when button is clicked
- */
- @Override
- protected boolean requireWindowFocusForIE() {
-
- return true;
- }
-
- @Test
- public void cellWidthUpdatesWhenExpandRatioSetAfterDefinedWidth() {
-
- // test that after setting defined size to the second column, the first
- // column will have correct size
-
- setDefinedWidth();
-
- assertThat(getFirstCellWidth(), closeTo(500, 10));
-
- // test that after setting expandratio to the second column, it is
- // correct
-
- setExpandRatio();
-
- assertThat(getFirstCellWidth(), closeTo(65, 5));
-
- }
-
- private void setExpandRatio() {
- $(ButtonElement.class).id("expandbutton").click();
- }
-
- private void setDefinedWidth() {
- $(ButtonElement.class).id("widthbutton").click();
- }
-
- private double getFirstCellWidth() {
-
- List<WebElement> rows = $(TableElement.class).first()
- .findElement(By.className("v-table-body"))
- .findElements(By.tagName("tr"));
- WebElement firstrow = rows.get(0);
- List<WebElement> cells = firstrow.findElements(By
- .className("v-table-cell-content"));
-
- int cellwidth = cells.get(0).getSize().getWidth();
- return cellwidth;
- }
-}
diff --git a/uitest/src/com/vaadin/tests/components/treetable/MinimalWidthColumns.java b/uitest/src/com/vaadin/tests/components/treetable/MinimalWidthColumns.java
new file mode 100644
index 0000000000..c4679f739b
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/treetable/MinimalWidthColumns.java
@@ -0,0 +1,44 @@
+package com.vaadin.tests.components.treetable;
+
+import com.vaadin.annotations.Theme;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.TreeTable;
+
+@Theme("valo")
+public class MinimalWidthColumns extends AbstractTestUI {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server.
+ * VaadinRequest)
+ */
+ @Override
+ protected void setup(VaadinRequest request) {
+ TreeTable tt = new TreeTable();
+ tt.addContainerProperty("Foo", String.class, "");
+ tt.addContainerProperty("Bar", String.class, "");
+
+ Object item1 = tt.addItem(new Object[] { "f", "Bar" }, null);
+ Object item2 = tt.addItem(new Object[] { "Foo2", "Bar2" }, null);
+
+ tt.setParent(item2, item1);
+
+ tt.setColumnWidth("Foo", 0);
+ tt.setColumnWidth("Bar", 50);
+ tt.setWidth("300px");
+ addComponent(tt);
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return Integer.valueOf(15118);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "There should be no 1px discrepancy between vertical borders in headers and rows";
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/treetable/MinimalWidthColumnsTest.java b/uitest/src/com/vaadin/tests/components/treetable/MinimalWidthColumnsTest.java
new file mode 100644
index 0000000000..46c2f397b6
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/treetable/MinimalWidthColumnsTest.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.treetable;
+
+import org.junit.Test;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class MinimalWidthColumnsTest extends MultiBrowserTest {
+
+ @Test
+ public void testFor1pxDifference() throws Exception {
+ openTestURL();
+ sleep(500);
+ compareScreen("onepixdifference");
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/performance/BasicPerformanceTest.java b/uitest/src/com/vaadin/tests/performance/BasicPerformanceTest.java
index 04fe18fc08..a97f2611d1 100644
--- a/uitest/src/com/vaadin/tests/performance/BasicPerformanceTest.java
+++ b/uitest/src/com/vaadin/tests/performance/BasicPerformanceTest.java
@@ -4,6 +4,7 @@ import java.util.Iterator;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.util.TestUtils;
+import com.vaadin.ui.AbstractOrderedLayout;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Component;
@@ -18,6 +19,8 @@ import com.vaadin.ui.themes.Reindeer;
public class BasicPerformanceTest extends UI {
+ private int updateOneCount = 0;
+
private final VerticalLayout contentLayout = new VerticalLayout();
private int clientLimit;
@@ -64,7 +67,7 @@ public class BasicPerformanceTest extends UI {
TestUtils.installPerformanceReporting(performanceReportArea);
VerticalLayout leftBar = new VerticalLayout();
- leftBar.setSizeUndefined();
+ leftBar.setWidth("250px");
leftBar.addComponent(new Label("This is the left bar"));
leftBar.addComponent(performanceReportArea);
leftBar.addComponent(reportPerformanceButton);
@@ -126,6 +129,26 @@ public class BasicPerformanceTest extends UI {
}
}));
+ leftBar.addComponent(new Button("Update one label",
+ new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ Component child = contentLayout.getComponent(0);
+ if (child instanceof Panel) {
+ Panel panel = (Panel) child;
+ child = panel.getContent();
+ }
+
+ AbstractOrderedLayout layout = (AbstractOrderedLayout) ((AbstractOrderedLayout) child)
+ .getComponent(0);
+ Label label = (Label) layout.getComponent(0);
+
+ label.setValue("New value " + updateOneCount++);
+
+ updatePerformanceReporting("Update one", 10, 10);
+ }
+ }));
+
leftBar.addComponent(new Button("Clear content",
new Button.ClickListener() {
@Override
diff --git a/uitest/src/com/vaadin/tests/tb3/AffectedTB3TestLocator.java b/uitest/src/com/vaadin/tests/tb3/AffectedTB3TestLocator.java
index a3bee26675..9dfae77ca5 100644
--- a/uitest/src/com/vaadin/tests/tb3/AffectedTB3TestLocator.java
+++ b/uitest/src/com/vaadin/tests/tb3/AffectedTB3TestLocator.java
@@ -17,7 +17,9 @@ package com.vaadin.tests.tb3;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
public class AffectedTB3TestLocator extends TB3TestLocator {
@@ -42,21 +44,14 @@ public class AffectedTB3TestLocator extends TB3TestLocator {
private <T> List<Class<? extends T>> getAffectedTestClasses(
List<Class<? extends T>> allTestClasses,
List<Class<? extends T>> changedTestClasses) throws IOException {
- List<Class<? extends T>> affectedWithPackageTestClasses = getTestClassesWithAffectedPackageName(allTestClasses);
- List<Class<? extends T>> affectedTestClasses = new ArrayList<Class<? extends T>>();
- affectedTestClasses.addAll(affectedWithPackageTestClasses);
- // Removing duplicate entries before adding changed test classes.
- for (Class<? extends T> changedTestClass : changedTestClasses) {
- for (Class<? extends T> affectedTestClass : affectedWithPackageTestClasses) {
- if (!changedTestClass.getName().equals(
- affectedTestClass.getName())) {
- affectedTestClasses.add(changedTestClass);
+ Set testClasses = new HashSet(changedTestClasses);
+ testClasses
+ .addAll(getTestClassesWithAffectedPackageName(allTestClasses));
+
+ List<Class<? extends T>> affectedTestClasses = new ArrayList<Class<? extends T>>();
+ affectedTestClasses.addAll(testClasses);
- break;
- }
- }
- }
return affectedTestClasses;
}
diff --git a/uitest/src/com/vaadin/tests/tb3/ChangedTB3TestLocator.java b/uitest/src/com/vaadin/tests/tb3/ChangedTB3TestLocator.java
index b425de48b5..a6f2e5191a 100644
--- a/uitest/src/com/vaadin/tests/tb3/ChangedTB3TestLocator.java
+++ b/uitest/src/com/vaadin/tests/tb3/ChangedTB3TestLocator.java
@@ -102,15 +102,27 @@ public class ChangedTB3TestLocator extends TB3TestLocator {
List<DiffEntry> diffsInWorkingTree = new ArrayList<DiffEntry>();
for (DiffEntry diff : diffCommand.call()) {
- // Exclude temporary junit files.
- if (!diff.getNewPath().startsWith("uitest/junit")) {
- diffsInWorkingTree.add(diff);
+ if (pathIsExcluded(diff.getNewPath())) {
+ continue;
}
+
+ diffsInWorkingTree.add(diff);
}
return diffsInWorkingTree;
}
+ private boolean pathIsExcluded(String path) {
+ // Exclude temporary junit files and screenshots.
+ return path.startsWith("uitest/junit")
+ || getScreenshotDirectory().contains(path);
+ }
+
+ private String getScreenshotDirectory() {
+ return PrivateTB3Configuration
+ .getProperty(PrivateTB3Configuration.SCREENSHOT_DIRECTORY);
+ }
+
private List<DiffEntry> getDiffsInHead(Repository repository)
throws AmbiguousObjectException, IncorrectObjectTypeException,
IOException, MissingObjectException {
diff --git a/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java b/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java
index a4bb85bb53..32d0f1065c 100644
--- a/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java
+++ b/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java
@@ -42,10 +42,14 @@ import com.vaadin.tests.tb3.MultiBrowserTest.Browser;
* Provides values for parameters which depend on where the test is run.
* Parameters should be configured in work/eclipse-run-selected-test.properties.
* A template is available in uitest/.
- *
+ *
* @author Vaadin Ltd
*/
public abstract class PrivateTB3Configuration extends ScreenshotTB3Test {
+ /**
+ *
+ */
+ public static final String SCREENSHOT_DIRECTORY = "com.vaadin.testbench.screenshot.directory";
private static final String RUN_LOCALLY_PROPERTY = "com.vaadin.testbench.runLocally";
private static final String HOSTNAME_PROPERTY = "com.vaadin.testbench.deployment.hostname";
private static final String PORT_PROPERTY = "com.vaadin.testbench.deployment.port";
@@ -63,7 +67,7 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test {
}
}
- private static String getProperty(String name) {
+ protected static String getProperty(String name) {
String property = properties.getProperty(name);
if (property == null) {
property = System.getProperty(name);
@@ -84,10 +88,11 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test {
@Override
protected String getScreenshotDirectory() {
- String screenshotDirectory = getProperty("com.vaadin.testbench.screenshot.directory");
+ String screenshotDirectory = getProperty(SCREENSHOT_DIRECTORY);
if (screenshotDirectory == null) {
throw new RuntimeException(
- "No screenshot directory defined. Use -Dcom.vaadin.testbench.screenshot.directory=<path>");
+ "No screenshot directory defined. Use -D"
+ + SCREENSHOT_DIRECTORY + "=<path>");
}
return screenshotDirectory;
}
@@ -116,7 +121,7 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test {
/**
* Gets the hostname that tests are configured to use.
- *
+ *
* @return the host name configuration value
*/
public static String getConfiguredDeploymentHostname() {
@@ -136,7 +141,7 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test {
/**
* Gets the port that tests are configured to use.
- *
+ *
* @return the port configuration value
*/
public static int getConfiguredDeploymentPort() {
@@ -153,7 +158,7 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test {
/**
* Tries to automatically determine the IP address of the machine the test
* is running on.
- *
+ *
* @return An IP address of one of the network interfaces in the machine.
* @throws RuntimeException
* if there was an error or no IP was found
diff --git a/uitest/src/com/vaadin/tests/themes/valo/ModalWindowTest.java b/uitest/src/com/vaadin/tests/themes/valo/ModalWindowTest.java
new file mode 100644
index 0000000000..b97ce43ed6
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/themes/valo/ModalWindowTest.java
@@ -0,0 +1,34 @@
+package com.vaadin.tests.themes.valo;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.tests.ModalWindow;
+import com.vaadin.tests.tb3.SingleBrowserTest;
+import org.junit.Test;
+import org.openqa.selenium.WebElement;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+public class ModalWindowTest extends SingleBrowserTest {
+
+ @Override
+ protected Class<?> getUIClass() {
+ return ModalWindow.class;
+ }
+
+ @Test
+ public void modalAnimationsAreDisabled() {
+ openTestURL("theme=tests-valo-disabled-animations");
+
+ openModalWindow();
+
+ WebElement modalityCurtain = findElement(By.className("v-window-modalitycurtain"));
+
+ assertThat(modalityCurtain.getCssValue("-webkit-animation-name"), is("none"));
+ }
+
+ private void openModalWindow() {
+ $(ButtonElement.class).get(1).click();
+ }
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldPopupClosing.java b/uitest/src/com/vaadin/tests/themes/valo/TextFieldBevel.java
index 60508a30d4..4e1debc5b6 100644
--- a/uitest/src/com/vaadin/tests/components/datefield/DateFieldPopupClosing.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/TextFieldBevel.java
@@ -13,31 +13,40 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.vaadin.tests.components.datefield;
+package com.vaadin.tests.themes.valo;
+import com.vaadin.annotations.Theme;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
-import com.vaadin.ui.DateField;
+import com.vaadin.ui.TextField;
-public class DateFieldPopupClosing extends AbstractTestUI {
-
- static final String DATEFIELD_ID = "datefield";
+/**
+ * Test UI for $v-textfield-bevel value in TextField component.
+ *
+ * @author Vaadin Ltd
+ */
+@Theme("tests-valo-textfield-bevel")
+public class TextFieldBevel extends AbstractTestUI {
@Override
protected void setup(VaadinRequest request) {
- final DateField df = new DateField();
- df.setId(DATEFIELD_ID);
- addComponent(df);
+ TextField field = new TextField();
+ addComponent(field);
}
@Override
- protected String getTestDescription() {
- return "DateField popup should be closed when click on popup button";
+ protected Integer getTicketNumber() {
+ return 14634;
}
@Override
- protected Integer getTicketNumber() {
- return 14857;
+ protected String getTestDescription() {
+ return "Set v-bevel to 'false' should unset 'v-textfield-bevel' value.";
+ }
+
+ @Theme("valo")
+ public static class ValoDefaultTextFieldBevel extends TextFieldBevel {
+
}
}
diff --git a/uitest/src/com/vaadin/tests/themes/valo/TextFieldBevelTest.java b/uitest/src/com/vaadin/tests/themes/valo/TextFieldBevelTest.java
new file mode 100644
index 0000000000..9159b71961
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/themes/valo/TextFieldBevelTest.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.themes.valo;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import java.util.List;
+
+import org.junit.Test;
+import org.openqa.selenium.remote.DesiredCapabilities;
+
+import com.vaadin.testbench.elements.TextFieldElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Test for $v-textfield-bevel value when $v-bevel is unset.
+ *
+ * @author Vaadin Ltd
+ */
+public class TextFieldBevelTest extends MultiBrowserTest {
+
+ @Override
+ public List<DesiredCapabilities> getBrowsersToTest() {
+ List<DesiredCapabilities> browsers = super.getBrowsersToTest();
+
+ // IE8 doesn't support box-shadow.
+ browsers.remove(Browser.IE8.getDesiredCapabilities());
+
+ return browsers;
+ }
+
+ @Test
+ public void bevelChangesBoxShadow() {
+ openTestURL();
+ String boxShadowWithBevel = getBoxShadow();
+
+ openTestUrlWithoutBevel();
+ String boxShadowWithoutBevel = getBoxShadow();
+
+ assertThat(boxShadowWithBevel, is(not(boxShadowWithoutBevel)));
+ }
+
+ private void openTestUrlWithoutBevel() {
+ getDriver().get(
+ getTestUrl()
+ + "$"
+ + TextFieldBevel.ValoDefaultTextFieldBevel.class
+ .getSimpleName() + "?restartApplication");
+ }
+
+ private String getBoxShadow() {
+ return $(TextFieldElement.class).first().getCssValue("box-shadow");
+ }
+}
diff --git a/uitest/tb3test.xml b/uitest/tb3test.xml
index 975298926e..ecacf43ee2 100644
--- a/uitest/tb3test.xml
+++ b/uitest/tb3test.xml
@@ -9,6 +9,7 @@
<property name="categories.exclude" value="" />
<property name="useLocalWebDriver" value="false" />
<property name="com.vaadin.testbench.max.retries" value="0" />
+ <property name="junit.test.suite" value="com.vaadin.tests.tb3.AllTB3Tests" />
<ivy:resolve file="${tb3test.dir}/ivy.xml" conf="build, build-provided" />
<ivy:cachepath pathid="classpath.tb3.lib" conf="build, build-provided" />
@@ -18,13 +19,10 @@
</path>
<target name="run-all-tb3-tests" unless="tests.tb3.skip" description="Run all the TB3 tests (except server tests) in the project">
- <antcall target="run-tb3-suite">
- <param name="junit.test.suite" value="com.vaadin.tests.tb3.AllTB3Tests" />
- </antcall>
+ <antcall target="run-tb3-suite" />
</target>
<target name="run-tb3-suite">
- <fail unless="junit.test.suite" message="Define suite to run using junit.test.suite" />
<fail unless="com.vaadin.testbench.screenshot.directory" message="Define screenshot directory using -Dcom.vaadin.testbench.screenshot.directory" />
<delete dir="${report.dir}" />
<mkdir dir="${report.dir}" />