diff --git a/.gitignore b/.gitignore index d1b79181..14786de2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ -/target/ +addon/target/ +demo/target/ .idea/ .settings .project @@ -8,13 +9,19 @@ .DS_Store # The following files are generated/updated by vaadin-maven-plugin -node_modules/ -frontend/generated/ -pnpmfile.js -vite.generated.ts +addon/node_modules/ +addon/frontend/generated/ +addon/pnpmfile.js +addon/vite.generated.ts +demo/node_modules/ +demo/frontend/generated/ +demo/pnpmfile.js +demo/vite.generated.ts # Browser drivers for local integration tests drivers/ # Error screenshots generated by TestBench for failed integration tests -error-screenshots/ -webpack.generated.js \ No newline at end of file +addon/error-screenshots/ +addon/webpack.generated.js +demo/error-screenshots/ +demo/webpack.generated.js diff --git a/frontend/index.html b/demo/frontend/index.html similarity index 96% rename from frontend/index.html rename to demo/frontend/index.html index a5cdd401..d36e5934 100644 --- a/frontend/index.html +++ b/demo/frontend/index.html @@ -3,7 +3,7 @@ This file is auto-generated by Vaadin. --> - + diff --git a/demo/frontend/themes/myapp/styles.css b/demo/frontend/themes/myapp/styles.css new file mode 100644 index 00000000..e69de29b diff --git a/demo/frontend/themes/myapp/theme.json b/demo/frontend/themes/myapp/theme.json new file mode 100644 index 00000000..0f7a81f2 --- /dev/null +++ b/demo/frontend/themes/myapp/theme.json @@ -0,0 +1,3 @@ +{ + "lumoImports" : [ "typography", "color", "spacing", "badge", "utility" ] +} \ No newline at end of file diff --git a/demo/src/main/java/com/example/application/Application.java b/demo/src/main/java/com/example/application/Application.java new file mode 100644 index 00000000..8ae639ce --- /dev/null +++ b/demo/src/main/java/com/example/application/Application.java @@ -0,0 +1,23 @@ +package com.example.application; + +import com.vaadin.flow.component.page.AppShellConfigurator; +import com.vaadin.flow.theme.Theme; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * The entry point of the Spring Boot application. + * + * Use the @PWA annotation make the application installable on phones, tablets + * and some desktop browsers. + * + */ +@SpringBootApplication +@Theme(value = "myapp") +public class Application implements AppShellConfigurator { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/demo/src/main/java/com/example/application/views/empty/EmptyView.java b/demo/src/main/java/com/example/application/views/empty/EmptyView.java new file mode 100644 index 00000000..c8055340 --- /dev/null +++ b/demo/src/main/java/com/example/application/views/empty/EmptyView.java @@ -0,0 +1,33 @@ +package com.example.application.views.empty; + +import com.vaadin.flow.component.html.H2; +import com.vaadin.flow.component.html.Image; +import com.vaadin.flow.component.html.Paragraph; +import com.vaadin.flow.component.orderedlayout.VerticalLayout; +import com.vaadin.flow.router.PageTitle; +import com.vaadin.flow.router.Route; +import com.vaadin.flow.theme.lumo.LumoUtility.Margin; + +@PageTitle("Empty") +@Route(value = "") +public class EmptyView extends VerticalLayout { + + public EmptyView() { + setSpacing(false); + + Image img = new Image("images/empty-plant.png", "placeholder plant"); + img.setWidth("200px"); + add(img); + + H2 header = new H2("This place intentionally left empty"); + header.addClassNames(Margin.Top.XLARGE, Margin.Bottom.MEDIUM); + add(header); + add(new Paragraph("It’s a place where you can grow your own UI 🤗")); + + setSizeFull(); + setJustifyContentMode(JustifyContentMode.CENTER); + setDefaultHorizontalComponentAlignment(Alignment.CENTER); + getStyle().set("text-align", "center"); + } + +} diff --git a/demo/src/main/resources/META-INF/resources/icons/icon.png b/demo/src/main/resources/META-INF/resources/icons/icon.png new file mode 100644 index 00000000..df2ed4bd Binary files /dev/null and b/demo/src/main/resources/META-INF/resources/icons/icon.png differ diff --git a/demo/src/main/resources/META-INF/resources/images/empty-plant.png b/demo/src/main/resources/META-INF/resources/images/empty-plant.png new file mode 100644 index 00000000..9777f260 Binary files /dev/null and b/demo/src/main/resources/META-INF/resources/images/empty-plant.png differ diff --git a/demo/src/main/resources/application.properties b/demo/src/main/resources/application.properties new file mode 100644 index 00000000..09c7b12b --- /dev/null +++ b/demo/src/main/resources/application.properties @@ -0,0 +1,10 @@ +server.port=${PORT:8080} +logging.level.org.atmosphere = warn +spring.mustache.check-template-location = false + +# Launch the default browser when starting the application in development mode +vaadin.launch-browser=true +# To improve the performance during development. +# For more information https://vaadin.com/docs/flow/spring/tutorial-spring-configuration.html#special-configuration-parameters +vaadin.whitelisted-packages = com.vaadin,org.vaadin,dev.hilla,com.example.application +spring.jpa.defer-datasource-initialization = true diff --git a/demo/src/main/resources/banner.txt b/demo/src/main/resources/banner.txt new file mode 100644 index 00000000..519a2bca --- /dev/null +++ b/demo/src/main/resources/banner.txt @@ -0,0 +1,6 @@ + __ __ _ + | \/ |_ _ / \ _ __ _ __ + | |\/| | | | | / _ \ | '_ \| '_ \ + | | | | |_| | / ___ \| |_) | |_) | + |_| |_|\__, | /_/ \_\ .__/| .__/ + |___/ |_| |_| diff --git a/package.json b/package.json deleted file mode 100644 index f21cffa9..00000000 --- a/package.json +++ /dev/null @@ -1,243 +0,0 @@ -{ - "name": "no-name", - "license": "UNLICENSED", - "dependencies": { - "@polymer/polymer": "3.5.1", - "@vaadin/accordion": "24.0.2", - "@vaadin/app-layout": "24.0.2", - "@vaadin/avatar": "24.0.2", - "@vaadin/avatar-group": "24.0.2", - "@vaadin/bundles": "24.0.2", - "@vaadin/button": "24.0.2", - "@vaadin/checkbox": "24.0.2", - "@vaadin/checkbox-group": "24.0.2", - "@vaadin/combo-box": "24.0.2", - "@vaadin/common-frontend": "0.0.17", - "@vaadin/component-base": "24.0.2", - "@vaadin/confirm-dialog": "24.0.2", - "@vaadin/context-menu": "24.0.2", - "@vaadin/cookie-consent": "24.0.2", - "@vaadin/custom-field": "24.0.2", - "@vaadin/date-picker": "24.0.2", - "@vaadin/date-time-picker": "24.0.2", - "@vaadin/details": "24.0.2", - "@vaadin/dialog": "24.0.2", - "@vaadin/email-field": "24.0.2", - "@vaadin/field-base": "24.0.2", - "@vaadin/field-highlighter": "24.0.2", - "@vaadin/form-layout": "24.0.2", - "@vaadin/grid": "24.0.2", - "@vaadin/horizontal-layout": "24.0.2", - "@vaadin/icon": "24.0.2", - "@vaadin/icons": "24.0.2", - "@vaadin/input-container": "24.0.2", - "@vaadin/integer-field": "24.0.2", - "@vaadin/item": "24.0.2", - "@vaadin/list-box": "24.0.2", - "@vaadin/lit-renderer": "24.0.2", - "@vaadin/login": "24.0.2", - "@vaadin/menu-bar": "24.0.2", - "@vaadin/message-input": "24.0.2", - "@vaadin/message-list": "24.0.2", - "@vaadin/multi-select-combo-box": "24.0.2", - "@vaadin/notification": "24.0.2", - "@vaadin/number-field": "24.0.2", - "@vaadin/overlay": "24.0.2", - "@vaadin/password-field": "24.0.2", - "@vaadin/polymer-legacy-adapter": "24.0.2", - "@vaadin/progress-bar": "24.0.2", - "@vaadin/radio-group": "24.0.2", - "@vaadin/router": "1.7.5", - "@vaadin/scroller": "24.0.2", - "@vaadin/select": "24.0.2", - "@vaadin/split-layout": "24.0.2", - "@vaadin/tabs": "24.0.2", - "@vaadin/tabsheet": "24.0.2", - "@vaadin/text-area": "24.0.2", - "@vaadin/text-field": "24.0.2", - "@vaadin/time-picker": "24.0.2", - "@vaadin/tooltip": "24.0.2", - "@vaadin/upload": "24.0.2", - "@vaadin/vaadin-development-mode-detector": "2.0.6", - "@vaadin/vaadin-lumo-styles": "24.0.2", - "@vaadin/vaadin-material-styles": "24.0.2", - "@vaadin/vaadin-themable-mixin": "24.0.2", - "@vaadin/vaadin-usage-statistics": "2.1.2", - "@vaadin/vertical-layout": "24.0.2", - "@vaadin/virtual-list": "24.0.2", - "construct-style-sheets-polyfill": "3.1.0", - "date-fns": "2.29.3", - "lit": "2.6.1" - }, - "devDependencies": { - "@rollup/plugin-replace": "5.0.2", - "@rollup/pluginutils": "5.0.2", - "async": "3.2.2", - "glob": "7.2.3", - "mkdirp": "1.0.4", - "rollup-plugin-brotli": "3.1.0", - "strip-css-comments": "5.0.0", - "transform-ast": "2.4.4", - "typescript": "4.9.3", - "vite": "4.1.3", - "vite-plugin-checker": "0.5.5", - "workbox-build": "6.5.4", - "workbox-core": "6.5.4", - "workbox-precaching": "6.5.4" - }, - "overrides": { - "@vaadin/bundles": "$@vaadin/bundles", - "@vaadin/accordion": "$@vaadin/accordion", - "@vaadin/app-layout": "$@vaadin/app-layout", - "@vaadin/avatar": "$@vaadin/avatar", - "@vaadin/avatar-group": "$@vaadin/avatar-group", - "@vaadin/button": "$@vaadin/button", - "@vaadin/checkbox": "$@vaadin/checkbox", - "@vaadin/checkbox-group": "$@vaadin/checkbox-group", - "@vaadin/combo-box": "$@vaadin/combo-box", - "@vaadin/component-base": "$@vaadin/component-base", - "@vaadin/confirm-dialog": "$@vaadin/confirm-dialog", - "@vaadin/context-menu": "$@vaadin/context-menu", - "@vaadin/custom-field": "$@vaadin/custom-field", - "@vaadin/date-picker": "$@vaadin/date-picker", - "@vaadin/date-time-picker": "$@vaadin/date-time-picker", - "@vaadin/details": "$@vaadin/details", - "@vaadin/dialog": "$@vaadin/dialog", - "@vaadin/email-field": "$@vaadin/email-field", - "@vaadin/field-base": "$@vaadin/field-base", - "@vaadin/field-highlighter": "$@vaadin/field-highlighter", - "@vaadin/form-layout": "$@vaadin/form-layout", - "@vaadin/grid": "$@vaadin/grid", - "@vaadin/horizontal-layout": "$@vaadin/horizontal-layout", - "@vaadin/icon": "$@vaadin/icon", - "@vaadin/icons": "$@vaadin/icons", - "@vaadin/input-container": "$@vaadin/input-container", - "@vaadin/integer-field": "$@vaadin/integer-field", - "@vaadin/item": "$@vaadin/item", - "@vaadin/list-box": "$@vaadin/list-box", - "@vaadin/lit-renderer": "$@vaadin/lit-renderer", - "@vaadin/login": "$@vaadin/login", - "@vaadin/menu-bar": "$@vaadin/menu-bar", - "@vaadin/message-input": "$@vaadin/message-input", - "@vaadin/message-list": "$@vaadin/message-list", - "@vaadin/multi-select-combo-box": "$@vaadin/multi-select-combo-box", - "@vaadin/notification": "$@vaadin/notification", - "@vaadin/number-field": "$@vaadin/number-field", - "@vaadin/overlay": "$@vaadin/overlay", - "@vaadin/password-field": "$@vaadin/password-field", - "@vaadin/polymer-legacy-adapter": "$@vaadin/polymer-legacy-adapter", - "@vaadin/progress-bar": "$@vaadin/progress-bar", - "@vaadin/radio-group": "$@vaadin/radio-group", - "@vaadin/scroller": "$@vaadin/scroller", - "@vaadin/select": "$@vaadin/select", - "@vaadin/split-layout": "$@vaadin/split-layout", - "@vaadin/tabs": "$@vaadin/tabs", - "@vaadin/tabsheet": "$@vaadin/tabsheet", - "@vaadin/text-area": "$@vaadin/text-area", - "@vaadin/text-field": "$@vaadin/text-field", - "@vaadin/time-picker": "$@vaadin/time-picker", - "@vaadin/tooltip": "$@vaadin/tooltip", - "@vaadin/upload": "$@vaadin/upload", - "@vaadin/vaadin-development-mode-detector": "$@vaadin/vaadin-development-mode-detector", - "@vaadin/vaadin-lumo-styles": "$@vaadin/vaadin-lumo-styles", - "@vaadin/vaadin-material-styles": "$@vaadin/vaadin-material-styles", - "@vaadin/router": "$@vaadin/router", - "@vaadin/vaadin-usage-statistics": "$@vaadin/vaadin-usage-statistics", - "@vaadin/vertical-layout": "$@vaadin/vertical-layout", - "@vaadin/virtual-list": "$@vaadin/virtual-list", - "@vaadin/common-frontend": "$@vaadin/common-frontend", - "construct-style-sheets-polyfill": "$construct-style-sheets-polyfill", - "lit": "$lit", - "@polymer/polymer": "$@polymer/polymer", - "@vaadin/vaadin-themable-mixin": "$@vaadin/vaadin-themable-mixin", - "@vaadin/cookie-consent": "$@vaadin/cookie-consent", - "date-fns": "$date-fns" - }, - "vaadin": { - "dependencies": { - "@polymer/polymer": "3.5.1", - "@vaadin/accordion": "24.0.2", - "@vaadin/app-layout": "24.0.2", - "@vaadin/avatar": "24.0.2", - "@vaadin/avatar-group": "24.0.2", - "@vaadin/bundles": "24.0.2", - "@vaadin/button": "24.0.2", - "@vaadin/checkbox": "24.0.2", - "@vaadin/checkbox-group": "24.0.2", - "@vaadin/combo-box": "24.0.2", - "@vaadin/common-frontend": "0.0.17", - "@vaadin/component-base": "24.0.2", - "@vaadin/confirm-dialog": "24.0.2", - "@vaadin/context-menu": "24.0.2", - "@vaadin/cookie-consent": "24.0.2", - "@vaadin/custom-field": "24.0.2", - "@vaadin/date-picker": "24.0.2", - "@vaadin/date-time-picker": "24.0.2", - "@vaadin/details": "24.0.2", - "@vaadin/dialog": "24.0.2", - "@vaadin/email-field": "24.0.2", - "@vaadin/field-base": "24.0.2", - "@vaadin/field-highlighter": "24.0.2", - "@vaadin/form-layout": "24.0.2", - "@vaadin/grid": "24.0.2", - "@vaadin/horizontal-layout": "24.0.2", - "@vaadin/icon": "24.0.2", - "@vaadin/icons": "24.0.2", - "@vaadin/input-container": "24.0.2", - "@vaadin/integer-field": "24.0.2", - "@vaadin/item": "24.0.2", - "@vaadin/list-box": "24.0.2", - "@vaadin/lit-renderer": "24.0.2", - "@vaadin/login": "24.0.2", - "@vaadin/menu-bar": "24.0.2", - "@vaadin/message-input": "24.0.2", - "@vaadin/message-list": "24.0.2", - "@vaadin/multi-select-combo-box": "24.0.2", - "@vaadin/notification": "24.0.2", - "@vaadin/number-field": "24.0.2", - "@vaadin/overlay": "24.0.2", - "@vaadin/password-field": "24.0.2", - "@vaadin/polymer-legacy-adapter": "24.0.2", - "@vaadin/progress-bar": "24.0.2", - "@vaadin/radio-group": "24.0.2", - "@vaadin/router": "1.7.5", - "@vaadin/scroller": "24.0.2", - "@vaadin/select": "24.0.2", - "@vaadin/split-layout": "24.0.2", - "@vaadin/tabs": "24.0.2", - "@vaadin/tabsheet": "24.0.2", - "@vaadin/text-area": "24.0.2", - "@vaadin/text-field": "24.0.2", - "@vaadin/time-picker": "24.0.2", - "@vaadin/tooltip": "24.0.2", - "@vaadin/upload": "24.0.2", - "@vaadin/vaadin-development-mode-detector": "2.0.6", - "@vaadin/vaadin-lumo-styles": "24.0.2", - "@vaadin/vaadin-material-styles": "24.0.2", - "@vaadin/vaadin-themable-mixin": "24.0.2", - "@vaadin/vaadin-usage-statistics": "2.1.2", - "@vaadin/vertical-layout": "24.0.2", - "@vaadin/virtual-list": "24.0.2", - "construct-style-sheets-polyfill": "3.1.0", - "date-fns": "2.29.3", - "lit": "2.6.1" - }, - "devDependencies": { - "@rollup/plugin-replace": "5.0.2", - "@rollup/pluginutils": "5.0.2", - "async": "3.2.2", - "glob": "7.2.3", - "mkdirp": "1.0.4", - "rollup-plugin-brotli": "3.1.0", - "strip-css-comments": "5.0.0", - "transform-ast": "2.4.4", - "typescript": "4.9.3", - "vite": "4.1.3", - "vite-plugin-checker": "0.5.5", - "workbox-build": "6.5.4", - "workbox-core": "6.5.4", - "workbox-precaching": "6.5.4" - }, - "hash": "a311d5663e35d15b3c49c7cb1eff9bdbc74f80047463d0c6b34cece5d5aa6e68" - } -} diff --git a/pom.xml b/pom.xml index 9a417a35..419ac502 100644 --- a/pom.xml +++ b/pom.xml @@ -1,346 +1,19 @@ - + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 - org.vaadin.addons.mygroup - addon-example - 1.0.0-SNAPSHOT - Add-on for Vaadin - ###Project Name### - - - 24.0.2 - - 17 - 17 - UTF-8 - UTF-8 - - - - ###author### - - - - Apache 2 - https://www.apache.org/licenses/LICENSE-2.0.txt - repo - - - - - - com.vaadin - vaadin-bom - pom - import - ${vaadin.version} - - - - - - - - central - https://repo.maven.apache.org/maven2 - - false - - - - vaadin-prereleases - - https://maven.vaadin.com/vaadin-prereleases/ - - - false - - - - - Vaadin Directory - https://maven.vaadin.com/vaadin-addons - - false - - - - - - - - central - https://repo.maven.apache.org/maven2 - - false - - - - vaadin-prereleases - - https://maven.vaadin.com/vaadin-prereleases/ - - - false - - - - - - - com.vaadin - - vaadin-core - - - org.slf4j - slf4j-simple - test - - - com.vaadin - vaadin-testbench - test - - - io.github.bonigarcia - webdrivermanager - 3.8.1 - test - - - - - jetty:run - - - org.apache.maven.plugins - maven-jar-plugin - 3.1.0 - - - true - - false - true - - - - 1 - - - - - META-INF/VAADIN/config/flow-build-info.json - - - - - - org.eclipse.jetty - jetty-maven-plugin - 11.0.15 - - -1 - - true - - jar - - - - - - - com.vaadin - vaadin-maven-plugin - ${vaadin.version} - - - - prepare-frontend - - - - - - - - - - - production - - true - - - - - com.vaadin - flow-server-production-mode - - - - - - - com.vaadin - vaadin-maven-plugin - - - - build-frontend - - compile - - - - - - - - directory - - - - org.apache.maven.plugins - maven-assembly-plugin - 3.3.0 - - false - - src/main/assembly/assembly.xml - - - - - - single - - install - - - - - org.apache.maven.plugins - maven-source-plugin - 3.2.1 - - - attach-sources - verify - - jar-no-fork - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.3.1 - - - attach-javadocs - verify - - jar - - - - - true - none - - - - org.apache.maven.plugins - maven-jar-plugin - 3.2.2 - - - - - META-INF/VAADIN/config/flow-build-info.json - - - - - - - - - it - - - - org.eclipse.jetty - jetty-maven-plugin - - 0 - 8081 - true - - jar - - 15 - ${project.artifactId} - - - - start-jetty - pre-integration-test - - start - - - - stop-jetty - post-integration-test - - stop - - - - - - - maven-surefire-plugin - - true - - - - - - org.apache.maven.plugins - maven-failsafe-plugin - 3.0.0-M5 - - - - integration-test - verify - - - - - false - true - - - - - - - + org.vaadin.addons.nps + nps-parent + pom + 1.0 + NPS for Vaadin + A Net Promoter Score questionnaire widget for Vaadin + + addon + demo + + \ No newline at end of file diff --git a/src/main/assembly/MANIFEST.MF b/src/main/assembly/MANIFEST.MF deleted file mode 100644 index f7981101..00000000 --- a/src/main/assembly/MANIFEST.MF +++ /dev/null @@ -1,6 +0,0 @@ -Manifest-Version: 1.0 -Vaadin-Package-Version: 1 -Vaadin-Addon: ${project.build.finalName}.${project.packaging} -Implementation-Vendor: ${organization.name} -Implementation-Title: ${project.name} -Implementation-Version: ${project.version} diff --git a/src/main/assembly/assembly.xml b/src/main/assembly/assembly.xml deleted file mode 100644 index dbb78660..00000000 --- a/src/main/assembly/assembly.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - game-card - - - zip - - - - false - - - - .. - - LICENSE - README.md - - - - target - - - *.jar - *.pdf - - - - - - - - src/main/assembly/MANIFEST.MF - META-INF - true - - - \ No newline at end of file diff --git a/src/main/java/org/vaadin/addons/mygroup/NPS.java b/src/main/java/org/vaadin/addons/mygroup/NPS.java deleted file mode 100644 index ded446f5..00000000 --- a/src/main/java/org/vaadin/addons/mygroup/NPS.java +++ /dev/null @@ -1,78 +0,0 @@ -package org.vaadin.addons.mygroup; - -import com.vaadin.flow.component.Text; -import com.vaadin.flow.component.button.Button; -import com.vaadin.flow.component.button.ButtonVariant; -import com.vaadin.flow.component.customfield.CustomField; -import com.vaadin.flow.component.html.Span; -import com.vaadin.flow.component.orderedlayout.HorizontalLayout; -import com.vaadin.flow.theme.lumo.LumoUtility; - -public class NPS extends CustomField { - - private Integer score; - private Span title; - private HorizontalLayout buttons; - - public NPS() { - this.title = new Span( - "On a scale of 1 to 10, how likely would you recommend this to your friend or colleague?"); - this.buttons = new HorizontalLayout(); - buttons.add(new Text("Not likely")); - for (int i = 1; i <= 10; i++) { - Button button = new Button(String.valueOf(i), e -> { - this.score = Integer.parseInt(e.getSource().getText()); - updateButtonSate(); - setModelValue(this.score, true); - }); - button.addThemeVariants(ButtonVariant.MATERIAL_CONTAINED); - button.addClassName(LumoUtility.Padding.XSMALL); - button.getStyle() - .set("min-width", " var(--lumo-button-size)") - .set("max-width", " var(--lumo-button-size)"); - buttons.add(button); - } - buttons.add(new Text("Very likely")); - this.add(title, buttons); - - this.getStyle().set("text-align", "center"); - } - - @Override - protected Integer generateModelValue() { - return this.score; - } - - @Override - protected void setPresentationValue(Integer score) { - this.score = score; - updateButtonSate(); - } - - private void updateButtonSate() { - this.buttons - .getChildren() - .filter(c -> c instanceof Button) - .forEach(c -> { - Button b = (Button) c; - if (score != null && score.equals(Integer.parseInt(b.getText()))) { - b.addClassName(LumoUtility.Background.SUCCESS_50); - b.addClassName(LumoUtility.TextColor.SUCCESS_CONTRAST); - } else { - b.removeClassName(LumoUtility.Background.SUCCESS_50); - b.removeClassName(LumoUtility.TextColor.SUCCESS_CONTRAST); - } - ; - }); - } - - @Override - public void setReadOnly(boolean readOnly) { - super.setReadOnly(readOnly); - this.buttons - .getChildren() - .filter(c -> c instanceof Button) - .forEach(c -> ((Button) c).setEnabled(!readOnly)); - } - -} diff --git a/src/test/java/org/vaadin/addons/mygroup/AbstractViewTest.java b/src/test/java/org/vaadin/addons/mygroup/AbstractViewTest.java deleted file mode 100644 index e7a159c9..00000000 --- a/src/test/java/org/vaadin/addons/mygroup/AbstractViewTest.java +++ /dev/null @@ -1,134 +0,0 @@ -package org.vaadin.addons.mygroup; - -import io.github.bonigarcia.wdm.WebDriverManager; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Rule; -import org.openqa.selenium.By; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; - -import com.vaadin.flow.theme.AbstractTheme; -import com.vaadin.testbench.ScreenshotOnFailureRule; -import com.vaadin.testbench.TestBench; -import com.vaadin.testbench.parallel.ParallelTest; - -/** - * Base class for TestBench IntegrationTests on chrome. - *

