From aa25700c8aa2ae974e1c9e3ce3230335d8309814 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 4 Aug 2014 14:20:25 +0300 Subject: Split test theme into separate themes and added theme selector Change-Id: I076a05a393ae85bb68983eaa2756d36a0e92014e --- .../themes/tests-valo-blueprint/_variables.scss | 20 ++ .../VAADIN/themes/tests-valo-blueprint/styles.scss | 6 + .../VAADIN/themes/tests-valo-dark/_variables.scss | 18 + .../VAADIN/themes/tests-valo-dark/styles.scss | 6 + .../themes/tests-valo-facebook/_variables.scss | 24 ++ .../VAADIN/themes/tests-valo-facebook/styles.scss | 6 + .../VAADIN/themes/tests-valo-flat/_variables.scss | 43 +++ .../VAADIN/themes/tests-valo-flat/styles.scss | 6 + .../themes/tests-valo-flatdark/_variables.scss | 20 ++ .../VAADIN/themes/tests-valo-flatdark/styles.scss | 6 + .../VAADIN/themes/tests-valo-metro/_variables.scss | 26 ++ .../VAADIN/themes/tests-valo-metro/styles.scss | 6 + .../VAADIN/themes/tests-valo/_blueprint.scss | 20 -- WebContent/VAADIN/themes/tests-valo/_dark.scss | 18 - WebContent/VAADIN/themes/tests-valo/_default.scss | 3 - WebContent/VAADIN/themes/tests-valo/_facebook.scss | 24 -- .../VAADIN/themes/tests-valo/_flat-dark.scss | 20 -- WebContent/VAADIN/themes/tests-valo/_flat.scss | 43 --- WebContent/VAADIN/themes/tests-valo/_metro.scss | 26 -- WebContent/VAADIN/themes/tests-valo/_valotest.scss | 118 ++++++ .../VAADIN/themes/tests-valo/_variables.scss | 3 + WebContent/VAADIN/themes/tests-valo/styles.scss | 128 +------ .../com/vaadin/tests/themes/valo/Accordions.java | 6 +- .../com/vaadin/tests/themes/valo/ComboBoxes.java | 32 +- uitest/src/com/vaadin/tests/themes/valo/Forms.java | 16 +- .../src/com/vaadin/tests/themes/valo/Tables.java | 36 +- .../com/vaadin/tests/themes/valo/Tabsheets.java | 4 +- .../src/com/vaadin/tests/themes/valo/TestIcon.java | 8 +- uitest/src/com/vaadin/tests/themes/valo/Trees.java | 8 +- .../vaadin/tests/themes/valo/ValoMiscTests.java | 8 +- .../vaadin/tests/themes/valo/ValoThemeTest.java | 364 ------------------- .../com/vaadin/tests/themes/valo/ValoThemeUI.java | 397 +++++++++++++++++++++ 32 files changed, 766 insertions(+), 703 deletions(-) create mode 100644 WebContent/VAADIN/themes/tests-valo-blueprint/_variables.scss create mode 100644 WebContent/VAADIN/themes/tests-valo-blueprint/styles.scss create mode 100644 WebContent/VAADIN/themes/tests-valo-dark/_variables.scss create mode 100644 WebContent/VAADIN/themes/tests-valo-dark/styles.scss create mode 100644 WebContent/VAADIN/themes/tests-valo-facebook/_variables.scss create mode 100644 WebContent/VAADIN/themes/tests-valo-facebook/styles.scss create mode 100644 WebContent/VAADIN/themes/tests-valo-flat/_variables.scss create mode 100644 WebContent/VAADIN/themes/tests-valo-flat/styles.scss create mode 100644 WebContent/VAADIN/themes/tests-valo-flatdark/_variables.scss create mode 100644 WebContent/VAADIN/themes/tests-valo-flatdark/styles.scss create mode 100644 WebContent/VAADIN/themes/tests-valo-metro/_variables.scss create mode 100644 WebContent/VAADIN/themes/tests-valo-metro/styles.scss delete mode 100644 WebContent/VAADIN/themes/tests-valo/_blueprint.scss delete mode 100644 WebContent/VAADIN/themes/tests-valo/_dark.scss delete mode 100644 WebContent/VAADIN/themes/tests-valo/_default.scss delete mode 100644 WebContent/VAADIN/themes/tests-valo/_facebook.scss delete mode 100644 WebContent/VAADIN/themes/tests-valo/_flat-dark.scss delete mode 100644 WebContent/VAADIN/themes/tests-valo/_flat.scss delete mode 100644 WebContent/VAADIN/themes/tests-valo/_metro.scss create mode 100644 WebContent/VAADIN/themes/tests-valo/_valotest.scss create mode 100644 WebContent/VAADIN/themes/tests-valo/_variables.scss delete mode 100644 uitest/src/com/vaadin/tests/themes/valo/ValoThemeTest.java create mode 100644 uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java diff --git a/WebContent/VAADIN/themes/tests-valo-blueprint/_variables.scss b/WebContent/VAADIN/themes/tests-valo-blueprint/_variables.scss new file mode 100644 index 0000000000..696da0b69e --- /dev/null +++ b/WebContent/VAADIN/themes/tests-valo-blueprint/_variables.scss @@ -0,0 +1,20 @@ +$v-app-loading-text: "Blueprint Valo"; +$v-background-color: #1a61b7; +$v-focus-color: #fff; +$v-panel-background-color: $v-background-color; +$v-overlay-background-color: $v-background-color; +$valo-menu-background-color: $v-background-color; +$v-overlay-shadow: 0 0 0 1px rgba(#fff, .5); +$v-window-shadow: $v-overlay-shadow; +$v-window-modality-curtain-background-color: $v-background-color; +$v-bevel: false; +$v-gradient: false; +$v-shadow: false; +$v-textfield-bevel: false; +$v-textfield-shadow: false; +$v-border: 1px solid (v-tint 1.5); +$v-textfield-background-color: $v-background-color; +$v-font-family: sans-serif; +$v-font-size: 18px; + +@import "../valo/valo"; diff --git a/WebContent/VAADIN/themes/tests-valo-blueprint/styles.scss b/WebContent/VAADIN/themes/tests-valo-blueprint/styles.scss new file mode 100644 index 0000000000..9433f4eba6 --- /dev/null +++ b/WebContent/VAADIN/themes/tests-valo-blueprint/styles.scss @@ -0,0 +1,6 @@ +@import "variables"; +@import "../tests-valo/valotest"; + +.tests-valo-blueprint { + @include valotest; +} diff --git a/WebContent/VAADIN/themes/tests-valo-dark/_variables.scss b/WebContent/VAADIN/themes/tests-valo-dark/_variables.scss new file mode 100644 index 0000000000..21bcd00ae9 --- /dev/null +++ b/WebContent/VAADIN/themes/tests-valo-dark/_variables.scss @@ -0,0 +1,18 @@ +$v-app-loading-text: "Dark Valo"; +$v-background-color: #444d50; +$v-focus-color: #07a9ca; +$v-focus-style: 0 0 3px 2px $v-focus-color; +$v-bevel-depth: 40%; +$v-gradient: v-linear 12%; +$v-border-radius: 10px; +$v-font-family: Roboto, sans-serif; +$v-font-weight: 400; +$v-font-weight--header: 400; +$v-bevel: inset 0 1px 2px v-tint, inset 0 0 1px (v-tint 0.1); +$v-shadow: 0 0 0 3px darken($v-background-color, 3%), 0 1px 1px 3px lighten($v-background-color, 5%); +$v-textfield-bevel: inset 0 2px 2px v-shade; +$v-textfield-shadow: $v-shadow; +$v-unit-size: 40px; +$v-overlay-shadow: 0 0 0 3px (v-shade 8), 0 5px 10px (v-shade 4); + +@import "../valo/valo"; diff --git a/WebContent/VAADIN/themes/tests-valo-dark/styles.scss b/WebContent/VAADIN/themes/tests-valo-dark/styles.scss new file mode 100644 index 0000000000..13f98ae418 --- /dev/null +++ b/WebContent/VAADIN/themes/tests-valo-dark/styles.scss @@ -0,0 +1,6 @@ +@import "variables"; +@import "../tests-valo/valotest"; + +.tests-valo-dark { + @include valotest; +} diff --git a/WebContent/VAADIN/themes/tests-valo-facebook/_variables.scss b/WebContent/VAADIN/themes/tests-valo-facebook/_variables.scss new file mode 100644 index 0000000000..5b83aae4ca --- /dev/null +++ b/WebContent/VAADIN/themes/tests-valo-facebook/_variables.scss @@ -0,0 +1,24 @@ +$v-app-loading-text: "Facebook Valo"; +$v-background-color: #fafafa; +$v-app-background-color: #e7ebf2; +$v-panel-background-color: #fff; +$v-focus-color: #3b5998; +$v-focus-style: 0 0 1px 1px rgba($v-focus-color, .5); +$v-border-radius: 3px; +$v-textfield-border-radius: 0; +$v-font-family: Helvetica, Arial, 'lucida grande', tahoma, verdana, arial, sans-serif; +$v-font-size: 14px; +$v-font-color: #37404E; +$v-font-weight: 400; +$v-link-text-decoration: none; +$v-shadow: 0 1px 0 (v-shade 0.2); +$v-bevel: inset 0 1px 0 v-tint; +$v-unit-size: 30px; +$v-gradient: v-linear 12%; +$v-overlay-shadow: 0 3px 8px v-shade, 0 0 0 1px (v-shade 0.7); +$v-shadow-opacity: 20%; +$v-selection-overlay-padding-horizontal: 0; +$v-selection-overlay-padding-vertical: 6px; +$v-selection-item-border-radius: 0; + +@import "../valo/valo"; diff --git a/WebContent/VAADIN/themes/tests-valo-facebook/styles.scss b/WebContent/VAADIN/themes/tests-valo-facebook/styles.scss new file mode 100644 index 0000000000..7b784627b2 --- /dev/null +++ b/WebContent/VAADIN/themes/tests-valo-facebook/styles.scss @@ -0,0 +1,6 @@ +@import "variables"; +@import "../tests-valo/valotest"; + +.tests-valo-facebook { + @include valotest; +} diff --git a/WebContent/VAADIN/themes/tests-valo-flat/_variables.scss b/WebContent/VAADIN/themes/tests-valo-flat/_variables.scss new file mode 100644 index 0000000000..5d2b8abbb7 --- /dev/null +++ b/WebContent/VAADIN/themes/tests-valo-flat/_variables.scss @@ -0,0 +1,43 @@ +$v-app-loading-text: "Flat Valo"; + +$v-font-family: "Roboto", sans-serif; +$v-font-weight: 400; +$v-font-weight--header: 400; +$v-background-color: #fff; +$v-focus-color: rgb(150,190,90); +$v-luminance-threshold: 180; +$v-border: 2px solid v-shade; +$v-border-radius: 6px; +$v-bevel: false; +$v-gradient: false; +$v-shadow: false; +$v-textfield-bevel: false; +$v-textfield-shadow: false; +$v-link-text-decoration: false; +$v-selection-overlay-padding-horizontal: 0; +$v-selection-overlay-padding-vertical: 6px; +$v-selection-item-height: 30px; +$v-selection-item-border-radius: 0; + + +@import "../valo/valo"; + + +.valo-test { + .v-button-primary.v-button-primary { + background: #fff; + border-color: $v-focus-color; + color: $v-focus-color; + } + + .v-button-danger.v-button-danger { + background: #fff; + border-color: $v-error-indicator-color; + color: $v-error-indicator-color; + } + + .v-slider-base:before, + .v-slider-base:after { + border: none !important; + } +} diff --git a/WebContent/VAADIN/themes/tests-valo-flat/styles.scss b/WebContent/VAADIN/themes/tests-valo-flat/styles.scss new file mode 100644 index 0000000000..7b981de04a --- /dev/null +++ b/WebContent/VAADIN/themes/tests-valo-flat/styles.scss @@ -0,0 +1,6 @@ +@import "variables"; +@import "../tests-valo/valotest"; + +.tests-valo-flat { + @include valotest; +} diff --git a/WebContent/VAADIN/themes/tests-valo-flatdark/_variables.scss b/WebContent/VAADIN/themes/tests-valo-flatdark/_variables.scss new file mode 100644 index 0000000000..f68f9c266d --- /dev/null +++ b/WebContent/VAADIN/themes/tests-valo-flatdark/_variables.scss @@ -0,0 +1,20 @@ +$v-app-loading-text: "Dark & Flat Valo"; + +$v-background-color: #000; +$v-focus-color: orange; +$v-font-size: 15px; +$v-font-weight: 600; +$v-unit-size: 42px; +$v-bevel: false; +$v-shadow: false; +$v-gradient: false; +$v-textfield-bevel: false; +$v-textfield-shadow: false; +$v-border-radius: 0; +$v-border: 2px solid v-tone; +$v-overlay-shadow: 0 0 0 2px (v-tint 10); +$v-focus-style: $v-focus-color; +$v-font-family: "Lato", sans-serif; +$v-font-weight--header: 600; + +@import "../valo/valo"; diff --git a/WebContent/VAADIN/themes/tests-valo-flatdark/styles.scss b/WebContent/VAADIN/themes/tests-valo-flatdark/styles.scss new file mode 100644 index 0000000000..d0871fcba2 --- /dev/null +++ b/WebContent/VAADIN/themes/tests-valo-flatdark/styles.scss @@ -0,0 +1,6 @@ +@import "variables"; +@import "../tests-valo/valotest"; + +.tests-valo-flatdark { + @include valotest; +} diff --git a/WebContent/VAADIN/themes/tests-valo-metro/_variables.scss b/WebContent/VAADIN/themes/tests-valo-metro/_variables.scss new file mode 100644 index 0000000000..f11cdb8b64 --- /dev/null +++ b/WebContent/VAADIN/themes/tests-valo-metro/_variables.scss @@ -0,0 +1,26 @@ +$v-app-loading-text: "Metro Valo"; + +$v-font-family: "Source Sans Pro", sans-serif; +$v-app-background-color: #fff; +$v-background-color: #eee; +$v-focus-color: #0072C6; +$v-focus-style: 0 0 0 1px $v-focus-color; +$valo-menu-background-color: darken($v-focus-color, 10%); +$v-border: 0 solid v-shade; +$v-border-radius: 0px; +$v-bevel: false; +$v-gradient: false; +$v-shadow: false; +$v-textfield-bevel: false; +$v-textfield-shadow: false; +$v-textfield-border: 1px solid v-shade; +$v-link-text-decoration: none; +$v-overlay-shadow: 0 0 0 2px #000; +$v-overlay-border-width: 2px; // For IE8 +$v-window-shadow: $v-overlay-shadow; +$v-selection-overlay-background-color: #fff; +$v-selection-overlay-padding-horizontal: 0; +$v-selection-overlay-padding-vertical: 6px; +$v-panel-border: 2px solid v-shade; + +@import "../valo/valo"; diff --git a/WebContent/VAADIN/themes/tests-valo-metro/styles.scss b/WebContent/VAADIN/themes/tests-valo-metro/styles.scss new file mode 100644 index 0000000000..51b3427a12 --- /dev/null +++ b/WebContent/VAADIN/themes/tests-valo-metro/styles.scss @@ -0,0 +1,6 @@ +@import "variables"; +@import "../tests-valo/valotest"; + +.tests-valo-metro { + @include valotest; +} diff --git a/WebContent/VAADIN/themes/tests-valo/_blueprint.scss b/WebContent/VAADIN/themes/tests-valo/_blueprint.scss deleted file mode 100644 index 696da0b69e..0000000000 --- a/WebContent/VAADIN/themes/tests-valo/_blueprint.scss +++ /dev/null @@ -1,20 +0,0 @@ -$v-app-loading-text: "Blueprint Valo"; -$v-background-color: #1a61b7; -$v-focus-color: #fff; -$v-panel-background-color: $v-background-color; -$v-overlay-background-color: $v-background-color; -$valo-menu-background-color: $v-background-color; -$v-overlay-shadow: 0 0 0 1px rgba(#fff, .5); -$v-window-shadow: $v-overlay-shadow; -$v-window-modality-curtain-background-color: $v-background-color; -$v-bevel: false; -$v-gradient: false; -$v-shadow: false; -$v-textfield-bevel: false; -$v-textfield-shadow: false; -$v-border: 1px solid (v-tint 1.5); -$v-textfield-background-color: $v-background-color; -$v-font-family: sans-serif; -$v-font-size: 18px; - -@import "../valo/valo"; diff --git a/WebContent/VAADIN/themes/tests-valo/_dark.scss b/WebContent/VAADIN/themes/tests-valo/_dark.scss deleted file mode 100644 index 21bcd00ae9..0000000000 --- a/WebContent/VAADIN/themes/tests-valo/_dark.scss +++ /dev/null @@ -1,18 +0,0 @@ -$v-app-loading-text: "Dark Valo"; -$v-background-color: #444d50; -$v-focus-color: #07a9ca; -$v-focus-style: 0 0 3px 2px $v-focus-color; -$v-bevel-depth: 40%; -$v-gradient: v-linear 12%; -$v-border-radius: 10px; -$v-font-family: Roboto, sans-serif; -$v-font-weight: 400; -$v-font-weight--header: 400; -$v-bevel: inset 0 1px 2px v-tint, inset 0 0 1px (v-tint 0.1); -$v-shadow: 0 0 0 3px darken($v-background-color, 3%), 0 1px 1px 3px lighten($v-background-color, 5%); -$v-textfield-bevel: inset 0 2px 2px v-shade; -$v-textfield-shadow: $v-shadow; -$v-unit-size: 40px; -$v-overlay-shadow: 0 0 0 3px (v-shade 8), 0 5px 10px (v-shade 4); - -@import "../valo/valo"; diff --git a/WebContent/VAADIN/themes/tests-valo/_default.scss b/WebContent/VAADIN/themes/tests-valo/_default.scss deleted file mode 100644 index c227156e2e..0000000000 --- a/WebContent/VAADIN/themes/tests-valo/_default.scss +++ /dev/null @@ -1,3 +0,0 @@ -$v-app-loading-text: "Default Valo"; - -@import "../valo/valo"; diff --git a/WebContent/VAADIN/themes/tests-valo/_facebook.scss b/WebContent/VAADIN/themes/tests-valo/_facebook.scss deleted file mode 100644 index 5b83aae4ca..0000000000 --- a/WebContent/VAADIN/themes/tests-valo/_facebook.scss +++ /dev/null @@ -1,24 +0,0 @@ -$v-app-loading-text: "Facebook Valo"; -$v-background-color: #fafafa; -$v-app-background-color: #e7ebf2; -$v-panel-background-color: #fff; -$v-focus-color: #3b5998; -$v-focus-style: 0 0 1px 1px rgba($v-focus-color, .5); -$v-border-radius: 3px; -$v-textfield-border-radius: 0; -$v-font-family: Helvetica, Arial, 'lucida grande', tahoma, verdana, arial, sans-serif; -$v-font-size: 14px; -$v-font-color: #37404E; -$v-font-weight: 400; -$v-link-text-decoration: none; -$v-shadow: 0 1px 0 (v-shade 0.2); -$v-bevel: inset 0 1px 0 v-tint; -$v-unit-size: 30px; -$v-gradient: v-linear 12%; -$v-overlay-shadow: 0 3px 8px v-shade, 0 0 0 1px (v-shade 0.7); -$v-shadow-opacity: 20%; -$v-selection-overlay-padding-horizontal: 0; -$v-selection-overlay-padding-vertical: 6px; -$v-selection-item-border-radius: 0; - -@import "../valo/valo"; diff --git a/WebContent/VAADIN/themes/tests-valo/_flat-dark.scss b/WebContent/VAADIN/themes/tests-valo/_flat-dark.scss deleted file mode 100644 index f68f9c266d..0000000000 --- a/WebContent/VAADIN/themes/tests-valo/_flat-dark.scss +++ /dev/null @@ -1,20 +0,0 @@ -$v-app-loading-text: "Dark & Flat Valo"; - -$v-background-color: #000; -$v-focus-color: orange; -$v-font-size: 15px; -$v-font-weight: 600; -$v-unit-size: 42px; -$v-bevel: false; -$v-shadow: false; -$v-gradient: false; -$v-textfield-bevel: false; -$v-textfield-shadow: false; -$v-border-radius: 0; -$v-border: 2px solid v-tone; -$v-overlay-shadow: 0 0 0 2px (v-tint 10); -$v-focus-style: $v-focus-color; -$v-font-family: "Lato", sans-serif; -$v-font-weight--header: 600; - -@import "../valo/valo"; diff --git a/WebContent/VAADIN/themes/tests-valo/_flat.scss b/WebContent/VAADIN/themes/tests-valo/_flat.scss deleted file mode 100644 index 5d2b8abbb7..0000000000 --- a/WebContent/VAADIN/themes/tests-valo/_flat.scss +++ /dev/null @@ -1,43 +0,0 @@ -$v-app-loading-text: "Flat Valo"; - -$v-font-family: "Roboto", sans-serif; -$v-font-weight: 400; -$v-font-weight--header: 400; -$v-background-color: #fff; -$v-focus-color: rgb(150,190,90); -$v-luminance-threshold: 180; -$v-border: 2px solid v-shade; -$v-border-radius: 6px; -$v-bevel: false; -$v-gradient: false; -$v-shadow: false; -$v-textfield-bevel: false; -$v-textfield-shadow: false; -$v-link-text-decoration: false; -$v-selection-overlay-padding-horizontal: 0; -$v-selection-overlay-padding-vertical: 6px; -$v-selection-item-height: 30px; -$v-selection-item-border-radius: 0; - - -@import "../valo/valo"; - - -.valo-test { - .v-button-primary.v-button-primary { - background: #fff; - border-color: $v-focus-color; - color: $v-focus-color; - } - - .v-button-danger.v-button-danger { - background: #fff; - border-color: $v-error-indicator-color; - color: $v-error-indicator-color; - } - - .v-slider-base:before, - .v-slider-base:after { - border: none !important; - } -} diff --git a/WebContent/VAADIN/themes/tests-valo/_metro.scss b/WebContent/VAADIN/themes/tests-valo/_metro.scss deleted file mode 100644 index f11cdb8b64..0000000000 --- a/WebContent/VAADIN/themes/tests-valo/_metro.scss +++ /dev/null @@ -1,26 +0,0 @@ -$v-app-loading-text: "Metro Valo"; - -$v-font-family: "Source Sans Pro", sans-serif; -$v-app-background-color: #fff; -$v-background-color: #eee; -$v-focus-color: #0072C6; -$v-focus-style: 0 0 0 1px $v-focus-color; -$valo-menu-background-color: darken($v-focus-color, 10%); -$v-border: 0 solid v-shade; -$v-border-radius: 0px; -$v-bevel: false; -$v-gradient: false; -$v-shadow: false; -$v-textfield-bevel: false; -$v-textfield-shadow: false; -$v-textfield-border: 1px solid v-shade; -$v-link-text-decoration: none; -$v-overlay-shadow: 0 0 0 2px #000; -$v-overlay-border-width: 2px; // For IE8 -$v-window-shadow: $v-overlay-shadow; -$v-selection-overlay-background-color: #fff; -$v-selection-overlay-padding-horizontal: 0; -$v-selection-overlay-padding-vertical: 6px; -$v-panel-border: 2px solid v-shade; - -@import "../valo/valo"; diff --git a/WebContent/VAADIN/themes/tests-valo/_valotest.scss b/WebContent/VAADIN/themes/tests-valo/_valotest.scss new file mode 100644 index 0000000000..f775938e13 --- /dev/null +++ b/WebContent/VAADIN/themes/tests-valo/_valotest.scss @@ -0,0 +1,118 @@ +@mixin valotest { + @include valo; + + .valo-menu .v-checkbox { + margin: round($v-unit-size/2); + font-weight: 400; + } + + $color1: hsl(220, 5%, 38%); + $color2: #5d73c0; + $color3: #3dbc1a; + $color4: #d2f4f3; + $color5: #fe902a; + $colors: $color1, $color2, $color3, $color4, $color5; + + .v-textfield-color1 { + @include valo-textfield-style($background-color: $color1); + } + + .v-textfield-color2 { + @include valo-textfield-style($background-color: $color3); + } + + .v-textfield-color3 { + @include valo-textfield-style($background-color: $color4); + } + + + .v-textarea-color1 { + @include valo-textarea-style($background-color: $color1); + } + + .v-textarea-color2 { + @include valo-textarea-style($background-color: $color3); + } + + .v-textarea-color3 { + @include valo-textarea-style($background-color: $color4); + } + + + .v-datefield-color1 { + @include valo-datefield-style($background-color: $color1); + } + + .v-datefield-color2 { + @include valo-datefield-style($background-color: $color3); + } + + .v-datefield-color3 { + @include valo-datefield-style($background-color: $color4); + } + + + .v-filterselect-color1 { + @include valo-combobox-style($background-color: $color1); + } + + .v-filterselect-color2 { + @include valo-combobox-style($background-color: $color3); + } + + .v-filterselect-color3 { + @include valo-combobox-style($background-color: $color4); + } + + + $copy: $v-selection-color; + $v-selection-color: white; + .v-checkbox-color1 { + @include valo-checkbox-style($background-color: $color1); + } + + .v-checkbox-color2 { + @include valo-checkbox-style($background-color: $color2); + } + $v-selection-color: $copy; + + + .v-slider-color1 { + @include valo-slider-handle-style($background-color: $color1); + } + + .v-slider-color2 { + @include valo-slider-track-style($background-color: $color3); + } + + .v-slider-color3 { + @include valo-slider-indicator-style($background-color: #dcdc1e); + } + + + .v-panel-caption-color1 { + @include valo-panel-caption-style($background-color: $color1); + } + + .v-panel-caption-color2 { + @include valo-panel-caption-style($background-color: $color3); + } + + .v-panel-caption-color3 { + @include valo-panel-caption-style($background-color: $color5); + } + + // Show splitpanel borders + .v-splitpanel-vertical, + .v-splitpanel-horizontal { + outline: 1px dotted rgba(gray, .2); + } + + .v-slider-ticks { + @include valo-slider-ticks($tick-count: 5); + } + + .v-accordion-item-color1 .v-accordion-item-caption { + @include valo-accordion-item-caption-style($background-color: $color2); + } +} \ No newline at end of file diff --git a/WebContent/VAADIN/themes/tests-valo/_variables.scss b/WebContent/VAADIN/themes/tests-valo/_variables.scss new file mode 100644 index 0000000000..c227156e2e --- /dev/null +++ b/WebContent/VAADIN/themes/tests-valo/_variables.scss @@ -0,0 +1,3 @@ +$v-app-loading-text: "Default Valo"; + +@import "../valo/valo"; diff --git a/WebContent/VAADIN/themes/tests-valo/styles.scss b/WebContent/VAADIN/themes/tests-valo/styles.scss index 89fc5755f4..1ba0b29b04 100644 --- a/WebContent/VAADIN/themes/tests-valo/styles.scss +++ b/WebContent/VAADIN/themes/tests-valo/styles.scss @@ -1,127 +1,5 @@ -@import "default"; -// @import "flat"; -// @import "flat-dark"; -// @import "facebook"; -// @import "metro"; -// @import "dark"; -// @import "blueprint"; - - +@import "variables"; +@import "valotest"; .tests-valo { - @include valo; - - .valo-menu .v-checkbox { - margin: round($v-unit-size/2); - font-weight: 400; - } - - $color1: hsl(220, 5%, 38%); - $color2: #5d73c0; - $color3: #3dbc1a; - $color4: #d2f4f3; - $color5: #fe902a; - $colors: $color1, $color2, $color3, $color4, $color5; - - .v-textfield-color1 { - @include valo-textfield-style($background-color: $color1); - } - - .v-textfield-color2 { - @include valo-textfield-style($background-color: $color3); - } - - .v-textfield-color3 { - @include valo-textfield-style($background-color: $color4); - } - - - .v-textarea-color1 { - @include valo-textarea-style($background-color: $color1); - } - - .v-textarea-color2 { - @include valo-textarea-style($background-color: $color3); - } - - .v-textarea-color3 { - @include valo-textarea-style($background-color: $color4); - } - - - .v-datefield-color1 { - @include valo-datefield-style($background-color: $color1); - } - - .v-datefield-color2 { - @include valo-datefield-style($background-color: $color3); - } - - .v-datefield-color3 { - @include valo-datefield-style($background-color: $color4); - } - - - .v-filterselect-color1 { - @include valo-combobox-style($background-color: $color1); - } - - .v-filterselect-color2 { - @include valo-combobox-style($background-color: $color3); - } - - .v-filterselect-color3 { - @include valo-combobox-style($background-color: $color4); - } - - - $copy: $v-selection-color; - $v-selection-color: white; - .v-checkbox-color1 { - @include valo-checkbox-style($background-color: $color1); - } - - .v-checkbox-color2 { - @include valo-checkbox-style($background-color: $color2); - } - $v-selection-color: $copy; - - - .v-slider-color1 { - @include valo-slider-handle-style($background-color: $color1); - } - - .v-slider-color2 { - @include valo-slider-track-style($background-color: $color3); - } - - .v-slider-color3 { - @include valo-slider-indicator-style($background-color: #dcdc1e); - } - - - .v-panel-caption-color1 { - @include valo-panel-caption-style($background-color: $color1); - } - - .v-panel-caption-color2 { - @include valo-panel-caption-style($background-color: $color3); - } - - .v-panel-caption-color3 { - @include valo-panel-caption-style($background-color: $color5); - } - - // Show splitpanel borders - .v-splitpanel-vertical, - .v-splitpanel-horizontal { - outline: 1px dotted rgba(gray, .2); - } - - .v-slider-ticks { - @include valo-slider-ticks($tick-count: 5); - } - - .v-accordion-item-color1 .v-accordion-item-caption { - @include valo-accordion-item-caption-style($background-color: $color2); - } + @include valotest; } diff --git a/uitest/src/com/vaadin/tests/themes/valo/Accordions.java b/uitest/src/com/vaadin/tests/themes/valo/Accordions.java index b401451271..f483655bcd 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/Accordions.java +++ b/uitest/src/com/vaadin/tests/themes/valo/Accordions.java @@ -1,12 +1,12 @@ /* * Copyright 2000-2013 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 diff --git a/uitest/src/com/vaadin/tests/themes/valo/ComboBoxes.java b/uitest/src/com/vaadin/tests/themes/valo/ComboBoxes.java index cafdfe37e0..5c1d188937 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/ComboBoxes.java +++ b/uitest/src/com/vaadin/tests/themes/valo/ComboBoxes.java @@ -40,15 +40,15 @@ public class ComboBoxes extends VerticalLayout implements View { row.setSpacing(true); addComponent(row); - Container generatedContainer = ValoThemeTest.generateContainer(200, - false); + Container generatedContainer = ValoThemeUI + .generateContainer(200, false); ComboBox combo = new ComboBox("Normal"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(generatedContainer); combo.setNullSelectionAllowed(false); combo.select(generatedContainer.getItemIds().iterator().next()); - combo.setItemCaptionPropertyId(ValoThemeTest.CAPTION_PROPERTY); - combo.setItemIconPropertyId(ValoThemeTest.ICON_PROPERTY); + combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); + combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.setItemIcon(combo.getItemIds().iterator().next(), new ThemeResource("../runo/icons/16/document.png")); row.addComponent(combo); @@ -63,8 +63,8 @@ public class ComboBoxes extends VerticalLayout implements View { combo.setContainerDataSource(generatedContainer); combo.setNullSelectionAllowed(false); combo.select(generatedContainer.getItemIds().iterator().next()); - combo.setItemCaptionPropertyId(ValoThemeTest.CAPTION_PROPERTY); - combo.setItemIconPropertyId(ValoThemeTest.ICON_PROPERTY); + combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); + combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.setWidth("240px"); group.addComponent(combo); Button today = new Button("Do It"); @@ -121,40 +121,40 @@ public class ComboBoxes extends VerticalLayout implements View { combo = new ComboBox("Custom color"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(generatedContainer); - combo.setItemCaptionPropertyId(ValoThemeTest.CAPTION_PROPERTY); - combo.setItemIconPropertyId(ValoThemeTest.ICON_PROPERTY); + combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); + combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.addStyleName("color1"); row.addComponent(combo); combo = new ComboBox("Custom color"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(generatedContainer); - combo.setItemCaptionPropertyId(ValoThemeTest.CAPTION_PROPERTY); - combo.setItemIconPropertyId(ValoThemeTest.ICON_PROPERTY); + combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); + combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.addStyleName("color2"); row.addComponent(combo); combo = new ComboBox("Custom color"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(generatedContainer); - combo.setItemCaptionPropertyId(ValoThemeTest.CAPTION_PROPERTY); - combo.setItemIconPropertyId(ValoThemeTest.ICON_PROPERTY); + combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); + combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.addStyleName("color3"); row.addComponent(combo); combo = new ComboBox("Small"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(generatedContainer); - combo.setItemCaptionPropertyId(ValoThemeTest.CAPTION_PROPERTY); - combo.setItemIconPropertyId(ValoThemeTest.ICON_PROPERTY); + combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); + combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.addStyleName("small"); row.addComponent(combo); combo = new ComboBox("Large"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(generatedContainer); - combo.setItemCaptionPropertyId(ValoThemeTest.CAPTION_PROPERTY); - combo.setItemIconPropertyId(ValoThemeTest.ICON_PROPERTY); + combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); + combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.addStyleName("large"); row.addComponent(combo); diff --git a/uitest/src/com/vaadin/tests/themes/valo/Forms.java b/uitest/src/com/vaadin/tests/themes/valo/Forms.java index 9451b5c5d3..2cea8e3f38 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/Forms.java +++ b/uitest/src/com/vaadin/tests/themes/valo/Forms.java @@ -62,8 +62,8 @@ public class Forms extends VerticalLayout implements View { form.addComponent(section); TextField name = new TextField("Name"); - name.setValue(ValoThemeTest.nextString(true) + " " - + ValoThemeTest.nextString(true)); + name.setValue(ValoThemeUI.nextString(true) + " " + + ValoThemeUI.nextString(true)); name.setWidth("50%"); form.addComponent(name); @@ -72,8 +72,8 @@ public class Forms extends VerticalLayout implements View { form.addComponent(birthday); TextField username = new TextField("Username"); - username.setValue(ValoThemeTest.nextString(false) - + ValoThemeTest.nextString(false)); + username.setValue(ValoThemeUI.nextString(false) + + ValoThemeUI.nextString(false)); username.setRequired(true); form.addComponent(username); @@ -89,15 +89,15 @@ public class Forms extends VerticalLayout implements View { form.addComponent(section); TextField email = new TextField("Email"); - email.setValue(ValoThemeTest.nextString(false) + "@" - + ValoThemeTest.nextString(false) + ".com"); + email.setValue(ValoThemeUI.nextString(false) + "@" + + ValoThemeUI.nextString(false) + ".com"); email.setWidth("50%"); email.setRequired(true); form.addComponent(email); TextField location = new TextField("Location"); - location.setValue(ValoThemeTest.nextString(true) + ", " - + ValoThemeTest.nextString(true)); + location.setValue(ValoThemeUI.nextString(true) + ", " + + ValoThemeUI.nextString(true)); location.setWidth("50%"); location.setComponentError(new UserError("This address doesn't exist")); form.addComponent(location); diff --git a/uitest/src/com/vaadin/tests/themes/valo/Tables.java b/uitest/src/com/vaadin/tests/themes/valo/Tables.java index 6aa02a7f74..442e3e509a 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/Tables.java +++ b/uitest/src/com/vaadin/tests/themes/valo/Tables.java @@ -1,12 +1,12 @@ /* * 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 @@ -40,10 +40,9 @@ import com.vaadin.ui.VerticalLayout; public class Tables extends VerticalLayout implements View { - static final Container normalContainer = ValoThemeTest.generateContainer( - 200, false); - static final Container hierarchicalContainer = ValoThemeTest - .generateContainer(200, true); + final Container normalContainer = ValoThemeUI.generateContainer(200, false); + final Container hierarchicalContainer = ValoThemeUI.generateContainer(200, + true); CheckBox hierarchical = new CheckBox("Hierarchical"); CheckBox footer = new CheckBox("Footer", true); @@ -140,7 +139,7 @@ public class Tables extends VerticalLayout implements View { table.setColumnCollapsingAllowed(true); table.setColumnReorderingAllowed(true); table.setPageLength(6); - table.addActionHandler(ValoThemeTest.getActionHandler()); + table.addActionHandler(ValoThemeUI.getActionHandler()); table.setDragMode(TableDragMode.MULTIROW); table.setDropHandler(new DropHandler() { @Override @@ -153,9 +152,8 @@ public class Tables extends VerticalLayout implements View { Notification.show(event.getTransferable().toString()); } }); - table.setColumnAlignment(ValoThemeTest.DESCRIPTION_PROPERTY, - Align.RIGHT); - table.setColumnAlignment(ValoThemeTest.INDEX_PROPERTY, Align.CENTER); + table.setColumnAlignment(ValoThemeUI.DESCRIPTION_PROPERTY, Align.RIGHT); + table.setColumnAlignment(ValoThemeUI.INDEX_PROPERTY, Align.CENTER); table.removeContainerProperty("textfield"); table.addContainerProperty("textfield", TextField.class, null); @@ -186,11 +184,11 @@ public class Tables extends VerticalLayout implements View { table.setFooterVisible(footer); if (footer) { - table.setColumnFooter(ValoThemeTest.CAPTION_PROPERTY, "caption"); - table.setColumnFooter(ValoThemeTest.DESCRIPTION_PROPERTY, + table.setColumnFooter(ValoThemeUI.CAPTION_PROPERTY, "caption"); + table.setColumnFooter(ValoThemeUI.DESCRIPTION_PROPERTY, "description"); - table.setColumnFooter(ValoThemeTest.ICON_PROPERTY, "icon"); - table.setColumnFooter(ValoThemeTest.INDEX_PROPERTY, "index"); + table.setColumnFooter(ValoThemeUI.ICON_PROPERTY, "icon"); + table.setColumnFooter(ValoThemeUI.INDEX_PROPERTY, "index"); } if (sized) { @@ -205,9 +203,9 @@ public class Tables extends VerticalLayout implements View { table.setWidth("100%"); } } - table.setColumnExpandRatio(ValoThemeTest.CAPTION_PROPERTY, + table.setColumnExpandRatio(ValoThemeUI.CAPTION_PROPERTY, expandRatios ? 1.0f : 0); - table.setColumnExpandRatio(ValoThemeTest.DESCRIPTION_PROPERTY, + table.setColumnExpandRatio(ValoThemeUI.DESCRIPTION_PROPERTY, expandRatios ? 1.0f : 0); if (!stripes) { @@ -262,14 +260,14 @@ public class Tables extends VerticalLayout implements View { if (rowCaption) { table.setRowHeaderMode(RowHeaderMode.PROPERTY); - table.setItemCaptionPropertyId(ValoThemeTest.CAPTION_PROPERTY); + table.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); } else { table.setItemCaptionPropertyId(null); } if (rowIcon) { table.setRowHeaderMode(RowHeaderMode.ICON_ONLY); - table.setItemIconPropertyId(ValoThemeTest.ICON_PROPERTY); + table.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); } else { table.setItemIconPropertyId(null); } diff --git a/uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java b/uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java index 24a249d90e..5ae0b04399 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java +++ b/uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java @@ -153,8 +153,8 @@ public class Tabsheets extends VerticalLayout implements View { ts.addStyleName(style); for (int i = 1; i <= (scrolling ? 10 : 3); i++) { - String tabcaption = caption ? ValoThemeTest.nextString(true) + " " - + ValoThemeTest.nextString(false) : null; + String tabcaption = caption ? ValoThemeUI.nextString(true) + " " + + ValoThemeUI.nextString(false) : null; VerticalLayout content = new VerticalLayout(); content.setMargin(true); diff --git a/uitest/src/com/vaadin/tests/themes/valo/TestIcon.java b/uitest/src/com/vaadin/tests/themes/valo/TestIcon.java index 18b834f1bf..f067df830a 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/TestIcon.java +++ b/uitest/src/com/vaadin/tests/themes/valo/TestIcon.java @@ -1,12 +1,12 @@ /* * Copyright 2000-2013 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 @@ -24,7 +24,7 @@ import com.vaadin.server.Resource; import com.vaadin.server.ThemeResource; /** - * + * * @since * @author Vaadin Ltd */ diff --git a/uitest/src/com/vaadin/tests/themes/valo/Trees.java b/uitest/src/com/vaadin/tests/themes/valo/Trees.java index bb406e4f39..cb5657660a 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/Trees.java +++ b/uitest/src/com/vaadin/tests/themes/valo/Trees.java @@ -45,12 +45,12 @@ public class Trees extends VerticalLayout implements View { Tree tree = new Tree(); tree.setSelectable(true); tree.setMultiSelect(true); - Container generateContainer = ValoThemeTest.generateContainer(10, true); + Container generateContainer = ValoThemeUI.generateContainer(10, true); tree.setContainerDataSource(generateContainer); tree.setDragMode(TreeDragMode.NODE); row.addComponent(tree); - tree.setItemCaptionPropertyId(ValoThemeTest.CAPTION_PROPERTY); - tree.setItemIconPropertyId(ValoThemeTest.ICON_PROPERTY); + tree.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); + tree.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); tree.expandItem(generateContainer.getItemIds().iterator().next()); tree.setDropHandler(new DropHandler() { @@ -66,7 +66,7 @@ public class Trees extends VerticalLayout implements View { }); // Add actions (context menu) - tree.addActionHandler(ValoThemeTest.getActionHandler()); + tree.addActionHandler(ValoThemeUI.getActionHandler()); } @Override diff --git a/uitest/src/com/vaadin/tests/themes/valo/ValoMiscTests.java b/uitest/src/com/vaadin/tests/themes/valo/ValoMiscTests.java index 222dd90e49..1676d121af 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/ValoMiscTests.java +++ b/uitest/src/com/vaadin/tests/themes/valo/ValoMiscTests.java @@ -1,12 +1,12 @@ /* * 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 @@ -70,7 +70,7 @@ public class ValoMiscTests extends UI { TreeTable table = new TreeTable(); table.setWidth("100%"); - table.setContainerDataSource(Tables.hierarchicalContainer); + table.setContainerDataSource(ValoThemeUI.generateContainer(200, true)); Tables.configure(table, true, false, false, true, true, true, false, true, false, false, false, false, false); layout.addComponent(table); diff --git a/uitest/src/com/vaadin/tests/themes/valo/ValoThemeTest.java b/uitest/src/com/vaadin/tests/themes/valo/ValoThemeTest.java deleted file mode 100644 index 014b1acac8..0000000000 --- a/uitest/src/com/vaadin/tests/themes/valo/ValoThemeTest.java +++ /dev/null @@ -1,364 +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.themes.valo; - -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.Map.Entry; - -import com.vaadin.annotations.PreserveOnRefresh; -import com.vaadin.annotations.Theme; -import com.vaadin.annotations.Title; -import com.vaadin.data.Container; -import com.vaadin.data.Container.Hierarchical; -import com.vaadin.data.Item; -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.data.Property.ValueChangeListener; -import com.vaadin.data.util.HierarchicalContainer; -import com.vaadin.data.util.IndexedContainer; -import com.vaadin.event.Action; -import com.vaadin.event.Action.Handler; -import com.vaadin.navigator.Navigator; -import com.vaadin.navigator.ViewChangeListener; -import com.vaadin.server.FontAwesome; -import com.vaadin.server.Page; -import com.vaadin.server.Resource; -import com.vaadin.server.VaadinRequest; -import com.vaadin.shared.ui.label.ContentMode; -import com.vaadin.ui.Alignment; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; -import com.vaadin.ui.CheckBox; -import com.vaadin.ui.Component; -import com.vaadin.ui.ComponentContainer; -import com.vaadin.ui.CssLayout; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.MenuBar; -import com.vaadin.ui.MenuBar.MenuItem; -import com.vaadin.ui.Notification; -import com.vaadin.ui.UI; - -@Theme("tests-valo") -@Title("Valo Theme Test") -@PreserveOnRefresh -public class ValoThemeTest extends UI { - - ValoMenuLayout root = new ValoMenuLayout(); - ComponentContainer viewDisplay = root.getContentContainer(); - CssLayout menu = new CssLayout(); - private Navigator navigator; - private LinkedHashMap menuItems = new LinkedHashMap(); - - @Override - protected void init(VaadinRequest request) { - // Show .v-app-loading valo-menu-badge - // try { - // Thread.sleep(2000); - // } catch (InterruptedException e) { - // e.printStackTrace(); - // } - - getPage().setTitle("Valo Theme Test"); - setContent(root); - root.setWidth("100%"); - - root.addMenu(buildTestMenu()); - root.addMenu(buildMenu()); - - navigator = new Navigator(this, viewDisplay); - - navigator.addView("common", CommonParts.class); - navigator.addView("labels", Labels.class); - navigator.addView("buttons-and-links", ButtonsAndLinks.class); - navigator.addView("textfields", TextFields.class); - navigator.addView("datefields", DateFields.class); - navigator.addView("comboboxes", ComboBoxes.class); - navigator.addView("checkboxes", CheckBoxes.class); - navigator.addView("sliders", Sliders.class); - navigator.addView("menubars", MenuBars.class); - navigator.addView("panels", Panels.class); - navigator.addView("trees", Trees.class); - navigator.addView("tables", Tables.class); - navigator.addView("splitpanels", SplitPanels.class); - navigator.addView("tabs", Tabsheets.class); - navigator.addView("accordions", Accordions.class); - navigator.addView("colorpickers", ColorPickers.class); - navigator.addView("selects", NativeSelects.class); - navigator.addView("calendar", CalendarTest.class); - navigator.addView("forms", Forms.class); - navigator.addView("popupviews", PopupViews.class); - navigator.addView("dragging", Dragging.class); - - String f = Page.getCurrent().getUriFragment(); - if (f == null || f.equals("")) { - navigator.navigateTo("common"); - } - - navigator.addViewChangeListener(new ViewChangeListener() { - - @Override - public boolean beforeViewChange(ViewChangeEvent event) { - return true; - } - - @Override - public void afterViewChange(ViewChangeEvent event) { - for (Iterator it = menu.iterator(); it.hasNext();) { - it.next().removeStyleName("selected"); - } - for (Entry item : menuItems.entrySet()) { - if (event.getViewName().equals(item.getKey())) { - for (Iterator it = menu.iterator(); it - .hasNext();) { - Component c = it.next(); - if (c.getCaption() != null - && c.getCaption().startsWith( - item.getValue())) { - c.addStyleName("selected"); - break; - } - } - break; - } - } - } - }); - - } - - Component buildTestMenu() { - CssLayout menu = new CssLayout(); - menu.addStyleName("large-icons"); - - Label logo = new Label("Va"); - logo.setSizeUndefined(); - logo.setPrimaryStyleName("valo-menu-logo"); - menu.addComponent(logo); - - Button b = new Button( - "Reference 3"); - b.setIcon(FontAwesome.TH_LIST); - b.setPrimaryStyleName("valo-menu-item"); - b.addStyleName("selected"); - b.setHtmlContentAllowed(true); - menu.addComponent(b); - - b = new Button("API"); - b.setIcon(FontAwesome.BOOK); - b.setPrimaryStyleName("valo-menu-item"); - menu.addComponent(b); - - b = new Button("Examples 12"); - b.setIcon(FontAwesome.TABLE); - b.setPrimaryStyleName("valo-menu-item"); - b.setHtmlContentAllowed(true); - menu.addComponent(b); - - return menu; - } - - CssLayout buildMenu() { - // Add items - menuItems.put("common", "Common UI Elements"); - menuItems.put("labels", "Labels"); - menuItems.put("buttons-and-links", "Buttons & Links"); - menuItems.put("textfields", "Text Fields"); - menuItems.put("datefields", "Date Fields"); - menuItems.put("comboboxes", "Combo Boxes"); - menuItems.put("selects", "Selects"); - menuItems.put("checkboxes", "Check Boxes & Option Groups"); - menuItems.put("sliders", "Sliders & Progress Bars"); - menuItems.put("colorpickers", "Color Pickers"); - menuItems.put("menubars", "Menu Bars"); - menuItems.put("trees", "Trees"); - menuItems.put("tables", "Tables"); - menuItems.put("dragging", "Drag and Drop"); - menuItems.put("panels", "Panels"); - menuItems.put("splitpanels", "Split Panels"); - menuItems.put("tabs", "Tabs"); - menuItems.put("accordions", "Accordions"); - menuItems.put("popupviews", "Popup Views"); - menuItems.put("calendar", "Calendar"); - menuItems.put("forms", "Forms"); - - HorizontalLayout top = new HorizontalLayout(); - top.setWidth("100%"); - top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); - top.addStyleName("valo-menu-title"); - menu.addComponent(top); - - Label title = new Label("Vaadin
Valo Theme Styles", - ContentMode.HTML); - title.setSizeUndefined(); - top.addComponent(title); - top.setExpandRatio(title, 1); - - MenuBar settings = new MenuBar(); - MenuItem settingsItem = settings.addItem("", FontAwesome.COG, null); - settingsItem.setStyleName("icon-only"); - settingsItem.addItem("Edit Profile", null); - settingsItem.addItem("Preferences", null); - settingsItem.addSeparator(); - settingsItem.addItem("Sign Out", null); - top.addComponent(settings); - - final CheckBox enabled = new CheckBox("Enabled", true); - enabled.setDescription("Enable or disable the components on the right side"); - menu.addComponent(enabled); - enabled.addValueChangeListener(new ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - viewDisplay.setEnabled(enabled.getValue()); - } - }); - - Label label = null; - int count = -1; - for (final Entry item : menuItems.entrySet()) { - if (item.getKey().equals("labels")) { - label = new Label("Components", ContentMode.HTML); - label.setPrimaryStyleName("valo-menu-subtitle"); - label.addStyleName("h4"); - label.setSizeUndefined(); - menu.addComponent(label); - } - if (item.getKey().equals("panels")) { - label.setValue(label.getValue() - + " " + count - + ""); - count = 0; - label = new Label("Containers", ContentMode.HTML); - label.setPrimaryStyleName("valo-menu-subtitle"); - label.addStyleName("h4"); - label.setSizeUndefined(); - menu.addComponent(label); - } - if (item.getKey().equals("calendar")) { - label.setValue(label.getValue() - + " " + count - + ""); - count = 0; - label = new Label("Other", ContentMode.HTML); - label.setPrimaryStyleName("valo-menu-subtitle"); - label.addStyleName("h4"); - label.setSizeUndefined(); - menu.addComponent(label); - } - Button b = new Button(item.getValue(), new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - navigator.navigateTo(item.getKey()); - } - }); - if (count == 2) { - b.setCaption(b.getCaption() - + " 123"); - } - b.setHtmlContentAllowed(true); - b.setPrimaryStyleName("valo-menu-item"); - b.setIcon(TestIcon.get()); - menu.addComponent(b); - count++; - } - label.setValue(label.getValue() + " " - + count + ""); - - return menu; - } - - static String[] strings = new String[] { "lorem", "ipsum", "dolor", "sit", - "amet", "consectetur", "quid", "securi", "etiam", "tamquam", "eu", - "fugiat", "nulla", "pariatur" }; - static int stringCount = -1; - - static String nextString(boolean capitalize) { - if (++stringCount >= strings.length) { - stringCount = 0; - } - return capitalize ? strings[stringCount].substring(0, 1).toUpperCase() - + strings[stringCount].substring(1) : strings[stringCount]; - } - - static Handler actionHandler = new Handler() { - private final Action ACTION_ONE = new Action("Action One"); - private final Action ACTION_TWO = new Action("Action Two"); - private final Action ACTION_THREE = new Action("Action Three"); - private final Action[] ACTIONS = new Action[] { ACTION_ONE, ACTION_TWO, - ACTION_THREE }; - - @Override - public void handleAction(Action action, Object sender, Object target) { - Notification.show(action.getCaption()); - } - - @Override - public Action[] getActions(Object target, Object sender) { - return ACTIONS; - } - }; - - static Handler getActionHandler() { - return actionHandler; - } - - static final String CAPTION_PROPERTY = "caption"; - static final String DESCRIPTION_PROPERTY = "description"; - static final String ICON_PROPERTY = "icon"; - static final String INDEX_PROPERTY = "index"; - - @SuppressWarnings("unchecked") - static Container generateContainer(final int size, - final boolean hierarchical) { - IndexedContainer container = hierarchical ? new HierarchicalContainer() - : new IndexedContainer(); - - container.addContainerProperty(CAPTION_PROPERTY, String.class, null); - container.addContainerProperty(ICON_PROPERTY, Resource.class, null); - container.addContainerProperty(INDEX_PROPERTY, Integer.class, null); - container - .addContainerProperty(DESCRIPTION_PROPERTY, String.class, null); - for (int i = 1; i < size + 1; i++) { - Item item = container.addItem(i); - item.getItemProperty(CAPTION_PROPERTY).setValue( - nextString(true) + " " + nextString(false)); - item.getItemProperty(INDEX_PROPERTY).setValue(i); - item.getItemProperty(DESCRIPTION_PROPERTY).setValue( - nextString(true) + " " + nextString(false) + " " - + nextString(false)); - item.getItemProperty(ICON_PROPERTY).setValue(TestIcon.get()); - } - container.getItem(container.getIdByIndex(0)) - .getItemProperty(ICON_PROPERTY).setValue(TestIcon.get()); - - if (hierarchical) { - for (int i = 1; i < size + 1; i++) { - for (int j = 1; j < 5; j++) { - String id = i + " -> " + j; - Item child = container.addItem(id); - child.getItemProperty(CAPTION_PROPERTY).setValue( - nextString(true) + " " + nextString(false)); - child.getItemProperty(ICON_PROPERTY).setValue( - TestIcon.get()); - ((Hierarchical) container).setChildrenAllowed(id, false); - ((Hierarchical) container).setParent(id, i); - } - } - } - return container; - } -} \ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java b/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java new file mode 100644 index 0000000000..8a0bf75b51 --- /dev/null +++ b/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java @@ -0,0 +1,397 @@ +/* + * 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 java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.Map.Entry; + +import com.vaadin.annotations.PreserveOnRefresh; +import com.vaadin.annotations.Theme; +import com.vaadin.annotations.Title; +import com.vaadin.data.Container; +import com.vaadin.data.Container.Hierarchical; +import com.vaadin.data.Item; +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.data.Property.ValueChangeListener; +import com.vaadin.data.util.HierarchicalContainer; +import com.vaadin.data.util.IndexedContainer; +import com.vaadin.event.Action; +import com.vaadin.event.Action.Handler; +import com.vaadin.navigator.Navigator; +import com.vaadin.navigator.ViewChangeListener; +import com.vaadin.server.FontAwesome; +import com.vaadin.server.Page; +import com.vaadin.server.Resource; +import com.vaadin.server.VaadinRequest; +import com.vaadin.shared.ui.label.ContentMode; +import com.vaadin.ui.Alignment; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.CheckBox; +import com.vaadin.ui.Component; +import com.vaadin.ui.ComponentContainer; +import com.vaadin.ui.CssLayout; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Label; +import com.vaadin.ui.MenuBar; +import com.vaadin.ui.MenuBar.MenuItem; +import com.vaadin.ui.NativeSelect; +import com.vaadin.ui.Notification; +import com.vaadin.ui.UI; + +@Theme("tests-valo") +@Title("Valo Theme Test") +@PreserveOnRefresh +public class ValoThemeUI extends UI { + + private static LinkedHashMap themeVariants = new LinkedHashMap(); + static { + themeVariants.put("tests-valo", "Default"); + themeVariants.put("tests-valo-blueprint", "Blueprint"); + themeVariants.put("tests-valo-dark", "Dark"); + themeVariants.put("tests-valo-facebook", "Facebook"); + themeVariants.put("tests-valo-flatdark", "Flat dark"); + themeVariants.put("tests-valo-flat", "Flat"); + themeVariants.put("tests-valo-metro", "Metro"); + } + ValoMenuLayout root = new ValoMenuLayout(); + ComponentContainer viewDisplay = root.getContentContainer(); + CssLayout menu = new CssLayout(); + private Navigator navigator; + private LinkedHashMap menuItems = new LinkedHashMap(); + + @Override + protected void init(VaadinRequest request) { + // Show .v-app-loading valo-menu-badge + // try { + // Thread.sleep(2000); + // } catch (InterruptedException e) { + // e.printStackTrace(); + // } + + getPage().setTitle("Valo Theme Test"); + setContent(root); + root.setWidth("100%"); + + root.addMenu(buildTestMenu()); + root.addMenu(buildMenu()); + + navigator = new Navigator(this, viewDisplay); + + navigator.addView("common", CommonParts.class); + navigator.addView("labels", Labels.class); + navigator.addView("buttons-and-links", ButtonsAndLinks.class); + navigator.addView("textfields", TextFields.class); + navigator.addView("datefields", DateFields.class); + navigator.addView("comboboxes", ComboBoxes.class); + navigator.addView("checkboxes", CheckBoxes.class); + navigator.addView("sliders", Sliders.class); + navigator.addView("menubars", MenuBars.class); + navigator.addView("panels", Panels.class); + navigator.addView("trees", Trees.class); + navigator.addView("tables", Tables.class); + navigator.addView("splitpanels", SplitPanels.class); + navigator.addView("tabs", Tabsheets.class); + navigator.addView("accordions", Accordions.class); + navigator.addView("colorpickers", ColorPickers.class); + navigator.addView("selects", NativeSelects.class); + navigator.addView("calendar", CalendarTest.class); + navigator.addView("forms", Forms.class); + navigator.addView("popupviews", PopupViews.class); + navigator.addView("dragging", Dragging.class); + + String f = Page.getCurrent().getUriFragment(); + if (f == null || f.equals("")) { + navigator.navigateTo("common"); + } + + navigator.addViewChangeListener(new ViewChangeListener() { + + @Override + public boolean beforeViewChange(ViewChangeEvent event) { + return true; + } + + @Override + public void afterViewChange(ViewChangeEvent event) { + for (Iterator it = menu.iterator(); it.hasNext();) { + it.next().removeStyleName("selected"); + } + for (Entry item : menuItems.entrySet()) { + if (event.getViewName().equals(item.getKey())) { + for (Iterator it = menu.iterator(); it + .hasNext();) { + Component c = it.next(); + if (c.getCaption() != null + && c.getCaption().startsWith( + item.getValue())) { + c.addStyleName("selected"); + break; + } + } + break; + } + } + } + }); + + } + + Component buildTestMenu() { + CssLayout menu = new CssLayout(); + menu.addStyleName("large-icons"); + + Label logo = new Label("Va"); + logo.setSizeUndefined(); + logo.setPrimaryStyleName("valo-menu-logo"); + menu.addComponent(logo); + + Button b = new Button( + "Reference 3"); + b.setIcon(FontAwesome.TH_LIST); + b.setPrimaryStyleName("valo-menu-item"); + b.addStyleName("selected"); + b.setHtmlContentAllowed(true); + menu.addComponent(b); + + b = new Button("API"); + b.setIcon(FontAwesome.BOOK); + b.setPrimaryStyleName("valo-menu-item"); + menu.addComponent(b); + + b = new Button("Examples 12"); + b.setIcon(FontAwesome.TABLE); + b.setPrimaryStyleName("valo-menu-item"); + b.setHtmlContentAllowed(true); + menu.addComponent(b); + + return menu; + } + + CssLayout buildMenu() { + // Add items + menuItems.put("common", "Common UI Elements"); + menuItems.put("labels", "Labels"); + menuItems.put("buttons-and-links", "Buttons & Links"); + menuItems.put("textfields", "Text Fields"); + menuItems.put("datefields", "Date Fields"); + menuItems.put("comboboxes", "Combo Boxes"); + menuItems.put("selects", "Selects"); + menuItems.put("checkboxes", "Check Boxes & Option Groups"); + menuItems.put("sliders", "Sliders & Progress Bars"); + menuItems.put("colorpickers", "Color Pickers"); + menuItems.put("menubars", "Menu Bars"); + menuItems.put("trees", "Trees"); + menuItems.put("tables", "Tables"); + menuItems.put("dragging", "Drag and Drop"); + menuItems.put("panels", "Panels"); + menuItems.put("splitpanels", "Split Panels"); + menuItems.put("tabs", "Tabs"); + menuItems.put("accordions", "Accordions"); + menuItems.put("popupviews", "Popup Views"); + menuItems.put("calendar", "Calendar"); + menuItems.put("forms", "Forms"); + + HorizontalLayout top = new HorizontalLayout(); + top.setWidth("100%"); + top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); + top.addStyleName("valo-menu-title"); + menu.addComponent(top); + menu.addComponent(createThemeSelect()); + + Label title = new Label("Vaadin
Valo Theme Styles", + ContentMode.HTML); + title.setSizeUndefined(); + top.addComponent(title); + top.setExpandRatio(title, 1); + + MenuBar settings = new MenuBar(); + MenuItem settingsItem = settings.addItem("", FontAwesome.COG, null); + settingsItem.setStyleName("icon-only"); + settingsItem.addItem("Edit Profile", null); + settingsItem.addItem("Preferences", null); + settingsItem.addSeparator(); + settingsItem.addItem("Sign Out", null); + top.addComponent(settings); + + final CheckBox enabled = new CheckBox("Enabled", true); + enabled.setDescription("Enable or disable the components on the right side"); + menu.addComponent(enabled); + enabled.addValueChangeListener(new ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + viewDisplay.setEnabled(enabled.getValue()); + } + }); + + Label label = null; + int count = -1; + for (final Entry item : menuItems.entrySet()) { + if (item.getKey().equals("labels")) { + label = new Label("Components", ContentMode.HTML); + label.setPrimaryStyleName("valo-menu-subtitle"); + label.addStyleName("h4"); + label.setSizeUndefined(); + menu.addComponent(label); + } + if (item.getKey().equals("panels")) { + label.setValue(label.getValue() + + " " + count + + ""); + count = 0; + label = new Label("Containers", ContentMode.HTML); + label.setPrimaryStyleName("valo-menu-subtitle"); + label.addStyleName("h4"); + label.setSizeUndefined(); + menu.addComponent(label); + } + if (item.getKey().equals("calendar")) { + label.setValue(label.getValue() + + " " + count + + ""); + count = 0; + label = new Label("Other", ContentMode.HTML); + label.setPrimaryStyleName("valo-menu-subtitle"); + label.addStyleName("h4"); + label.setSizeUndefined(); + menu.addComponent(label); + } + Button b = new Button(item.getValue(), new ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + navigator.navigateTo(item.getKey()); + } + }); + if (count == 2) { + b.setCaption(b.getCaption() + + " 123"); + } + b.setHtmlContentAllowed(true); + b.setPrimaryStyleName("valo-menu-item"); + b.setIcon(TestIcon.get()); + menu.addComponent(b); + count++; + } + label.setValue(label.getValue() + " " + + count + ""); + + return menu; + } + + private Component createThemeSelect() { + final NativeSelect ns = new NativeSelect(); + ns.setNullSelectionAllowed(false); + ns.setId("themeSelect"); + ns.addContainerProperty("caption", String.class, ""); + ns.setItemCaptionPropertyId("caption"); + for (String identifier : themeVariants.keySet()) { + ns.addItem(identifier).getItemProperty("caption") + .setValue(themeVariants.get(identifier)); + } + + ns.setValue("tests-valo"); + ns.addValueChangeListener(new ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + setTheme((String) ns.getValue()); + } + }); + return ns; + } + + static String[] strings = new String[] { "lorem", "ipsum", "dolor", "sit", + "amet", "consectetur", "quid", "securi", "etiam", "tamquam", "eu", + "fugiat", "nulla", "pariatur" }; + static int stringCount = -1; + + static String nextString(boolean capitalize) { + if (++stringCount >= strings.length) { + stringCount = 0; + } + return capitalize ? strings[stringCount].substring(0, 1).toUpperCase() + + strings[stringCount].substring(1) : strings[stringCount]; + } + + static Handler actionHandler = new Handler() { + private final Action ACTION_ONE = new Action("Action One"); + private final Action ACTION_TWO = new Action("Action Two"); + private final Action ACTION_THREE = new Action("Action Three"); + private final Action[] ACTIONS = new Action[] { ACTION_ONE, ACTION_TWO, + ACTION_THREE }; + + @Override + public void handleAction(Action action, Object sender, Object target) { + Notification.show(action.getCaption()); + } + + @Override + public Action[] getActions(Object target, Object sender) { + return ACTIONS; + } + }; + + static Handler getActionHandler() { + return actionHandler; + } + + static final String CAPTION_PROPERTY = "caption"; + static final String DESCRIPTION_PROPERTY = "description"; + static final String ICON_PROPERTY = "icon"; + static final String INDEX_PROPERTY = "index"; + + @SuppressWarnings("unchecked") + static Container generateContainer(final int size, + final boolean hierarchical) { + IndexedContainer container = hierarchical ? new HierarchicalContainer() + : new IndexedContainer(); + + container.addContainerProperty(CAPTION_PROPERTY, String.class, null); + container.addContainerProperty(ICON_PROPERTY, Resource.class, null); + container.addContainerProperty(INDEX_PROPERTY, Integer.class, null); + container + .addContainerProperty(DESCRIPTION_PROPERTY, String.class, null); + for (int i = 1; i < size + 1; i++) { + Item item = container.addItem(i); + item.getItemProperty(CAPTION_PROPERTY).setValue( + nextString(true) + " " + nextString(false)); + item.getItemProperty(INDEX_PROPERTY).setValue(i); + item.getItemProperty(DESCRIPTION_PROPERTY).setValue( + nextString(true) + " " + nextString(false) + " " + + nextString(false)); + item.getItemProperty(ICON_PROPERTY).setValue(TestIcon.get()); + } + container.getItem(container.getIdByIndex(0)) + .getItemProperty(ICON_PROPERTY).setValue(TestIcon.get()); + + if (hierarchical) { + for (int i = 1; i < size + 1; i++) { + for (int j = 1; j < 5; j++) { + String id = i + " -> " + j; + Item child = container.addItem(id); + child.getItemProperty(CAPTION_PROPERTY).setValue( + nextString(true) + " " + nextString(false)); + child.getItemProperty(ICON_PROPERTY).setValue( + TestIcon.get()); + ((Hierarchical) container).setChildrenAllowed(id, false); + ((Hierarchical) container).setParent(id, i); + } + } + } + return container; + } +} \ No newline at end of file -- cgit v1.2.3