diff options
author | Artur Signell <artur@vaadin.com> | 2014-08-19 20:53:40 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2014-08-19 20:53:40 +0300 |
commit | 8cec1704ae7625ba630d895ce673d9c2784db84e (patch) | |
tree | 7fad00a79f4c1bfc62a2eb4992c7ab769fbf89d4 | |
parent | 2d89d1735b09dc6470ab95a0d65aa99650bbd296 (diff) | |
parent | 35201491f42555a4fba119ab515ab2dc34d14baa (diff) | |
download | vaadin-framework-8cec1704ae7625ba630d895ce673d9c2784db84e.tar.gz vaadin-framework-8cec1704ae7625ba630d895ce673d9c2784db84e.zip |
Merge remote-tracking branch 'origin/master' into 7.3
35 files changed, 747 insertions, 307 deletions
diff --git a/WebContent/VAADIN/themes/tests-valo-light/_variables.scss b/WebContent/VAADIN/themes/tests-valo-light/_variables.scss new file mode 100644 index 0000000000..e851f075e4 --- /dev/null +++ b/WebContent/VAADIN/themes/tests-valo-light/_variables.scss @@ -0,0 +1,24 @@ +$v-app-loading-text: "Light Valo"; + +$v-background-color: hsl(0, 0, 99.5%); +$v-app-background-color: #fff; +$v-focus-color: hsl(218, 80%, 60%); +$v-border: 1px solid (v-shade 0.6); +$v-border-radius: 3px; +$v-bevel: inset 0 1px 0 v-tint; +$v-textfield-bevel: false; +$v-gradient: v-linear 3%; +$v-shadow: false; +$valo-menu-background-color: hsl(218, 20%, 98%); +$v-friendly-color: hsl(163, 61%, 41%); +$v-error-indicator-color: hsl(349, 66%, 56%); + + +@import "../valo/valo"; + +.tests-valo-light .valo-menu .valo-menu-title { + background: $v-app-background-color; + color: $v-selection-color; + text-shadow: none; + border-color: first-color(valo-border($color: $v-app-background-color, $strength: 0.5)); +} diff --git a/WebContent/VAADIN/themes/tests-valo-light/styles.scss b/WebContent/VAADIN/themes/tests-valo-light/styles.scss new file mode 100644 index 0000000000..12ee8a780e --- /dev/null +++ b/WebContent/VAADIN/themes/tests-valo-light/styles.scss @@ -0,0 +1,6 @@ +@import "variables"; +@import "../tests-valo/valotest"; + +.tests-valo-light { + @include valotest; +} diff --git a/WebContent/VAADIN/themes/valo/components/_checkbox.scss b/WebContent/VAADIN/themes/valo/components/_checkbox.scss index e74781fc46..9fe360c6ed 100644 --- a/WebContent/VAADIN/themes/valo/components/_checkbox.scss +++ b/WebContent/VAADIN/themes/valo/components/_checkbox.scss @@ -44,6 +44,7 @@ label { @include valo-tappable; + display: inline-block; } } diff --git a/WebContent/VAADIN/themes/valo/components/_combobox.scss b/WebContent/VAADIN/themes/valo/components/_combobox.scss index 538a5e2694..93cb5393ee 100644 --- a/WebContent/VAADIN/themes/valo/components/_combobox.scss +++ b/WebContent/VAADIN/themes/valo/components/_combobox.scss @@ -67,6 +67,11 @@ } .#{$primary-stylename}-button { border: none; + color: inherit; + @include opacity(.5); + } + &.#{$primary-stylename}-prompt .#{$primary-stylename}-input { + @include valo-textfield-prompt-style(transparent); } } @@ -83,8 +88,12 @@ font-size: $v-font-size--tiny; } + .#{$primary-stylename}-compact, .#{$primary-stylename}-small { @include valo-combobox-style($unit-size: $v-unit-size--small, $bevel: null, $shadow: null, $gradient: null, $border: null, $border-radius: null, $background-color: null, $states: normal); + } + + .#{$primary-stylename}-small { font-size: $v-font-size--small; } diff --git a/WebContent/VAADIN/themes/valo/components/_datefield.scss b/WebContent/VAADIN/themes/valo/components/_datefield.scss index 8854992032..521d661a3d 100644 --- a/WebContent/VAADIN/themes/valo/components/_datefield.scss +++ b/WebContent/VAADIN/themes/valo/components/_datefield.scss @@ -48,6 +48,8 @@ } .#{$primary-stylename}-button { border: none; + color: inherit; + @include opacity(.5); } } @@ -64,8 +66,12 @@ font-size: $v-font-size--tiny; } + .#{$primary-stylename}-compact, .#{$primary-stylename}-small { @include valo-datefield-style($unit-size: $v-unit-size--small, $bevel: null, $shadow: null, $border: null, $background-color: null, $states: normal); + } + + .#{$primary-stylename}-small { font-size: $v-font-size--small; } diff --git a/WebContent/VAADIN/themes/valo/components/_menubar.scss b/WebContent/VAADIN/themes/valo/components/_menubar.scss index f03bc3d022..7368579d43 100644 --- a/WebContent/VAADIN/themes/valo/components/_menubar.scss +++ b/WebContent/VAADIN/themes/valo/components/_menubar.scss @@ -91,7 +91,7 @@ text-align: left; @if $unit-size { - line-height: $unit-size - first-number($v-border) * 2 - 1px; + line-height: $unit-size - first-number($v-border) * 2; > .#{$primary-stylename}-menuitem { padding: 0 round($unit-size/2.6); diff --git a/WebContent/VAADIN/themes/valo/components/_panel.scss b/WebContent/VAADIN/themes/valo/components/_panel.scss index 6ccd5139da..07e21cccbf 100644 --- a/WebContent/VAADIN/themes/valo/components/_panel.scss +++ b/WebContent/VAADIN/themes/valo/components/_panel.scss @@ -162,6 +162,8 @@ $v-panel-border: $v-border !default; left: 0; height: 0; border-top: $border-width solid first-color(valo-border($color: $v-app-background-color, $strength: 0.5)); + $border-color: first-color(valo-border($color: $v-app-background-color, $strength: 1)); + border-color: rgba($border-color, .5); } } diff --git a/WebContent/VAADIN/themes/valo/components/_table.scss b/WebContent/VAADIN/themes/valo/components/_table.scss index 46318590d0..adac1b90bd 100644 --- a/WebContent/VAADIN/themes/valo/components/_table.scss +++ b/WebContent/VAADIN/themes/valo/components/_table.scss @@ -3,7 +3,6 @@ $v-table-border-width: first-number($v-border) !default; $v-table-border-color: null !default; $v-table-border-radius: 0 !default; $v-table-cell-padding-horizontal: round($v-unit-size/3) !default; -//$v-table-cell-padding-horizontal-edge: round($v-unit-size/2.5) !default; $v-table-resizer-width: round($v-unit-size/4.5) !default; $v-table-sort-indicator-width: round($v-unit-size/2) !default; $v-table-header-font-size: round($v-font-size * 0.86) !default; @@ -153,10 +152,10 @@ $v-table-background-color: null !default; width: $v-table-resizer-width; cursor: e-resize; cursor: col-resize; - position: absolute; - top: 0; + position: relative; right: round($v-table-resizer-width / -2); z-index: 1; + margin-left: -$v-table-resizer-width; } .#{$primary-stylename}-cell-content { @@ -178,14 +177,23 @@ $v-table-background-color: null !default; .#{$primary-stylename}-cell-wrapper { line-height: 1; - min-height: $v-table-row-height; - $vertical-padding: round(($v-table-row-height - $v-font-size)/2); - padding: $vertical-padding $v-table-cell-padding-horizontal; + padding: 0 $v-table-cell-padding-horizontal; @include box-sizing(border-box); margin-right: 0 !important; > .v-widget { - margin: round($vertical-padding / -2) round($v-table-cell-padding-horizontal / -2); + // Leave some breathing room around the table cell and the widget + margin: round($v-table-cell-padding-horizontal / 4) round($v-table-cell-padding-horizontal / -2); + + &.v-label, + &.v-checkbox, + &.v-select-optiongroup { + margin: 0; + } + &.v-progressbar { + margin-left: 0; + margin-right: 0; + } } } @@ -220,8 +228,9 @@ $v-table-background-color: null !default; @include valo-gradient($v-selection-color); background-origin: border-box; - color: valo-font-color($v-selection-color, 0.9); - text-shadow: valo-button-text-shadow($v-selection-color, $v-bevel-depth); + $font-color: valo-font-color($v-selection-color, 0.9); + color: $font-color; + text-shadow: valo-text-shadow($font-color: $font-color, $background-color: $v-selection-color); + .v-selected { $gradient-end: first(last(valo-gradient-color-stops($v-selection-color))); @@ -248,8 +257,7 @@ $v-table-background-color: null !default; width: $v-table-sort-indicator-width; height: $v-table-row-height; line-height: $v-table-row-height; - position: absolute; - right: 0; + margin-left: -$v-table-sort-indicator-width; } .#{$primary-stylename}-header-cell-asc .#{$primary-stylename}-sort-indicator:before, @@ -295,13 +303,16 @@ $v-table-background-color: null !default; .#{$primary-stylename}-focus-slot-right { border-right: $v-table-border-width + 2px solid $v-focus-color; right: -$v-table-border-width - 1px; + margin-left: -$v-table-resizer-width - $v-table-border-width - 2px; } .#{$primary-stylename}-focus-slot-left { + float: left; border-left: $v-table-border-width + 2px solid $v-focus-color; left: -$v-table-border-width; right: auto; margin-left: 0 !important; + margin-right: -$v-table-resizer-width - $v-table-border-width - 2px; } .#{$primary-stylename}-column-selector { @@ -500,7 +511,7 @@ $v-table-background-color: null !default; .#{$primary-stylename}-compact, .#{$primary-stylename}-small { - @include valo-table-spacing-style($row-height: round($v-table-row-height * $v-scaling-factor--small), $cell-padding-horizontal: round($v-table-cell-padding-horizontal / 2)); + @include valo-table-spacing-style($row-height: $v-unit-size--small, $cell-padding-horizontal: round($v-table-cell-padding-horizontal / 2)); } .#{$primary-stylename}-small { @@ -639,11 +650,21 @@ $v-table-background-color: null !default; } .#{$primary-stylename}-cell-wrapper { - padding: $vertical-padding $cell-padding-horizontal; - min-height: $row-height; + padding-left: $cell-padding-horizontal; + padding-right: $cell-padding-horizontal; > .v-widget { - margin: round($vertical-padding / -2) round($cell-padding-horizontal / -2); + margin: round($cell-padding-horizontal / 4) round($cell-padding-horizontal / -2); + + &.v-label, + &.v-checkbox, + &.v-select-optiongroup { + margin: 0; + } + &.v-progressbar { + margin-left: 0; + margin-right: 0; + } } } diff --git a/WebContent/VAADIN/themes/valo/components/_textfield.scss b/WebContent/VAADIN/themes/valo/components/_textfield.scss index 0b4fa50fb2..85e2487bc1 100644 --- a/WebContent/VAADIN/themes/valo/components/_textfield.scss +++ b/WebContent/VAADIN/themes/valo/components/_textfield.scss @@ -35,8 +35,12 @@ $v-textfield-disabled-opacity: $v-disabled-opacity !default; font-size: $v-font-size--tiny; } + .#{$primary-stylename}-compact, .#{$primary-stylename}-small { @include valo-textfield-style($unit-size: $v-unit-size--small, $states: normal, $background-color: null, $border: null, $gradient: null, $bevel: null, $shadow: null); + } + + .#{$primary-stylename}-small { font-size: $v-font-size--small; } @@ -52,6 +56,7 @@ $v-textfield-disabled-opacity: $v-disabled-opacity !default; @include valo-textfield-inline-icon($stylenames: inline-icon); @include valo-textfield-inline-icon($stylenames: inline-icon tiny, $unit-size: $v-unit-size--tiny, $font-size: $v-font-size--tiny); + @include valo-textfield-inline-icon($stylenames: inline-icon compact, $unit-size: $v-unit-size--small); @include valo-textfield-inline-icon($stylenames: inline-icon small, $unit-size: $v-unit-size--small, $font-size: $v-font-size--small); @include valo-textfield-inline-icon($stylenames: inline-icon large, $unit-size: $v-unit-size--large, $font-size: $v-font-size--large); @include valo-textfield-inline-icon($stylenames: inline-icon huge, $unit-size: $v-unit-size--huge, $font-size: $v-font-size--huge); @@ -158,7 +163,10 @@ $v-textfield-disabled-opacity: $v-disabled-opacity !default; @mixin valo-textfield-prompt-style ($background-color: $v-textfield-background-color) { - @if type-of($background-color) == color { + @if $background-color == transparent { + color: inherit; + @include opacity(.5); + } @else if type-of($background-color) == color { $font-color: valo-font-color($background-color); $font-color: mix($background-color, $font-color); @if is-dark-color($background-color) and saturation($background-color) > 50% { @@ -205,15 +213,20 @@ $v-textfield-disabled-opacity: $v-disabled-opacity !default; border-radius: 0; background: $background-color; @include box-shadow(none); - @if $background-color == transparent { - color: inherit; - } @else if type-of($background-color) == color { - color: valo-font-color($background-color); + + $font-color: inherit; + @if $background-color != transparent and type-of($background-color) == color { + $font-color: valo-font-color($background-color); } + color: $font-color; &:focus { @include box-shadow(none); } + + &[class*="prompt"] { + @include valo-textfield-prompt-style($background-color); + } } diff --git a/WebContent/VAADIN/themes/valo/components/_tree.scss b/WebContent/VAADIN/themes/valo/components/_tree.scss index 93553fe55a..8e75f59945 100644 --- a/WebContent/VAADIN/themes/valo/components/_tree.scss +++ b/WebContent/VAADIN/themes/valo/components/_tree.scss @@ -176,8 +176,9 @@ $v-tree-expand-animation-enabled: false !default; .#{$primary-stylename}-node-selected { - color: valo-font-color($v-selection-color, 0.9); - text-shadow: valo-button-text-shadow($v-selection-color, $v-bevel-depth); + $font-color: valo-font-color($v-selection-color, 0.9); + color: $font-color; + text-shadow: valo-text-shadow($font-color: $font-color, $background-color: $v-selection-item-selection-color); &:after { opacity: 1; diff --git a/WebContent/VAADIN/themes/valo/components/_valo-menu.scss b/WebContent/VAADIN/themes/valo/components/_valo-menu.scss index 507065d339..9a9e597888 100644 --- a/WebContent/VAADIN/themes/valo/components/_valo-menu.scss +++ b/WebContent/VAADIN/themes/valo/components/_valo-menu.scss @@ -87,10 +87,11 @@ $valo-menu-background-color: scale-color($v-app-background-color, $lightness: if img.v-icon { width: round($v-unit-size * 1.5); height: round($v-unit-size * 1.5); - border-radius: ceil($v-unit-size * 1.5 / 2); + border-radius: ceil($v-unit-size * 1.5 / 2 + first-number($v-border)); box-shadow: valo-bevel-and-shadow($bevel: null, $shadow: $v-shadow); display: block; margin: 0 auto .3em; + border: valo-border(); } } @@ -101,10 +102,6 @@ $valo-menu-background-color: scale-color($v-app-background-color, $lightness: if .valo-menu-subtitle { @include valo-menu-subtitle-style($bg); - - .valo-menu-badge { - color: mix(valo-font-color($bg), $v-selection-color); - } } .valo-menuitems { @@ -177,9 +174,11 @@ $valo-menu-background-color: scale-color($v-app-background-color, $lightness: if padding: 0; height: $v-unit-size; color: valo-font-color($v-selection-color, 0.5); + max-width: 30%; .v-menubar-menuitem { line-height: $v-unit-size - 1px; + white-space: nowrap; } img.v-icon { @@ -188,6 +187,7 @@ $valo-menu-background-color: scale-color($v-app-background-color, $lightness: if width: round($v-unit-size / 2); height: round($v-unit-size / 2); border-radius: ceil($v-unit-size / 4); + border: none; } } @@ -228,7 +228,7 @@ $valo-menu-background-color: scale-color($v-app-background-color, $lightness: if @mixin valo-menu-style ($bg: $valo-menu-background-color) { height: 100%; - @include linear-gradient(to left, (scale-color($bg, $lightness: valo-gradient-opacity()*-1) 0%, $bg round($v-unit-size/4)), $fallback: $bg); + @include linear-gradient(to left, (darken($bg, valo-gradient-opacity() / 2) 0%, $bg round($v-unit-size/4)), $fallback: $bg); color: valo-font-color($bg, 0.5); font-size: round($v-font-size * 0.9); line-height: round($v-unit-size * 0.8); @@ -256,6 +256,10 @@ $valo-menu-background-color: scale-color($v-app-background-color, $lightness: if color: valo-font-color($bg, 0.33); margin: round($v-unit-size/5) 0 round($v-unit-size/5) round($v-unit-size/2); border-bottom: valo-border($color: $bg, $strength: 0.5, $border: first-number($v-border) solid v-tone); + + [class*="badge"] { + color: mix(valo-font-color($bg), $v-selection-color); + } } @@ -286,6 +290,14 @@ $valo-menu-background-color: scale-color($v-app-background-color, $lightness: if overflow: hidden; } + [class*="badge"] { + @if abs($diff) < 50 { + color: mix(valo-font-color($bg), $v-selection-color); + } @else { + color: $active-color; + } + } + &.selected { background: if(is-dark-color($bg), darken($bg, 3%), lighten($bg, 5%)); diff --git a/WebContent/VAADIN/themes/valo/components/_window.scss b/WebContent/VAADIN/themes/valo/components/_window.scss index 97859a62b2..b958be79da 100644 --- a/WebContent/VAADIN/themes/valo/components/_window.scss +++ b/WebContent/VAADIN/themes/valo/components/_window.scss @@ -96,6 +96,8 @@ $v-window-modality-curtain-background-color: #222 !default; height: 0; $_bg: $v-window-background-color; border-top: $scroll-divider-width solid first-color(valo-border($strength: 0.5)); + $border-color: first-color(valo-border($strength: 1)); + border-color: rgba($border-color, .5); } } diff --git a/WebContent/VAADIN/themes/valo/shared/_contextmenu.scss b/WebContent/VAADIN/themes/valo/shared/_contextmenu.scss index 8a3894b524..4b737416c2 100644 --- a/WebContent/VAADIN/themes/valo/shared/_contextmenu.scss +++ b/WebContent/VAADIN/themes/valo/shared/_contextmenu.scss @@ -10,6 +10,7 @@ .v-contextmenu .gwt-MenuItem { @include valo-selection-item-style; + display: block; // Firefox 24 needs this to make position: relative; work } .v-contextmenu .gwt-MenuItem-selected { diff --git a/WebContent/VAADIN/themes/valo/shared/_overlay.scss b/WebContent/VAADIN/themes/valo/shared/_overlay.scss index a5f6e36957..dc54672cb6 100644 --- a/WebContent/VAADIN/themes/valo/shared/_overlay.scss +++ b/WebContent/VAADIN/themes/valo/shared/_overlay.scss @@ -181,7 +181,9 @@ $v-selection-item-selection-color: $v-selection-color !default; @mixin valo-selection-item-selected-style { @include valo-gradient($v-selection-item-selection-color); - color: valo-font-color($v-selection-item-selection-color, 0.9); + $font-color: valo-font-color($v-selection-item-selection-color, 0.9); + color: $font-color; + text-shadow: valo-text-shadow($font-color: $font-color, $background-color: $v-selection-item-selection-color); } diff --git a/build/ide.xml b/build/ide.xml index c7183077a9..1e586acc19 100755 --- a/build/ide.xml +++ b/build/ide.xml @@ -92,6 +92,9 @@ <antcall target="compile-theme" inheritRefs="true"> <param name="theme" value="tests-valo-blueprint" /> </antcall> + <antcall target="compile-theme" inheritRefs="true"> + <param name="theme" value="tests-valo-light" /> + </antcall> </parallel> </target> diff --git a/client/src/com/vaadin/client/DeferredWorker.java b/client/src/com/vaadin/client/DeferredWorker.java index 53f7c79fe6..1eea26bf27 100644 --- a/client/src/com/vaadin/client/DeferredWorker.java +++ b/client/src/com/vaadin/client/DeferredWorker.java @@ -20,6 +20,9 @@ package com.vaadin.client; * scheduled to be executed in the near future and that the framework should * wait for this work to complete before assuming the UI has reached a steady * state. + * + * @since 7.3 + * @author Vaadin Ltd */ public interface DeferredWorker { /** diff --git a/client/src/com/vaadin/client/Util.java b/client/src/com/vaadin/client/Util.java index e37b044826..306f26b1af 100644 --- a/client/src/com/vaadin/client/Util.java +++ b/client/src/com/vaadin/client/Util.java @@ -476,7 +476,7 @@ public class Util { /** * Defers the execution of {@link #runWebkitOverflowAutoFix(Element)} * - * @since + * @since 7.2.6 * @param elem * with overflow auto */ @@ -963,7 +963,7 @@ public class Util { * necessary in cases where IE "forgets" to update child elements when they * resize. * - * @since + * @since 7.3 * @param e * The element to perform the hack on */ @@ -1438,7 +1438,7 @@ public class Util { * performed. This may be "forward" or "backward", or "none" if * the direction is unknown or irrelevant. * - * @since + * @since 7.3 */ public native static void setSelectionRange(Element elem, int pos, int length, String direction) @@ -1455,7 +1455,7 @@ public class Util { * string representation.<br/> * Eg. 50%, 123px, ... * - * @since + * @since 7.2.6 * @author Vaadin Ltd */ @SuppressWarnings("serial") @@ -1474,7 +1474,6 @@ public class Util { /** * Gets the unit value by its type. * - * @since * @param type * the type of the unit as found in the style. * @return the unit value. @@ -1532,7 +1531,6 @@ public class Util { /** * Creates a {@link CssSize} using a value and its measurement unit. * - * @since * @param value * the value. * @param unit @@ -1594,7 +1592,6 @@ public class Util { /** * Check whether the two sizes are equals. * - * @since * @param cssSize1 * the first size to compare. * @param cssSize2 diff --git a/client/src/com/vaadin/client/ui/VFilterSelect.java b/client/src/com/vaadin/client/ui/VFilterSelect.java index 230c9e6639..b323812c8c 100644 --- a/client/src/com/vaadin/client/ui/VFilterSelect.java +++ b/client/src/com/vaadin/client/ui/VFilterSelect.java @@ -421,7 +421,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, /** * Select the first item of the suggestions list popup. * - * @since + * @since 7.2.6 */ public void selectFirstItem() { debug("VFS.SP: selectFirstItem()"); @@ -431,7 +431,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, /** * Select the last item of the suggestions list popup. * - * @since + * @since 7.2.6 */ public void selectLastItem() { debug("VFS.SP: selectLastItem()"); @@ -1031,6 +1031,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, * menu currently displays the last page with less items then the * maximum visibility (in which case the scroll is not active, but the * scroll is active for any other page in general). + * + * @since 7.2.6 */ @Override public boolean isScrollActive() { diff --git a/client/src/com/vaadin/client/ui/VScrollTable.java b/client/src/com/vaadin/client/ui/VScrollTable.java index c1e83ef08b..cb90823a7f 100644 --- a/client/src/com/vaadin/client/ui/VScrollTable.java +++ b/client/src/com/vaadin/client/ui/VScrollTable.java @@ -8118,7 +8118,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, } /** - * @since + * @since 7.2.6 */ public void onUnregister() { if (addCloseHandler != null) { diff --git a/client/src/com/vaadin/client/ui/VTabsheet.java b/client/src/com/vaadin/client/ui/VTabsheet.java index e5afbea4b4..745f2bca61 100644 --- a/client/src/com/vaadin/client/ui/VTabsheet.java +++ b/client/src/com/vaadin/client/ui/VTabsheet.java @@ -1359,7 +1359,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware /** * Delegate method for the onFocus event occurring on Tab. * - * @since + * @since 7.2.6 * @param newFocusTab * the new focused tab. * @see #onBlur(Tab) diff --git a/client/src/com/vaadin/client/ui/menubar/MenuBar.java b/client/src/com/vaadin/client/ui/menubar/MenuBar.java index 726defafd5..833fb5a38a 100644 --- a/client/src/com/vaadin/client/ui/menubar/MenuBar.java +++ b/client/src/com/vaadin/client/ui/menubar/MenuBar.java @@ -331,7 +331,7 @@ public class MenuBar extends Widget implements PopupListener { /** * Gets the first item from the menu or null if no items. * - * @since + * @since 7.2.6 * @return the first item from the menu or null if no items. */ public MenuItem getFirstItem() { @@ -341,7 +341,7 @@ public class MenuBar extends Widget implements PopupListener { /** * Gest the last item from the menu or null if no items. * - * @since + * @since 7.2.6 * @return the last item from the menu or null if no items. */ public MenuItem getLastItem() { @@ -352,7 +352,7 @@ public class MenuBar extends Widget implements PopupListener { /** * Gets the index of the selected item. * - * @since + * @since 7.2.6 * @return the index of the selected item. */ public int getSelectedIndex() { @@ -532,7 +532,7 @@ public class MenuBar extends Widget implements PopupListener { /** * Scroll the selected item into view. * - * @since + * @since 7.2.6 */ public void scrollSelectionIntoView() { scrollItemIntoView(selectedItem); @@ -541,7 +541,7 @@ public class MenuBar extends Widget implements PopupListener { /** * Sets the menu scroll enabled or disabled. * - * @since + * @since 7.2.6 * @param enabled * the enabled state of the scroll. */ @@ -565,7 +565,7 @@ public class MenuBar extends Widget implements PopupListener { /** * Gets whether the scroll is activate for this menu. * - * @since + * @since 7.2.6 * @return true if the scroll is active, otherwise false. */ public boolean isScrollActive() { @@ -580,7 +580,7 @@ public class MenuBar extends Widget implements PopupListener { /** * Gets the preferred height of the menu. * - * @since + * @since 7.2.6 */ protected int getPreferredHeight() { return table.getOffsetHeight(); diff --git a/scripts/updateSinceTags.sh b/scripts/updateSinceTags.sh new file mode 100755 index 0000000000..f07ba7fb7e --- /dev/null +++ b/scripts/updateSinceTags.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +version=$1 + +if [ "$version" = "" ] +then + echo "Usage: $0 <version to set>" + exit 1 +fi + +scriptdir=`dirname $0` +basedir=$scriptdir"/.." + +sincefiles=`find $basedir -name *.java|xargs egrep -Hi "(@since$|@since $)"|grep -v "./work/"|grep -v "./uitest/"|grep -v "/tests/"|cut -d: -f 1|sort|uniq` + +# Stupid feature detection using an invalid parameter. +# Mac requires a parameter for the -i option (creates a backup file with that suffix) +# Linux does not support any parameters for -i +mac=`sed --foobaryeano 2>&1|grep -- "-i extension"` +if [ "$mac" = "" ] +then + sedCmd="sed -i" +else + sedCmd="sed -i backup" +fi +for f in $sincefiles +do + $sedCmd "s/@since\$/@since $version/g" $f + $sedCmd "s/@since \$/@since $version/g" $f +done diff --git a/uitest/build.xml b/uitest/build.xml index e81983f1f5..02b97fb3a0 100644 --- a/uitest/build.xml +++ b/uitest/build.xml @@ -267,6 +267,9 @@ <antcall target="compile-theme"> <param name="theme" value="tests-valo-blueprint" /> </antcall> + <antcall target="compile-theme"> + <param name="theme" value="tests-valo-light" /> + </antcall> </target> <target name="compile-theme" depends="copy-theme"> diff --git a/uitest/src/com/vaadin/tests/components/table/TableWithContainerRequiringEqualsForItemId.html b/uitest/src/com/vaadin/tests/components/table/TableWithContainerRequiringEqualsForItemId.html deleted file mode 100644 index 0fb4648387..0000000000 --- a/uitest/src/com/vaadin/tests/components/table/TableWithContainerRequiringEqualsForItemId.html +++ /dev/null @@ -1,97 +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://arturwin.office.itmill.com:9999/" /> -<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.TableWithContainerRequiringEqualsForItemId?debug&restartApplication</td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentstableTableWithContainerRequiringEqualsForItemId::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[0]</td> - <td>523,81</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstableTableWithContainerRequiringEqualsForItemId::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentstableTableWithContainerRequiringEqualsForItemId::PID_SLog_row_0</td> - <td>1. Button Button999 clicked</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstableTableWithContainerRequiringEqualsForItemId::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[14]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentstableTableWithContainerRequiringEqualsForItemId::PID_SLog_row_0</td> - <td>2. Button Button985 clicked</td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentstableTableWithContainerRequiringEqualsForItemId::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]</td> - <td>19,7</td> -</tr> -<tr> - <td>contextmenu</td> - <td>vaadin=runcomvaadintestscomponentstableTableWithContainerRequiringEqualsForItemId::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentstableTableWithContainerRequiringEqualsForItemId::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> - <td>0</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstableTableWithContainerRequiringEqualsForItemId::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentstableTableWithContainerRequiringEqualsForItemId::PID_SLog_row_0</td> - <td>3. Button Button0 clicked</td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentstableTableWithContainerRequiringEqualsForItemId::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]</td> - <td>8,15</td> -</tr> -<tr> - <td>contextmenu</td> - <td>vaadin=runcomvaadintestscomponentstableTableWithContainerRequiringEqualsForItemId::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentstableTableWithContainerRequiringEqualsForItemId::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> - <td>999</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstableTableWithContainerRequiringEqualsForItemId::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentstableTableWithContainerRequiringEqualsForItemId::PID_SLog_row_0</td> - <td>4. Button Button999 clicked</td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/uitest/src/com/vaadin/tests/components/table/TableWithContainerRequiringEqualsForItemId.java b/uitest/src/com/vaadin/tests/components/table/TableWithContainerRequiringEqualsForItemId.java index ae16eff2dd..4ca83b22bd 100644 --- a/uitest/src/com/vaadin/tests/components/table/TableWithContainerRequiringEqualsForItemId.java +++ b/uitest/src/com/vaadin/tests/components/table/TableWithContainerRequiringEqualsForItemId.java @@ -4,7 +4,8 @@ import java.util.Date; import com.vaadin.data.util.BeanContainer; import com.vaadin.data.util.BeanItem; -import com.vaadin.tests.components.TestBase; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.tests.util.Log; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -12,7 +13,7 @@ import com.vaadin.ui.Component; import com.vaadin.ui.Table; import com.vaadin.ui.themes.Reindeer; -public class TableWithContainerRequiringEqualsForItemId extends TestBase { +public class TableWithContainerRequiringEqualsForItemId extends AbstractTestUI { private MyEntityContainer container = new MyEntityContainer(); private Log log = new Log(10); @@ -44,14 +45,14 @@ public class TableWithContainerRequiringEqualsForItemId extends TestBase { } @Override - protected void setup() { + protected void setup(VaadinRequest request) { Table t = new Table("Table with 1000 item"); t.addGeneratedColumn("Actions", new Table.ColumnGenerator() { @Override public Component generateCell(final Table source, final Object itemId, final Object columnId) { Button tripFolderLink = new Button("Button" + itemId); - tripFolderLink.addListener(new Button.ClickListener() { + tripFolderLink.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent event) { log.log("Button " + event.getButton().getCaption() @@ -69,11 +70,10 @@ public class TableWithContainerRequiringEqualsForItemId extends TestBase { * 1000L)); myEntity.setId(i); container.addBean(myEntity); - // entityProvider.addEntity(myEntity); } t.setContainerDataSource(container); - t.setVisibleColumns(new String[] { "id", "created", "name", "Actions" }); + t.setVisibleColumns(new Object[] { "id", "created", "name", "Actions" }); addComponent(t); addComponent(log); @@ -83,7 +83,7 @@ public class TableWithContainerRequiringEqualsForItemId extends TestBase { } @Override - protected String getDescription() { + protected String getTestDescription() { return "Test that verifies that Table works correctly with containers which do not return the same instance of the itemId object but instead requires an itemId.equals(otherItemId) check"; } diff --git a/uitest/src/com/vaadin/tests/components/table/TableWithContainerRequiringEqualsForItemIdTest.java b/uitest/src/com/vaadin/tests/components/table/TableWithContainerRequiringEqualsForItemIdTest.java new file mode 100644 index 0000000000..1eb5cad821 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/TableWithContainerRequiringEqualsForItemIdTest.java @@ -0,0 +1,91 @@ +/* + * 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.junit.Assert.assertEquals; + +import java.util.List; + +import org.junit.Test; +import org.openqa.selenium.WebElement; + +import com.vaadin.testbench.By; +import com.vaadin.testbench.elements.TableElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * Test for a Table with a customised BeanItemContainer. + * + * @author Vaadin Ltd + */ +public class TableWithContainerRequiringEqualsForItemIdTest extends + MultiBrowserTest { + + @Test + public void testSorting() { + openTestURL(); + + TableElement table = $(TableElement.class).first(); + List<WebElement> rows = table.findElement(By.className("v-table-body")) + .findElements(By.tagName("tr")); + assertEquals("unexpect amount of rows", 46, rows.size()); + + // click the button on the first visible row + clickButton(table, 0, 3, "1. Button Button999 clicked"); + + // click the button on the last visible row + clickButton(table, 14, 3, "2. Button Button985 clicked"); + + clickTableHeaderToSort(table); + + // check the first cell of the new first visible row + checkFirstCell(table, "0"); + + // click the button on the first visible row + clickButton(table, 0, 3, "3. Button Button0 clicked"); + + // sort by the first column (descending) + clickTableHeaderToSort(table); + + // check the first cell of the new first visible row + checkFirstCell(table, "999"); + + // click the button on the first visible row + clickButton(table, 0, 3, "4. Button Button999 clicked"); + } + + private void checkFirstCell(TableElement table, String expected) { + assertEquals("unexpected contents", expected, table.getCell(0, 0) + .getText()); + } + + private void clickTableHeaderToSort(TableElement table) { + table.findElement(By.className("v-table-header")) + .findElement(By.tagName("tr")) + .findElement(By.className("v-table-caption-container")).click(); + } + + private void clickButton(TableElement table, int row, int column, + String expectedLog) { + table.getCell(row, column).findElement(By.className("v-button")) + .click(); + + // check the new log row + assertEquals("unexpected log row", expectedLog, + findElement(By.id("Log_row_0")).getText()); + } + +} diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableNegativeArraySize.html b/uitest/src/com/vaadin/tests/components/treetable/TreeTableNegativeArraySize.html deleted file mode 100644 index b57c5f978e..0000000000 --- a/uitest/src/com/vaadin/tests/components/treetable/TreeTableNegativeArraySize.html +++ /dev/null @@ -1,59 +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="" /> -<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.treetable.TreeTablePartialUpdates?restartApplication</td> - <td></td> -</tr> -<!--expand root1--> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentstreetableTreeTablePartialUpdates::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTreeTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> - <td>12,4</td> -</tr> -<tr> - <td>scroll</td> - <td>vaadin=runcomvaadintestscomponentstreetableTreeTablePartialUpdates::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTreeTable[0]/domChild[1]</td> - <td>3969</td> -</tr> -<tr> - <td>pause</td> - <td>300</td> - <td></td> -</tr> -<!--expand root2--> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentstreetableTreeTablePartialUpdates::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTreeTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[42]/domChild[0]/domChild[0]/domChild[0]</td> - <td>9,-183</td> -</tr> -<!--collapse root2--> -<tr> - <td>pause</td> - <td>1000</td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentstreetableTreeTablePartialUpdates::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTreeTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[42]/domChild[0]/domChild[0]/domChild[0]</td> - <td>11,-182</td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>root1-expanded-scrolled-to-end</td> -</tr> -</tbody></table> -</body> -</html> diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTablePartialUpdates-LongScroll.html b/uitest/src/com/vaadin/tests/components/treetable/TreeTablePartialUpdates-LongScroll.html deleted file mode 100644 index 276725e6bd..0000000000 --- a/uitest/src/com/vaadin/tests/components/treetable/TreeTablePartialUpdates-LongScroll.html +++ /dev/null @@ -1,52 +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="" /> -<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.treetable.TreeTablePartialUpdates?restartApplication</td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentstreetableTreeTablePartialUpdates::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTreeTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> - <td>12,6</td> -</tr> -<tr> - <td>scroll</td> - <td>vaadin=runcomvaadintestscomponentstreetableTreeTablePartialUpdates::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTreeTable[0]/domChild[1]</td> - <td>1692</td> -</tr> -<tr> - <td>pause</td> - <td>300</td> - <td></td> -</tr> -<!-- scroll 6000 to make sure to actually hit bottom --> -<tr> - <td>scroll</td> - <td>vaadin=runcomvaadintestscomponentstreetableTreeTablePartialUpdates::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTreeTable[0]/domChild[1]</td> - <td>6000</td> -</tr> -<tr> - <td>pause</td> - <td>300</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>treetable-long-scroll</td> -</tr> -</tbody></table> -</body> -</html> diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTablePartialUpdates.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTablePartialUpdates.java index 23eaa5dfea..78d67ee090 100644 --- a/uitest/src/com/vaadin/tests/components/treetable/TreeTablePartialUpdates.java +++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTablePartialUpdates.java @@ -2,19 +2,21 @@ package com.vaadin.tests.components.treetable; import com.vaadin.data.Container.Hierarchical; import com.vaadin.data.util.HierarchicalContainer; -import com.vaadin.tests.components.TestBase; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.ui.TreeTable; -public class TreeTablePartialUpdates extends TestBase { +public class TreeTablePartialUpdates extends AbstractTestUI { @Override - protected void setup() { + protected void setup(VaadinRequest request) { TreeTable tt = new TreeTable(); tt.setContainerDataSource(makeHierarchicalContainer()); tt.setWidth("300px"); addComponent(tt); } + @SuppressWarnings("unchecked") private Hierarchical makeHierarchicalContainer() { HierarchicalContainer hc = new HierarchicalContainer(); hc.addContainerProperty("p1", String.class, ""); @@ -42,6 +44,7 @@ public class TreeTablePartialUpdates extends TestBase { return hc; } + @SuppressWarnings("unchecked") private void addNodesToRoot(HierarchicalContainer hc, Object root, int count) { for (int ix = 0; ix < count; ix++) { Object id = hc.addItem(); @@ -51,8 +54,8 @@ public class TreeTablePartialUpdates extends TestBase { } @Override - protected String getDescription() { - return ""; + protected String getTestDescription() { + return "Tests partial updates and how they affect cached rows and scroll position."; } @Override diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTablePartialUpdatesTest.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTablePartialUpdatesTest.java new file mode 100644 index 0000000000..5a55df581c --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTablePartialUpdatesTest.java @@ -0,0 +1,196 @@ +/* + * 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 static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + +import java.io.IOException; +import java.util.List; + +import org.junit.Test; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.ui.ExpectedConditions; + +import com.vaadin.testbench.By; +import com.vaadin.testbench.commands.TestBenchElementCommands; +import com.vaadin.testbench.elements.TreeTableElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * Tests partial updates of a TreeTable. + * + * @author Vaadin Ltd + */ +public class TreeTablePartialUpdatesTest extends MultiBrowserTest { + + @Test + public void testLongScroll() throws IOException, InterruptedException { + openTestURL(); + + TreeTableElement treeTable = $(TreeTableElement.class).first(); + List<WebElement> rows = treeTable.findElement( + By.className("v-table-body")).findElements(By.tagName("tr")); + assertEquals("unexpected row count", 4, rows.size()); + + // expand the first root element + treeTable.getCell(0, 0) + .findElement(By.className("v-treetable-treespacer")).click(); + treeTable = $(TreeTableElement.class).first(); + + // wait for the scrollposition element to disappear + waitUntilNot(ExpectedConditions.visibilityOfElementLocated(By + .className("v-table-scrollposition"))); + + rows = treeTable.findElement(By.className("v-table-body")) + .findElements(By.tagName("tr")); + assertEquals("unexpected cached row count", 46, rows.size()); + + // TODO: replace these with just treeTable.scroll(int) when #13826 has + // been fixed + TestBenchElementCommands scrollable = testBenchElement(treeTable + .findElement(By.className("v-scrollable"))); + + // scroll far enough down to drop the first row from the cache + // but not far enough to reach the last row + scrollable.scroll(1692); + + // wait for the scrollposition element to disappear + waitUntilNot(ExpectedConditions.visibilityOfElementLocated(By + .className("v-table-scrollposition"))); + + assertEquals("elements found where there should be none", 0, treeTable + .findElements(By.vaadin("#row[0]/col[0]")).size()); + assertEquals("elements found where there should be none", 0, treeTable + .findElements(By.vaadin("#row[203]/col[0]")).size()); + + // scroll 6000 to make sure to actually hit bottom + scrollable.scroll(6000); + + // wait for the scrollposition element to disappear + waitUntilNot(ExpectedConditions.visibilityOfElementLocated(By + .className("v-table-scrollposition"))); + + // check the contents + treeTable = $(TreeTableElement.class).first(); + rows = treeTable.findElement(By.className("v-table-body")) + .findElements(By.tagName("tr")); + assertEquals("unexpected cached row count", 45, rows.size()); + assertEquals("unexpected cell contents (final row expected)", "END", + treeTable.getCell(203, 0).getText()); + assertEquals("unexpected cell contents (first visible row expected)", + "188", treeTable.getCell(189, 0).getText()); + assertEquals("unexpected cell contents (first cached row expected)", + "158", treeTable.getCell(159, 0).getText()); + + assertEquals("elements found where there should be none", 0, treeTable + .findElements(By.vaadin("#row[158]/col[0]")).size()); + assertEquals("elements found where there should be none", 0, treeTable + .findElements(By.vaadin("#row[204]/col[0]")).size()); + + // check the actual visibility + compareScreen("bottom"); + } + + @Test + public void testNegativeArraySize() throws IOException, + InterruptedException { + openTestURL(); + + TreeTableElement treeTable = $(TreeTableElement.class).first(); + List<WebElement> rows = treeTable.findElement( + By.className("v-table-body")).findElements(By.tagName("tr")); + assertEquals("unexpected row count", 4, rows.size()); + + // expand the first root element + treeTable.getCell(0, 0) + .findElement(By.className("v-treetable-treespacer")).click(); + + // wait for the scrollposition element to disappear + waitUntilNot(ExpectedConditions.visibilityOfElementLocated(By + .className("v-table-scrollposition"))); + + treeTable = $(TreeTableElement.class).first(); + rows = treeTable.findElement(By.className("v-table-body")) + .findElements(By.tagName("tr")); + assertEquals("unexpected cached row count", 46, rows.size()); + + // TODO: replace these with just treeTable.scroll(int) when #13826 has + // been fixed + TestBenchElementCommands scrollable = testBenchElement(treeTable + .findElement(By.className("v-scrollable"))); + + // scroll far enough down to reach the second root item again + scrollable.scroll(3969); + + // wait for the scrollposition element to disappear + waitUntilNot(ExpectedConditions.visibilityOfElementLocated(By + .className("v-table-scrollposition"))); + + assertEquals("elements found where there should be none", 0, treeTable + .findElements(By.vaadin("#row[0]/col[0]")).size()); + assertEquals("unexpected cell contents", "root2", + treeTable.getCell(201, 0).getText()); + assertEquals("unexpected cell contents", "END", + treeTable.getCell(203, 0).getText()); + + // expand the second root element + treeTable.getCell(201, 0) + .findElement(By.className("v-treetable-treespacer")).click(); + + // wait for the scrollposition element to disappear + waitUntilNot(ExpectedConditions.visibilityOfElementLocated(By + .className("v-table-scrollposition"))); + + // ensure the last cached row isn't the final row + treeTable = $(TreeTableElement.class).first(); + rows = treeTable.findElement(By.className("v-table-body")) + .findElements(By.tagName("tr")); + String elementText = rows.get(rows.size() - 1) + .findElement(By.className("v-table-cell-wrapper")).getText(); + assertFalse("final row found when it should be beyond cache", + elementText.contains("END")); + + // collapse the second root element + treeTable.getCell(201, 0) + .findElement(By.className("v-treetable-treespacer")).click(); + + // wait for the scrollposition element to disappear + waitUntilNot(ExpectedConditions.visibilityOfElementLocated(By + .className("v-table-scrollposition"))); + + // check the contents + treeTable = $(TreeTableElement.class).first(); + rows = treeTable.findElement(By.className("v-table-body")) + .findElements(By.tagName("tr")); + assertEquals("unexpected cached row count", 45, rows.size()); + assertEquals("unexpected cell contents (final row expected)", "END", + treeTable.getCell(203, 0).getText()); + assertEquals("unexpected cell contents (first visible row expected)", + "188", treeTable.getCell(189, 0).getText()); + assertEquals("unexpected cell contents (first cached row expected)", + "158", treeTable.getCell(159, 0).getText()); + + assertEquals("elements found where there should be none", 0, treeTable + .findElements(By.vaadin("#row[158]/col[0]")).size()); + assertEquals("elements found where there should be none", 0, treeTable + .findElements(By.vaadin("#row[204]/col[0]")).size()); + + // check the actual visibility + compareScreen("bottom"); + } + +} diff --git a/uitest/src/com/vaadin/tests/tb3/ScreenshotTB3Test.java b/uitest/src/com/vaadin/tests/tb3/ScreenshotTB3Test.java index 1782e0042e..a99eea9bf6 100644 --- a/uitest/src/com/vaadin/tests/tb3/ScreenshotTB3Test.java +++ b/uitest/src/com/vaadin/tests/tb3/ScreenshotTB3Test.java @@ -180,9 +180,20 @@ public abstract class ScreenshotTB3Test extends AbstractTB3Test { * given reference image fails. */ private File getErrorFileFromReference(File referenceFile) { - return new File(referenceFile.getAbsolutePath().replace( - getScreenshotReferenceDirectory(), - getScreenshotErrorDirectory())); + + String absolutePath = referenceFile.getAbsolutePath(); + String screenshotReferenceDirectory = getScreenshotReferenceDirectory(); + String screenshotErrorDirectory = getScreenshotErrorDirectory(); + // We throw an exception to safeguard against accidental reference + // deletion. See (#14446) + if (!absolutePath.contains(screenshotReferenceDirectory)) { + throw new IllegalStateException( + "Reference screenshot not in reference directory. Screenshot path: '" + + absolutePath + "', directory path: '" + + screenshotReferenceDirectory + "'"); + } + return new File(absolutePath.replace(screenshotReferenceDirectory, + screenshotErrorDirectory)); } /** @@ -248,11 +259,23 @@ public abstract class ScreenshotTB3Test extends AbstractTB3Test { protected abstract String getScreenshotDirectory(); /** + * @return the base directory of 'reference' and 'errors' screenshots with a + * trailing file separator + */ + private String getScreenshotDirectoryWithTrailingSeparator() { + String screenshotDirectory = getScreenshotDirectory(); + if (!screenshotDirectory.endsWith(File.separator)) { + screenshotDirectory += File.separator; + } + return screenshotDirectory; + } + + /** * @return the directory where reference images are stored (the 'reference' * folder inside the screenshot directory) */ private String getScreenshotReferenceDirectory() { - return getScreenshotDirectory() + "/reference"; + return getScreenshotDirectoryWithTrailingSeparator() + "reference"; } /** @@ -260,7 +283,7 @@ public abstract class ScreenshotTB3Test extends AbstractTB3Test { * (the 'errors' folder inside the screenshot directory) */ private String getScreenshotErrorDirectory() { - return getScreenshotDirectory() + "/errors"; + return getScreenshotDirectoryWithTrailingSeparator() + "errors"; } /** @@ -366,7 +389,7 @@ public abstract class ScreenshotTB3Test extends AbstractTB3Test { } // WindowMaximizeRestoreTest_Windows_InternetExplorer_8_window-1-moved-maximized-restored.png - return getScreenshotReferenceDirectory() + "/" + return getScreenshotReferenceDirectory() + File.separator + getScreenshotBaseName() + "_" + uniqueBrowserIdentifier + "_" + identifier + ".png"; } @@ -399,13 +422,12 @@ public abstract class ScreenshotTB3Test extends AbstractTB3Test { errorDirectory.mkdirs(); } - final String errorBase = getScreenshotErrorBaseName() - .replace("\\", "/"); + final String errorBase = getScreenshotErrorBaseName(); File[] files = errorDirectory.listFiles(new FileFilter() { @Override public boolean accept(File pathname) { - String thisFile = pathname.getAbsolutePath().replace("\\", "/"); + String thisFile = pathname.getAbsolutePath(); if (thisFile.startsWith(errorBase)) { return true; } diff --git a/uitest/src/com/vaadin/tests/themes/valo/Tables.java b/uitest/src/com/vaadin/tests/themes/valo/Tables.java index 62ef67f9f3..fb6638ee7d 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/Tables.java +++ b/uitest/src/com/vaadin/tests/themes/valo/Tables.java @@ -26,9 +26,14 @@ import com.vaadin.navigator.View; import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; import com.vaadin.ui.Button; import com.vaadin.ui.CheckBox; +import com.vaadin.ui.ComboBox; +import com.vaadin.ui.DateField; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; import com.vaadin.ui.Notification; +import com.vaadin.ui.OptionGroup; +import com.vaadin.ui.ProgressBar; +import com.vaadin.ui.Slider; import com.vaadin.ui.Table; import com.vaadin.ui.Table.Align; import com.vaadin.ui.Table.ColumnGenerator; @@ -56,8 +61,9 @@ public class Tables extends VerticalLayout implements View { CheckBox compact = new CheckBox("Compact"); CheckBox small = new CheckBox("Small"); CheckBox rowIndex = new CheckBox("Row index", false); - CheckBox rowIcon = new CheckBox("Row icon", true); + CheckBox rowIcon = new CheckBox("Row icon", false); CheckBox rowCaption = new CheckBox("Row caption", false); + CheckBox componentsInCells = new CheckBox("Components in Cells", false); Table table; @@ -76,7 +82,7 @@ public class Tables extends VerticalLayout implements View { wrap.addComponents(hierarchical, footer, sized, expandRatios, stripes, verticalLines, horizontalLines, borderless, headers, compact, - small, rowIndex, rowCaption, rowIcon); + small, rowIndex, rowCaption, rowIcon, componentsInCells); ValueChangeListener update = new ValueChangeListener() { @Override @@ -105,7 +111,7 @@ public class Tables extends VerticalLayout implements View { borderless.getValue(), headers.getValue(), compact.getValue(), small.getValue(), rowIndex.getValue(), rowCaption.getValue(), - rowIcon.getValue()); + rowIcon.getValue(), componentsInCells.getValue()); } }; @@ -123,6 +129,7 @@ public class Tables extends VerticalLayout implements View { rowIndex.addValueChangeListener(update); rowCaption.addValueChangeListener(update); rowIcon.addValueChangeListener(update); + componentsInCells.addValueChangeListener(update); footer.setValue(false); @@ -132,7 +139,7 @@ public class Tables extends VerticalLayout implements View { boolean expandRatios, boolean stripes, boolean verticalLines, boolean horizontalLines, boolean borderless, boolean headers, boolean compact, boolean small, boolean rowIndex, - boolean rowCaption, boolean rowIcon) { + boolean rowCaption, boolean rowIcon, boolean componentsInRows) { table.setSelectable(true); table.setMultiSelect(true); table.setSortEnabled(true); @@ -156,32 +163,137 @@ public class Tables extends VerticalLayout implements View { table.setColumnAlignment(ValoThemeUI.INDEX_PROPERTY, Align.CENTER); table.removeContainerProperty("textfield"); - table.addContainerProperty("textfield", TextField.class, null); - table.removeGeneratedColumn("textfield"); - table.addGeneratedColumn("textfield", new ColumnGenerator() { - @Override - public Object generateCell(Table source, Object itemId, - Object columnId) { - TextField tf = new TextField(); - tf.setInputPrompt("Type here…"); - return tf; - } - }); - table.removeContainerProperty("button"); - table.addContainerProperty("button", Button.class, null); - table.removeGeneratedColumn("button"); - table.addGeneratedColumn("button", new ColumnGenerator() { - @Override - public Object generateCell(Table source, Object itemId, - Object columnId) { - Button b = new Button("Button"); - return b; - } - }); - + table.removeContainerProperty("label"); + table.removeGeneratedColumn("label"); + table.removeContainerProperty("checkbox"); + table.removeGeneratedColumn("checkbox"); + table.removeContainerProperty("datefield"); + table.removeGeneratedColumn("datefield"); + table.removeContainerProperty("combobox"); + table.removeGeneratedColumn("combobox"); + table.removeContainerProperty("optiongroup"); + table.removeGeneratedColumn("optiongroup"); + table.removeContainerProperty("slider"); + table.removeGeneratedColumn("slider"); + table.removeContainerProperty("progress"); + table.removeGeneratedColumn("progress"); + + if (componentsInRows) { + table.addContainerProperty("textfield", TextField.class, null); + table.addGeneratedColumn("textfield", new ColumnGenerator() { + @Override + public Object generateCell(Table source, Object itemId, + Object columnId) { + TextField tf = new TextField(); + tf.setInputPrompt("Type here…"); + // tf.addStyleName("compact"); + if ((Integer) itemId % 2 == 0) { + tf.addStyleName("borderless"); + } + return tf; + } + }); + + table.addContainerProperty("datefield", TextField.class, null); + table.addGeneratedColumn("datefield", new ColumnGenerator() { + @Override + public Object generateCell(Table source, Object itemId, + Object columnId) { + DateField tf = new DateField(); + tf.addStyleName("compact"); + if ((Integer) itemId % 2 == 0) { + tf.addStyleName("borderless"); + } + return tf; + } + }); + + table.addContainerProperty("combobox", TextField.class, null); + table.addGeneratedColumn("combobox", new ColumnGenerator() { + @Override + public Object generateCell(Table source, Object itemId, + Object columnId) { + ComboBox tf = new ComboBox(); + tf.setInputPrompt("Select"); + tf.addStyleName("compact"); + if ((Integer) itemId % 2 == 0) { + tf.addStyleName("borderless"); + } + return tf; + } + }); + + table.addContainerProperty("button", Button.class, null); + table.addGeneratedColumn("button", new ColumnGenerator() { + @Override + public Object generateCell(Table source, Object itemId, + Object columnId) { + Button b = new Button("Button"); + b.addStyleName("small"); + return b; + } + }); + + table.addContainerProperty("label", TextField.class, null); + table.addGeneratedColumn("label", new ColumnGenerator() { + @Override + public Object generateCell(Table source, Object itemId, + Object columnId) { + Label label = new Label("Label component"); + label.setSizeUndefined(); + label.addStyleName("bold"); + return label; + } + }); + + table.addContainerProperty("checkbox", TextField.class, null); + table.addGeneratedColumn("checkbox", new ColumnGenerator() { + @Override + public Object generateCell(Table source, Object itemId, + Object columnId) { + CheckBox cb = new CheckBox(null, true); + return cb; + } + }); + + table.addContainerProperty("optiongroup", TextField.class, null); + table.addGeneratedColumn("optiongroup", new ColumnGenerator() { + @Override + public Object generateCell(Table source, Object itemId, + Object columnId) { + OptionGroup op = new OptionGroup(); + op.addItem("Male"); + op.addItem("Female"); + op.addStyleName("horizontal"); + return op; + } + }); + + table.addContainerProperty("slider", TextField.class, null); + table.addGeneratedColumn("slider", new ColumnGenerator() { + @Override + public Object generateCell(Table source, Object itemId, + Object columnId) { + Slider s = new Slider(); + s.setValue(30.0); + return s; + } + }); + + table.addContainerProperty("progress", TextField.class, null); + table.addGeneratedColumn("progress", new ColumnGenerator() { + @Override + public Object generateCell(Table source, Object itemId, + Object columnId) { + ProgressBar bar = new ProgressBar(); + bar.setValue(0.7f); + return bar; + } + }); + } table.setFooterVisible(footer); if (footer) { table.setColumnFooter(ValoThemeUI.CAPTION_PROPERTY, "caption"); diff --git a/uitest/src/com/vaadin/tests/themes/valo/ValoMiscTests.java b/uitest/src/com/vaadin/tests/themes/valo/ValoMiscTests.java index 1676d121af..b59c500d28 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/ValoMiscTests.java +++ b/uitest/src/com/vaadin/tests/themes/valo/ValoMiscTests.java @@ -72,7 +72,7 @@ public class ValoMiscTests extends UI { table.setWidth("100%"); table.setContainerDataSource(ValoThemeUI.generateContainer(200, true)); Tables.configure(table, true, false, false, true, true, true, false, - true, false, false, false, false, false); + true, false, false, false, false, false, false); layout.addComponent(table); } diff --git a/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java b/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java index 501b5f573b..62d76569dd 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java +++ b/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java @@ -71,6 +71,7 @@ public class ValoThemeUI extends UI { themeVariants.put("tests-valo-facebook", "Facebook"); themeVariants.put("tests-valo-flatdark", "Flat dark"); themeVariants.put("tests-valo-flat", "Flat"); + themeVariants.put("tests-valo-light", "Light"); themeVariants.put("tests-valo-metro", "Metro"); } private TestIcon testIcon = new TestIcon(100); @@ -89,6 +90,16 @@ public class ValoThemeUI extends UI { protected void init(VaadinRequest request) { if (request.getParameter("test") != null) { testMode = true; + + if (browserCantRenderFontsConsistently()) { + getPage().getStyles().add( + ".v-app.v-app.v-app {font-family: Sans-Serif;}"); + } + } + + if (getPage().getWebBrowser().isIE() + && getPage().getWebBrowser().getBrowserMajorVersion() == 9) { + menu.setWidth("320px"); } // Show .v-app-loading valo-menu-badge // try { @@ -97,7 +108,9 @@ public class ValoThemeUI extends UI { // e.printStackTrace(); // } - Responsive.makeResponsive(this); + if (!testMode) { + Responsive.makeResponsive(this); + } getPage().setTitle("Valo Theme Test"); setContent(root); @@ -167,6 +180,19 @@ public class ValoThemeUI extends UI { } + private boolean browserCantRenderFontsConsistently() { + // PhantomJS renders font correctly about 50% of the time, so + // disable it to have consistent screenshots + // https://github.com/ariya/phantomjs/issues/10592 + + // IE8 also has randomness in its font rendering... + + return getPage().getWebBrowser().getBrowserApplication() + .contains("PhantomJS") + || (getPage().getWebBrowser().isIE() && getPage() + .getWebBrowser().getBrowserMajorVersion() <= 9); + } + static boolean isTestMode() { return ((ValoThemeUI) getCurrent()).testMode; } @@ -440,4 +466,4 @@ public class ValoThemeUI extends UI { } return container; } -}
\ No newline at end of file +} diff --git a/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUITest.java b/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUITest.java index fdb2eabeee..b5b7e16b34 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUITest.java +++ b/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUITest.java @@ -20,6 +20,7 @@ import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.CheckBoxElement; import com.vaadin.testbench.elements.CssLayoutElement; import com.vaadin.testbench.elements.LabelElement; import com.vaadin.testbench.elements.TreeElement; @@ -127,6 +128,7 @@ public class ValoThemeUITest extends MultiBrowserTest { public void tables() throws Exception { openTestURL("test"); open("Tables"); + check("Components in Cells"); compareScreen("tables"); } @@ -156,6 +158,64 @@ public class ValoThemeUITest extends MultiBrowserTest { openTestURL("test"); open("Tabs <span class=\"valo-menu-badge\">123</span>", "Tabs"); compareScreen("tabs"); + + } + + @Test + public void tabsClosable() throws Exception { + openTestURL("test"); + open("Tabs <span class=\"valo-menu-badge\">123</span>", "Tabs"); + check("Closable"); + check("Disable tabs"); + check("Overflow"); + compareScreen("tabs-closable-disabled"); + } + + @Test + public void tabsAlignRight() throws Exception { + openTestURL("test"); + open("Tabs <span class=\"valo-menu-badge\">123</span>", "Tabs"); + check("Right-aligned tabs"); + compareScreen("tabs-align-right"); + } + + /** + * workaround for http://dev.vaadin.com/ticket/13763 + */ + private void check(String caption) { + WebElement cb = $(CheckBoxElement.class).caption(caption).first() + .findElement(By.xpath("input")); + if (BrowserUtil.isChrome(getDesiredCapabilities())) { + testBenchElement(cb).click(0, 0); + } else { + cb.click(); + } + } + + @Test + public void tabsAlignCenter() throws Exception { + openTestURL("test"); + open("Tabs <span class=\"valo-menu-badge\">123</span>", "Tabs"); + check("Centered tabs"); + compareScreen("tabs-align-center"); + } + + @Test + public void tabsIconsOnTop() throws Exception { + openTestURL("test"); + open("Tabs <span class=\"valo-menu-badge\">123</span>", "Tabs"); + check("Icons on top"); + compareScreen("tabs-icons-on-top"); + } + + @Test + public void tabsEqualCompactPadded() throws Exception { + openTestURL("test"); + open("Tabs <span class=\"valo-menu-badge\">123</span>", "Tabs"); + check("Equal-width tabs"); + check("Padded tabbar"); + check("Compact"); + compareScreen("tabs-equal-compact-padded"); } @Test |