- * The tests use Chrome driver (see pom.xml for integration-tests profile) to - * run integration tests on a headless Chrome. If a property {@code test.use - * .hub} is set to true, {@code AbstractViewTest} will assume that the - * TestBench test is running in a CI environment. In order to keep the this - * class light, it makes certain assumptions about the CI environment (such - * as available environment variables). It is not advisable to use this class - * as a base class for you own TestBench tests. - *

- * To learn more about TestBench, visit - * Vaadin TestBench. - */ -public abstract class AbstractViewTest extends ParallelTest { - private static final int SERVER_PORT = 8080; - - private final String route; - private final By rootSelector; - - @Rule - public ScreenshotOnFailureRule rule = new ScreenshotOnFailureRule(this, - false); - - public AbstractViewTest() { - this("", By.tagName("body")); - } - - protected AbstractViewTest(String route, By rootSelector) { - this.route = route; - this.rootSelector = rootSelector; - } - - @BeforeClass - public static void setupClass() { - WebDriverManager.chromedriver().setup(); - } - - - @Before - public void setup() throws Exception { - if (isUsingHub()) { - super.setup(); - } else { - setDriver(TestBench.createDriver(new ChromeDriver())); - } - getDriver().get(getURL(route)); - } - - /** - * Convenience method for getting the root element of the view based on - * the selector passed to the constructor. - * - * @return the root element - */ - protected WebElement getRootElement() { - return findElement(rootSelector); - } - - /** - * Asserts that the given {@code element} is rendered using a theme - * identified by {@code themeClass}. If the the is not found, JUnit - * assert will fail the test case. - * - * @param element web element to check for the theme - * @param themeClass theme class (such as {@code Lumo.class} - */ - protected void assertThemePresentOnElement( - WebElement element, Class themeClass) { - String themeName = themeClass.getSimpleName().toLowerCase(); - Boolean hasStyle = (Boolean) executeScript("" + - "var styles = Array.from(arguments[0]._template.content" + - ".querySelectorAll('style'))" + - ".filter(style => style.textContent.indexOf('" + - themeName + "') > -1);" + - "return styles.length > 0;", element); - - Assert.assertTrue("Element '" + element.getTagName() + "' should have" + - " had theme '" + themeClass.getSimpleName() + "'.", - hasStyle); - } - - /** - * Property set to true when running on a test hub. - */ - private static final String USE_HUB_PROPERTY = "test.use.hub"; - - /** - * Returns deployment host name concatenated with route. - * - * @return URL to route - */ - private static String getURL(String route) { - return String.format("http://%s:%d/%s", getDeploymentHostname(), - SERVER_PORT, route); - } - - /** - * Returns whether we are using a test hub. This means that the starter - * is running tests in Vaadin's CI environment, and uses TestBench to - * connect to the testing hub. - * - * @return whether we are using a test hub - */ - private static boolean isUsingHub() { - return Boolean.TRUE.toString().equals( - System.getProperty(USE_HUB_PROPERTY)); - } - - /** - * If running on CI, get the host name from environment variable HOSTNAME - * - * @return the host name - */ - private static String getDeploymentHostname() { - return isUsingHub() ? System.getenv("HOSTNAME") : "localhost"; - } -} \ No newline at end of file diff --git a/src/test/java/org/vaadin/addons/mygroup/AddonIT.java b/src/test/java/org/vaadin/addons/mygroup/AddonIT.java deleted file mode 100644 index 8c11a488..00000000 --- a/src/test/java/org/vaadin/addons/mygroup/AddonIT.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.vaadin.addons.mygroup; - -import com.vaadin.flow.component.html.testbench.DivElement; -import org.junit.Assert; -import org.junit.Test; - - -public class AddonIT extends AbstractViewTest { - - @Test - public void addonTextIsRendered() { - DivElement divElement = $(DivElement.class).id("theAddon"); - Assert.assertNotNull(divElement); - Assert.assertEquals("Hello", divElement.getText()); - } -} diff --git a/src/test/java/org/vaadin/addons/mygroup/AddonView.java b/src/test/java/org/vaadin/addons/mygroup/AddonView.java deleted file mode 100644 index 6da310d9..00000000 --- a/src/test/java/org/vaadin/addons/mygroup/AddonView.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.vaadin.addons.mygroup; - -import com.vaadin.flow.component.button.Button; -import com.vaadin.flow.component.html.Paragraph; -import com.vaadin.flow.component.notification.Notification; -import com.vaadin.flow.component.orderedlayout.VerticalLayout; -import com.vaadin.flow.router.Route; - -@Route("") -public class AddonView extends VerticalLayout { - - public AddonView() { - final NPS nps = new NPS(); - nps.setId("nps"); // This is for automated tests - - // Button to start the feed process - add(new Button("Ask NPS", e -> { - add(nps); - })); - - // Get the score and remove component - nps.addValueChangeListener(e -> { - Notification.show("Value changed from " + e.getOldValue() + " to " + e.getValue()); - add(new Paragraph("NPS: " + e.getOldValue() + " -> " + e.getValue())); - remove(nps); - }); - - // Edit the the score - add(new Button("Edit score", e -> { - nps.setValue((int) Math.ceil(Math.random() * 10)); - add(nps); - })); - - // Test read-only state - add(new Button("Toggle read-only", e -> { - nps.setReadOnly(!nps.isReadOnly()); - })); - - - } -} diff --git a/tsconfig.json b/tsconfig.json deleted file mode 100644 index 37f32e77..00000000 --- a/tsconfig.json +++ /dev/null @@ -1,39 +0,0 @@ -// This TypeScript configuration file is generated by vaadin-maven-plugin. -// This is needed for TypeScript compiler to compile your TypeScript code in the project. -// It is recommended to commit this file to the VCS. -// You might want to change the configurations to fit your preferences -// For more information about the configurations, please refer to http://www.typescriptlang.org/docs/handbook/tsconfig-json.html -{ - "flow_version": "23.3.4", - "compilerOptions": { - "sourceMap": true, - "jsx": "react-jsx", - "inlineSources": true, - "module": "esNext", - "target": "es2020", - "moduleResolution": "node", - "strict": true, - "skipLibCheck": true, - "noFallthroughCasesInSwitch": true, - "noImplicitReturns": true, - "noImplicitAny": true, - "noImplicitThis": true, - "noUnusedLocals": false, - "noUnusedParameters": false, - "experimentalDecorators": true, - "useDefineForClassFields": false, - "baseUrl": "frontend", - "paths": { - "@vaadin/flow-frontend": ["generated/jar-resources"], - "@vaadin/flow-frontend/*": ["generated/jar-resources/*"], - "Frontend/*": ["*"] - } - }, - "include": [ - "frontend/**/*", - "types.d.ts" - ], - "exclude": [ - "frontend/generated/jar-resources/**" - ] -} diff --git a/types.d.ts b/types.d.ts deleted file mode 100644 index 250302bd..00000000 --- a/types.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -// This TypeScript modules definition file is generated by vaadin-maven-plugin. -// You can not directly import your different static files into TypeScript, -// This is needed for TypeScript compiler to declare and export as a TypeScript module. -// It is recommended to commit this file to the VCS. -// You might want to change the configurations to fit your preferences -declare module '*.css' { - import { CSSResultGroup } from 'lit'; - const content: CSSResultGroup; - export default content; -} diff --git a/webpack.config.js b/webpack.config.js deleted file mode 100644 index 13314929..00000000 --- a/webpack.config.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * This file contains project specific customizations for the webpack build. - * It is autogenerated if it didn't exist or if it was made for an older - * incompatible version. - * - * Defaults are provided in an autogenerated webpack.generated.js file and used by this file. - * The webpack.generated.js file is overwritten on each build and no customization can be done there. - */ -const merge = require('webpack-merge'); -const flowDefaults = require('./webpack.generated.js'); - -/** - * To change the webpack config, add a new configuration object in - * the merge arguments below: - */ -module.exports = merge(flowDefaults, - // Override default configuration - // { - // mode: 'development', - // devtool: 'inline-source-map', - // }, - - // Add a custom plugin - // (install the plugin with `npm install --save-dev webpack-bundle-analyzer`) - // { - // plugins: [ - // new require('webpack-bundle-analyzer').BundleAnalyzerPlugin({ - // analyzerMode: 'static' - // }) - // ] - // }, -);