├── demo-jquery-table ├── src │ ├── main │ │ ├── webapp │ │ │ └── frontend │ │ │ │ ├── vaadin-flow-bundle-manifest.json │ │ │ │ ├── index.html │ │ │ │ ├── bower.json │ │ │ │ ├── package.json │ │ │ │ ├── polymer.json │ │ │ │ └── css │ │ │ │ └── site.css │ │ └── java │ │ │ └── com │ │ │ └── vaadin │ │ │ └── flow │ │ │ └── demo │ │ │ └── jquerytable │ │ │ ├── persistence │ │ │ ├── IssueType.java │ │ │ ├── IssuePriority.java │ │ │ ├── Project.java │ │ │ ├── ProjectVersion.java │ │ │ └── BaseEntity.java │ │ │ └── element │ │ │ ├── tablesorter │ │ │ ├── SelectionChangeEvent.java │ │ │ └── RichColumn.java │ │ │ └── html │ │ │ ├── Option.java │ │ │ └── Select.java │ └── test │ │ └── java │ │ └── com │ │ └── vaadin │ │ └── flow │ │ └── demo │ │ └── persistence │ │ └── IssuesRepositoryTest.java └── .gitignore ├── demo-contact-form └── src │ └── main │ ├── webapp │ └── frontend │ │ └── src │ │ └── style.css │ └── java │ └── com │ └── vaadin │ └── flow │ └── demo │ └── contactform │ └── ui │ └── Contact.java ├── demo-web-site └── src │ └── main │ ├── resources │ └── META-INF │ │ └── services │ │ └── com.vaadin.flow.server.VaadinServiceInitListener │ ├── webapp │ └── frontend │ │ └── images │ │ └── vaadin-logo-small.png │ └── java │ └── com │ └── vaadin │ └── flow │ └── demo │ └── website │ ├── AboutView.java │ ├── HomeView.java │ ├── SimpleView.java │ ├── ParameterView.java │ └── SiteServiceInitListener.java ├── create_and_run_demos_container.sh ├── demo-registration-form └── src │ └── main │ ├── webapp │ └── frontend │ │ └── src │ │ ├── check.png │ │ ├── cross.png │ │ └── style.css │ └── java │ └── com │ └── vaadin │ └── flow │ └── demo │ └── registrationform │ └── ui │ ├── RegistrationTextField.java │ ├── RegistrationPasswordField.java │ ├── Person.java │ ├── AbstractTextField.java │ └── PasswordValidator.java ├── demo-static-menu-router └── src │ ├── main │ ├── webapp │ │ └── frontend │ │ │ └── images │ │ │ └── vaadin-logo-small.png │ ├── java │ │ └── com │ │ │ └── vaadin │ │ │ └── flow │ │ │ └── demo │ │ │ └── staticmenu │ │ │ ├── download │ │ │ ├── DownloadView.java │ │ │ ├── IconsView.java │ │ │ ├── IconsAboutView.java │ │ │ ├── DownloadMenuView.java │ │ │ ├── IconsMenuView.java │ │ │ └── DocsView.java │ │ │ ├── elements │ │ │ ├── ElementsView.java │ │ │ ├── ElementDemoView.java │ │ │ └── ElementsMenuView.java │ │ │ ├── framework │ │ │ ├── FrameworkView.java │ │ │ ├── TutorialView.java │ │ │ └── FrameworkMenuBar.java │ │ │ ├── HomeView.java │ │ │ ├── MainLayout.java │ │ │ ├── ApplicationServlet.java │ │ │ ├── DummyView.java │ │ │ ├── IllegalArgumentsError.java │ │ │ ├── community │ │ │ └── blog │ │ │ │ ├── backend │ │ │ │ └── BlogRecord.java │ │ │ │ └── BlogList.java │ │ │ └── Util.java │ └── resources │ │ └── i18n │ │ ├── translations_ja.properties │ │ ├── translations_en_GB.properties │ │ └── translations_fi_FI.properties │ └── test │ └── java │ └── com │ └── vaadin │ └── flow │ └── demo │ └── website │ ├── BlogPostIT.java │ └── HomePageIT.java ├── Dockerfile ├── .gitignore ├── demo-minesweeper-element └── src │ ├── main │ ├── webapp │ │ └── frontend │ │ │ └── minesweeper.css │ └── java │ │ └── com │ │ └── vaadin │ │ └── flow │ │ └── demo │ │ └── minesweeper │ │ └── element │ │ └── Point.java │ └── test │ └── java │ └── com │ └── vaadin │ └── flow │ └── demo │ └── minesweeper │ └── element │ ├── MinesweeperIT.java │ └── MinesweeperPageObject.java ├── demo-minesweeper-component └── src │ ├── main │ ├── webapp │ │ └── frontend │ │ │ └── minesweeper.css │ └── java │ │ └── com │ │ └── vaadin │ │ └── flow │ │ └── demo │ │ └── minesweeper │ │ └── component │ │ ├── component │ │ ├── Notification.java │ │ └── Row.java │ │ ├── MinesweeperView.java │ │ └── data │ │ └── Point.java │ └── test │ └── java │ └── com │ └── vaadin │ └── flow │ └── demo │ └── minesweeper │ └── component │ ├── MinesweeperIT.java │ └── MinesweeperPageObject.java ├── demo-spring-boot ├── frontend │ └── styles.js └── src │ └── main │ └── java │ └── com │ └── vaadin │ └── flow │ └── demo │ └── contactform │ └── ui │ └── ContactFormApplication.java ├── demo-dynamic-menu └── src │ └── main │ ├── webapp │ └── frontend │ │ └── css │ │ └── site.css │ └── java │ └── com │ └── vaadin │ └── flow │ └── demo │ └── dynamicmenu │ ├── HomeView.java │ ├── data │ ├── Category.java │ └── Product.java │ ├── ErrorView.java │ ├── MenuItemComponent.java │ ├── MainLayout.java │ └── backend │ ├── DataService.java │ └── MockDataService.java ├── demo-server └── webapps │ └── ROOT │ └── flow-logo.svg ├── demo-utils └── pom.xml ├── demo-hello-worlds └── src │ └── main │ ├── webapp │ └── frontend │ │ └── src │ │ ├── styles.css │ │ └── HelloWorld.html │ └── java │ └── com │ └── vaadin │ └── flow │ └── demo │ └── helloworld │ └── Entrypoint.java ├── demo-test-util ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── vaadin │ └── flow │ └── demo │ └── testutil │ └── AbstractChromeTest.java ├── .dockerignore ├── demo-date-field ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── vaadin │ │ └── flow │ │ └── demo │ │ └── datefield │ │ └── customelement │ │ ├── ApplicationServlet.java │ │ ├── DateView.java │ │ └── SelectElement.java │ └── test │ └── java │ └── com │ └── vaadin │ └── flow │ └── demo │ └── datefield │ └── customelement │ └── DateFieldIT.java ├── demo-textfield-component ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── vaadin │ │ └── flow │ │ └── demo │ │ └── textfieldcomponent │ │ ├── ApplicationServlet.java │ │ └── TextFieldView.java │ └── test │ └── java │ └── com │ └── vaadin │ └── flow │ └── demo │ └── textfieldcomponent │ └── TextFieldIT.java ├── demo-google-signin └── src │ ├── main │ ├── webapp │ │ └── frontend │ │ │ └── components │ │ │ ├── info.html │ │ │ └── signin.html │ └── java │ │ └── com │ │ └── vaadin │ │ └── flow │ │ └── demo │ │ └── googlesignin │ │ ├── model │ │ └── ProfileInfo.java │ │ └── component │ │ └── SigninInfo.java │ └── test │ └── java │ └── com │ └── vaadin │ └── flow │ └── demo │ └── googlesignin │ └── component │ └── SigninIT.java ├── demo-textfield-composite ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── vaadin │ │ └── flow │ │ └── demo │ │ └── textfieldcomposite │ │ ├── ApplicationServlet.java │ │ └── TextFieldView.java │ └── test │ └── java │ └── com │ └── vaadin │ └── flow │ └── demo │ └── component │ └── textfield │ └── TextFieldIT.java ├── demo-addressbook-polymer └── src │ └── main │ ├── java │ └── com │ │ └── vaadin │ │ └── flow │ │ └── demo │ │ └── addressbook │ │ └── ui │ │ └── SerializableConsumer.java │ └── webapp │ └── frontend │ └── components │ ├── ContactForm.html │ └── ContactsTable.html ├── demo-dynamic-routes └── src │ └── main │ └── java │ └── com │ └── vaadin │ └── flow │ └── demo │ ├── MainLayout.java │ ├── LooseCenterLayout.java │ ├── NoRouteError.java │ ├── dynamic │ ├── VersionView.java │ ├── TimeView.java │ └── UserView.java │ └── GlobalView.java ├── README.md ├── demo-route-menu └── src │ └── main │ ├── java │ └── com │ │ └── vaadin │ │ └── flow │ │ └── demo │ │ └── menu │ │ └── routes │ │ ├── SubView.java │ │ ├── FanOut.java │ │ ├── Home.java │ │ └── RayTrace.java │ └── webapp │ └── frontend │ └── styles │ └── styles.css ├── demo-minesweeper-polymer └── src │ ├── test │ └── java │ │ └── com │ │ └── vaadin │ │ └── flow │ │ └── demo │ │ └── minesweeper │ │ └── component │ │ ├── MinesweeperIT.java │ │ └── MinesweeperPageObject.java │ └── main │ ├── java │ └── com │ │ └── vaadin │ │ └── flow │ │ └── demo │ │ └── minesweeper │ │ └── component │ │ ├── component │ │ └── Notification.java │ │ ├── MinesweeperView.java │ │ └── data │ │ └── Point.java │ └── webapp │ └── frontend │ └── components │ └── minesweeper.html ├── demo-validator └── pom.xml ├── demo-model-converters └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── vaadin │ │ │ └── flow │ │ │ └── demo │ │ │ └── helloworld │ │ │ └── template │ │ │ ├── LongToStringConverter.java │ │ │ ├── DateToDateBeanConverter.java │ │ │ └── DateBean.java │ └── webapp │ │ └── frontend │ │ └── components │ │ └── SignInForm.html │ └── test │ └── java │ └── com │ └── vaadin │ └── flow │ └── demo │ └── helloworld │ └── template │ └── SignInFormIT.java └── demo-todo-template └── src ├── main ├── webapp │ └── frontend │ │ └── components │ │ └── TodoTemplate.html └── java │ └── com │ └── vaadin │ └── flow │ └── demo │ └── helloworld │ └── template │ ├── Todo.java │ └── TodoList.java └── test └── java └── com └── vaadin └── flow └── demo └── helloworld └── template └── TodoIT.java /demo-jquery-table/src/main/webapp/frontend/vaadin-flow-bundle-manifest.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /demo-jquery-table/.gitignore: -------------------------------------------------------------------------------- 1 | # Frontend 2 | bower_components 3 | node 4 | node_modules 5 | etc 6 | build 7 | -------------------------------------------------------------------------------- /demo-contact-form/src/main/webapp/frontend/src/style.css: -------------------------------------------------------------------------------- 1 | vaadin-text-field, vaadin-checkbox { 2 | display:block; 3 | } -------------------------------------------------------------------------------- /demo-web-site/src/main/resources/META-INF/services/com.vaadin.flow.server.VaadinServiceInitListener: -------------------------------------------------------------------------------- 1 | com.vaadin.flow.demo.website.SiteServiceInitListener 2 | -------------------------------------------------------------------------------- /create_and_run_demos_container.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | docker build -t flow-demos . 3 | docker rm flow-demos 4 | docker run -p 8080:8080 -d --name flow-demos flow-demos 5 | -------------------------------------------------------------------------------- /demo-registration-form/src/main/webapp/frontend/src/check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vaadin/flow-demo/HEAD/demo-registration-form/src/main/webapp/frontend/src/check.png -------------------------------------------------------------------------------- /demo-registration-form/src/main/webapp/frontend/src/cross.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vaadin/flow-demo/HEAD/demo-registration-form/src/main/webapp/frontend/src/cross.png -------------------------------------------------------------------------------- /demo-web-site/src/main/webapp/frontend/images/vaadin-logo-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vaadin/flow-demo/HEAD/demo-web-site/src/main/webapp/frontend/images/vaadin-logo-small.png -------------------------------------------------------------------------------- /demo-static-menu-router/src/main/webapp/frontend/images/vaadin-logo-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vaadin/flow-demo/HEAD/demo-static-menu-router/src/main/webapp/frontend/images/vaadin-logo-small.png -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM tomcat:9.0.10-jre8-alpine 2 | COPY demo-server/ ${CATALINA_HOME}/ 3 | COPY */target/*.war ${CATALINA_HOME}/webapps/ 4 | RUN ln -s ${CATALINA_HOME}/webapps/$(basename ${CATALINA_HOME}/webapps/demo-flow-components-*.war .war) ${CATALINA_HOME}/webapps/components 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .project 2 | .settings 3 | .classpath 4 | target/ 5 | 6 | */.project 7 | */.settings 8 | */.classpath 9 | */target 10 | 11 | *pom.xml.versionsBackup 12 | *~ 13 | hs_err_pid* 14 | error-screenshots 15 | 16 | # Idea 17 | .idea 18 | *.iml 19 | 20 | .DS_Store 21 | -------------------------------------------------------------------------------- /demo-jquery-table/src/main/webapp/frontend/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /demo-minesweeper-element/src/main/webapp/frontend/minesweeper.css: -------------------------------------------------------------------------------- 1 | td { 2 | background: grey; 3 | border: 1px solid black; 4 | width: 20px; 5 | height: 20px; 6 | text-align: center; 7 | } 8 | 9 | .empty { 10 | background: white; 11 | } 12 | 13 | .mine { 14 | background: red; 15 | } 16 | 17 | .marked { 18 | background: yellow; 19 | } 20 | -------------------------------------------------------------------------------- /demo-minesweeper-component/src/main/webapp/frontend/minesweeper.css: -------------------------------------------------------------------------------- 1 | td { 2 | background: grey; 3 | border: 1px solid black; 4 | width: 20px; 5 | height: 20px; 6 | text-align: center; 7 | } 8 | 9 | .empty { 10 | background: white; 11 | } 12 | 13 | .mine { 14 | background: red; 15 | } 16 | 17 | .marked { 18 | background: yellow; 19 | } 20 | -------------------------------------------------------------------------------- /demo-spring-boot/frontend/styles.js: -------------------------------------------------------------------------------- 1 | const $_documentContainer = document.createElement('template'); 2 | 3 | $_documentContainer.innerHTML = ` 4 | 9 | `; 10 | 11 | document.head.appendChild($_documentContainer.content); 12 | -------------------------------------------------------------------------------- /demo-registration-form/src/main/webapp/frontend/src/style.css: -------------------------------------------------------------------------------- 1 | .error { 2 | color: red; 3 | padding-left: 25px; 4 | margin-left: 10px; 5 | background-image: url("cross.png"); 6 | background-repeat: no-repeat; 7 | } 8 | 9 | .ok { 10 | background-image: url("check.png"); 11 | background-repeat: no-repeat; 12 | padding-left: 25px; 13 | margin-left: 10px; 14 | height: 16px; 15 | } 16 | -------------------------------------------------------------------------------- /demo-jquery-table/src/main/webapp/frontend/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "demo-jquery-table", 3 | "homepage": "", 4 | "authors": [], 5 | "description": "", 6 | "main": "", 7 | "license": "Apache2", 8 | "private": true, 9 | "ignore": [ 10 | "**/.*", 11 | "node_modules", 12 | "bower_components", 13 | "test", 14 | "tests" 15 | ], 16 | "dependencies": { 17 | "tablesorter": "jquery.tablesorter#^2.31.1" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /demo-jquery-table/src/main/webapp/frontend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "demo-jquery-table", 3 | "version": "1.0.0", 4 | "description": "This file exists only to define the Bower version", 5 | "main": "", 6 | "devDependencies": { 7 | "bower": "^1.8.8", 8 | "polymer-cli": "~1.5.2" 9 | }, 10 | "scripts": { 11 | "prodMode": "bower install && polymer build", 12 | "devMode": "bower install" 13 | }, 14 | "author": "", 15 | "license": "Apache-2.0" 16 | } 17 | -------------------------------------------------------------------------------- /demo-dynamic-menu/src/main/webapp/frontend/css/site.css: -------------------------------------------------------------------------------- 1 | .main { 2 | display: flex; 3 | } 4 | 5 | .menu { 6 | flex: 0; 7 | min-width: 300px; 8 | } 9 | 10 | .category:before { 11 | content: '+'; 12 | margin: 0 4px 0 -15px; 13 | display: inline-block; 14 | width: .6em; 15 | } 16 | 17 | .category.expanded:before { 18 | content: '-'; 19 | } 20 | 21 | .selected { 22 | text-decoration: none; 23 | color: black; 24 | font-weight: bold; 25 | } 26 | 27 | .menu ul { 28 | list-style-type: none; 29 | } 30 | 31 | .content { 32 | flex: 1; 33 | margin-left: 1em; 34 | } 35 | -------------------------------------------------------------------------------- /demo-server/webapps/ROOT/flow-logo.svg: -------------------------------------------------------------------------------- 1 | 2 | Untitled-1 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /demo-jquery-table/src/main/webapp/frontend/polymer.json: -------------------------------------------------------------------------------- 1 | { 2 | "entrypoint": "index.html", 3 | "sources": [ 4 | "bower_components/jquery/dist/jquery.min.js", 5 | "bower_components/tablesorter/dist/js/jquery.tablesorter.min.js", 6 | "bower_components/tablesorter/dist/js/jquery.tablesorter.widgets.min.js", 7 | "bower_components/tablesorter/dist/js/widgets/widget-grouping.min.js", 8 | "vaadin-flow-bundle-manifest.json" 9 | ], 10 | "builds": [{ 11 | "name": "frontend-es5", 12 | "js": {"compile": true, "minify": true}, 13 | "css": {"minify": true}, 14 | "html": {"minify": true} 15 | }, 16 | { 17 | "name": "frontend-es6", 18 | "js": {"minify": true}, 19 | "css": {"minify": true}, 20 | "html": {"minify": true} 21 | }] 22 | } 23 | -------------------------------------------------------------------------------- /demo-utils/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.vaadin.flow.demo 7 | flow-demo-project 8 | 2.1-SNAPSHOT 9 | 10 | Demo utils 11 | demo-utils 12 | jar 13 | 14 | 15 | 16 | com.vaadin.flow.demo 17 | demo-test-util 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /demo-jquery-table/src/main/java/com/vaadin/flow/demo/jquerytable/persistence/IssueType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.jquerytable.persistence; 17 | 18 | /** 19 | * Types of issues. 20 | */ 21 | public enum IssueType { 22 | BUG, FEATURE; 23 | } 24 | -------------------------------------------------------------------------------- /demo-hello-worlds/src/main/webapp/frontend/src/styles.css: -------------------------------------------------------------------------------- 1 | .main-view { 2 | font-family: sans-serif; 3 | padding: 20px; 4 | } 5 | 6 | /*.main-view a[router-link] {*/ 7 | /*display: block;*/ 8 | /*margin-top: 10px;*/ 9 | /*}*/ 10 | 11 | .container { 12 | margin-top: 20px; 13 | border-top: 1px solid black; 14 | } 15 | 16 | .container>h2 { 17 | margin-bottom: 0; 18 | } 19 | 20 | .container paper-input { 21 | width: 200px; 22 | } 23 | 24 | .menu { 25 | background: #fff; 26 | position: relative; 27 | top: 0; 28 | left: 0; 29 | margin: auto; 30 | height: 90px; 31 | } 32 | 33 | .topnav { 34 | padding: 14px 0 10px 5%; 35 | background: #00b4f0; 36 | } 37 | 38 | .topnav > a { 39 | padding-right: 10px; 40 | color: #ccf0fc; 41 | font-size: 15px; 42 | font-weight: bold; 43 | } 44 | 45 | .topnav .selected { 46 | color: white; 47 | } 48 | -------------------------------------------------------------------------------- /demo-test-util/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | Test helpers for demos 6 | 7 | com.vaadin.flow.demo 8 | flow-demo-project 9 | 2.1-SNAPSHOT 10 | 11 | demo-test-util 12 | jar 13 | 14 | 15 | 16 | com.vaadin 17 | flow-test-util 18 | ${project.version} 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /demo-jquery-table/src/main/java/com/vaadin/flow/demo/jquerytable/persistence/IssuePriority.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.jquerytable.persistence; 17 | 18 | /** 19 | * Issue priority types. 20 | */ 21 | public enum IssuePriority { 22 | TRIVIAL, NORMAL, CRITICAL; 23 | } 24 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | * 2 | !demo-server/ 3 | 4 | # https://github.com/moby/moby/issues/30018 5 | # Docker does not understand globs in negations as nice as it should be 6 | # so instead of !*/target/*.war we get these: 7 | !demo-route-menu/target/*.war 8 | !demo-dynamic-menu/target/*.war 9 | !demo-minesweeper-element/target/*.war 10 | !demo-static-menu/target/*.war 11 | !demo-todo-template/target/*.war 12 | !demo-google-signin/target/*.war 13 | !demo-minesweeper-polymer/target/*.war 14 | !demo-static-menu-router/target/*.war 15 | !demo-addressbook-polymer/target/*.war 16 | !demo-hello-worlds/target/*.war 17 | !demo-model-converters/target/*.war 18 | !demo-contact-form/target/*.war 19 | !demo-jquery-table/target/*.war 20 | !demo-registration-form/target/*.war 21 | !demo-textfield-component/target/*.war 22 | !demo-web-site/target/*.war 23 | !demo-date-field/target/*.war 24 | !demo-minesweeper-component/target/*.war 25 | !demo-textfield-composite/target/*.war 26 | -------------------------------------------------------------------------------- /demo-static-menu-router/src/main/java/com/vaadin/flow/demo/staticmenu/download/DownloadView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.staticmenu.download; 17 | 18 | import com.vaadin.flow.demo.staticmenu.DummyView; 19 | import com.vaadin.flow.router.Route; 20 | 21 | /** 22 | * The Download view. 23 | * 24 | * @author Vaadin Ltd 25 | */ 26 | @Route(value = "", layout = DownloadMenuView.class) 27 | public class DownloadView extends DummyView { 28 | } 29 | -------------------------------------------------------------------------------- /demo-static-menu-router/src/main/java/com/vaadin/flow/demo/staticmenu/elements/ElementsView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.staticmenu.elements; 17 | 18 | import com.vaadin.flow.demo.staticmenu.DummyView; 19 | import com.vaadin.flow.router.Route; 20 | 21 | /** 22 | * The Elements view. 23 | * 24 | * @author Vaadin Ltd 25 | */ 26 | @Route(value = "", layout = ElementsMenuView.class) 27 | public class ElementsView extends DummyView { 28 | } 29 | -------------------------------------------------------------------------------- /demo-date-field/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.vaadin.flow.demo 7 | flow-demo-project 8 | 2.1-SNAPSHOT 9 | 10 | DateField using ShadowDom element 11 | demo-date-field 12 | war 13 | 14 | 15 | 16 | com.vaadin.flow.demo 17 | demo-test-util 18 | 19 | 20 | com.vaadin 21 | flow-server-compatibility-mode 22 | ${flow.version} 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /demo-static-menu-router/src/main/java/com/vaadin/flow/demo/staticmenu/elements/ElementDemoView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.staticmenu.elements; 17 | 18 | import com.vaadin.flow.demo.staticmenu.DummyView; 19 | import com.vaadin.flow.router.Route; 20 | 21 | /** 22 | * The Elements view. 23 | * 24 | * @author Vaadin Ltd 25 | */ 26 | @Route(value = "demo", layout = ElementsMenuView.class) 27 | public class ElementDemoView extends DummyView { 28 | } 29 | -------------------------------------------------------------------------------- /demo-textfield-component/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.vaadin.flow.demo 7 | flow-demo-project 8 | 2.1-SNAPSHOT 9 | 10 | Text field component using the Element API 11 | demo-textfield-component 12 | war 13 | 14 | 15 | 16 | com.vaadin.flow.demo 17 | demo-test-util 18 | 19 | 20 | com.vaadin 21 | flow-server-compatibility-mode 22 | ${flow.version} 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /demo-google-signin/src/main/webapp/frontend/components/info.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 23 | 24 | 38 | 39 | -------------------------------------------------------------------------------- /demo-textfield-composite/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.vaadin.flow.demo 7 | flow-demo-project 8 | 2.1-SNAPSHOT 9 | 10 | Text field composite using server side components 11 | demo-textfield-composite 12 | war 13 | 14 | 15 | 16 | com.vaadin.flow.demo 17 | demo-test-util 18 | 19 | 20 | com.vaadin 21 | flow-server-compatibility-mode 22 | ${flow.version} 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /demo-addressbook-polymer/src/main/java/com/vaadin/flow/demo/addressbook/ui/SerializableConsumer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.addressbook.ui; 17 | 18 | import java.io.Serializable; 19 | import java.util.function.Consumer; 20 | 21 | /** 22 | * A consumer which is serializable. 23 | * 24 | * @author Vaadin Ltd 25 | * @param 26 | * the type of the input to the consumer 27 | */ 28 | public interface SerializableConsumer extends Consumer, Serializable { 29 | 30 | } 31 | -------------------------------------------------------------------------------- /demo-static-menu-router/src/main/java/com/vaadin/flow/demo/staticmenu/download/IconsView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.staticmenu.download; 17 | 18 | import com.vaadin.flow.demo.staticmenu.DummyView; 19 | import com.vaadin.flow.router.PageTitle; 20 | import com.vaadin.flow.router.Route; 21 | 22 | /** 23 | * The Icons view. 24 | * 25 | * @author Vaadin Ltd 26 | */ 27 | @PageTitle("Vaadin Icons") 28 | @Route(value="", layout = IconsMenuView.class) 29 | public class IconsView extends DummyView { 30 | } 31 | -------------------------------------------------------------------------------- /demo-static-menu-router/src/main/java/com/vaadin/flow/demo/staticmenu/framework/FrameworkView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.staticmenu.framework; 17 | 18 | import com.vaadin.flow.demo.staticmenu.DummyView; 19 | import com.vaadin.flow.router.PageTitle; 20 | import com.vaadin.flow.router.Route; 21 | 22 | /** 23 | * The Framework view. 24 | * 25 | * @author Vaadin Ltd 26 | */ 27 | @Route(value = "", layout = FrameworkMenuBar.class) 28 | @PageTitle("Framework") 29 | public class FrameworkView extends DummyView { 30 | } 31 | -------------------------------------------------------------------------------- /demo-jquery-table/src/main/webapp/frontend/css/site.css: -------------------------------------------------------------------------------- 1 | html { 2 | box-sizing: border-box; 3 | } 4 | 5 | *, *:before, *:after { 6 | box-sizing: inherit; 7 | } 8 | 9 | body { 10 | font-family: "HelveticaW01-RoundedBd", "Helvetica Neue", "Helvetica", 11 | "Arial", "Microsoft YaHei New", "Microsoft Yahei", "SimSun", 12 | "STXihei", sans-serif; 13 | padding: 10px; 14 | } 15 | 16 | select { 17 | padding: 5px; 18 | min-width: 250px; 19 | } 20 | 21 | header { 22 | padding-bottom: 10px; 23 | } 24 | 25 | header>span, header>label { 26 | padding: 10px; 27 | margin: 0 10px; 28 | } 29 | 30 | .number-of-reports { 31 | background-color: #a0a0a0; 32 | color: #fff; 33 | font-weight: bold; 34 | border-radius: 50%; 35 | } 36 | 37 | .tablesorter tr.selected td { 38 | background-color: #7070ff !important; 39 | color: white !important; 40 | } 41 | 42 | .selected-report { 43 | padding: 10px; 44 | position: fixed; 45 | bottom: 10px; 46 | right: 10px; 47 | width: 250px; 48 | text-align: center; 49 | border: 1px solid black; 50 | border-radius: 10px; 51 | background-color: white; 52 | } 53 | -------------------------------------------------------------------------------- /demo-static-menu-router/src/main/java/com/vaadin/flow/demo/staticmenu/download/IconsAboutView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.staticmenu.download; 17 | 18 | import com.vaadin.flow.demo.staticmenu.DummyView; 19 | import com.vaadin.flow.router.PageTitle; 20 | import com.vaadin.flow.router.Route; 21 | 22 | /** 23 | * The Icons about view. 24 | * 25 | * @author Vaadin Ltd 26 | */ 27 | @PageTitle("Vaadin Icons") 28 | @Route(value="about", layout = IconsMenuView.class) 29 | public class IconsAboutView extends DummyView { 30 | } 31 | -------------------------------------------------------------------------------- /demo-static-menu-router/src/main/java/com/vaadin/flow/demo/staticmenu/framework/TutorialView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.staticmenu.framework; 17 | 18 | import com.vaadin.flow.demo.staticmenu.DummyView; 19 | import com.vaadin.flow.router.PageTitle; 20 | import com.vaadin.flow.router.Route; 21 | 22 | /** 23 | * The Tutorial view. 24 | * 25 | * @author Vaadin Ltd 26 | */ 27 | @Route(value = "tutorial", layout = FrameworkMenuBar.class) 28 | @PageTitle("Tutorial") 29 | public class TutorialView extends DummyView { 30 | } 31 | -------------------------------------------------------------------------------- /demo-static-menu-router/src/main/java/com/vaadin/flow/demo/staticmenu/HomeView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.staticmenu; 17 | 18 | import com.vaadin.flow.router.PageTitle; 19 | import com.vaadin.flow.router.Route; 20 | 21 | /** 22 | * The static home page. 23 | * 24 | * @author Vaadin Ltd 25 | */ 26 | @PageTitle("Home") 27 | @Route(value="", layout = MainLayout.class) 28 | public class HomeView extends DummyView { 29 | /** 30 | * Creates the view. 31 | */ 32 | public HomeView() { 33 | super(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /demo-dynamic-routes/src/main/java/com/vaadin/flow/demo/MainLayout.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2018 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo; 17 | 18 | import com.vaadin.flow.component.html.Div; 19 | import com.vaadin.flow.component.html.Span; 20 | import com.vaadin.flow.router.RouterLayout; 21 | 22 | /** 23 | * This is the MainLayout to use with routes registerd at login. 24 | */ 25 | public class MainLayout extends Div implements RouterLayout { 26 | 27 | /** 28 | * Constructor. 29 | */ 30 | public MainLayout() { 31 | add(new Span("this is the main menu")); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Flow Demos 2 | ====== 3 | *See [Flow](https://github.com/vaadin/flow) about the platform* 4 | 5 | Instructions on how to set up a working environment to run demo projects follow below. 6 | 7 | The project contains several sub modules (module per demo). 8 | 9 | Quick Setup 10 | ====== 11 | 1. git clone https://github.com/vaadin/flow-demo.git 12 | 1. make sure you have a TestBench license if you want to run the tests (get it otherwise on https://vaadin.com/pro/licenses) 13 | 1. mvn install 14 | 15 | Running the Demos 16 | == 17 | 1. Go to the demo application folder and run mvn jetty:run in a local jetty 18 | 1. Open in localhost:8080 19 | 1. Run mvn install if you want to get WAR file to be able to deploy it to your Java application server 20 | 21 | Running tests 22 | ===== 23 | The unit tests for the projects can be run using 24 |
mvn test
25 | 26 | IT tests require a [TestBench](https://vaadin.com/testbench) license to run. 27 | Normally, you don't need to run IT tests yourself, the CI will do this for you: for each pull request, a new CI build is started automatically. 28 | 29 | Licenses 30 | == 31 | The source code is released under Apache 2.0. 32 | -------------------------------------------------------------------------------- /demo-test-util/src/main/java/com/vaadin/flow/demo/testutil/AbstractChromeTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.testutil; 17 | 18 | import com.vaadin.flow.testutil.ChromeBrowserTest; 19 | 20 | /** 21 | * TestBench test class which sets up URLs according to how demo projects are 22 | * configured. 23 | * 24 | * @author Vaadin Ltd 25 | */ 26 | public abstract class AbstractChromeTest extends ChromeBrowserTest { 27 | 28 | @Override 29 | protected String getTestPath() { 30 | return "/"; 31 | } 32 | 33 | @Override 34 | protected int getDeploymentPort() { 35 | return 8080; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /demo-route-menu/src/main/java/com/vaadin/flow/demo/menu/routes/SubView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.menu.routes; 17 | 18 | import com.vaadin.flow.component.html.Div; 19 | import com.vaadin.flow.demo.menu.ApplicationLayout; 20 | import com.vaadin.flow.router.PageTitle; 21 | import com.vaadin.flow.router.ParentLayout; 22 | import com.vaadin.flow.router.RouterLayout; 23 | 24 | /** 25 | * A middle layout used as a menu element collecting all items using it as a 26 | * layout. 27 | */ 28 | @PageTitle("Fancy demos") 29 | @ParentLayout(ApplicationLayout.class) 30 | public class SubView extends Div implements RouterLayout { 31 | } 32 | -------------------------------------------------------------------------------- /demo-minesweeper-polymer/src/test/java/com/vaadin/flow/demo/minesweeper/component/MinesweeperIT.java: -------------------------------------------------------------------------------- 1 | package com.vaadin.flow.demo.minesweeper.component; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.assertTrue; 6 | 7 | public class MinesweeperIT extends MinesweeperPageObject { 8 | 9 | @Test 10 | public void clickOnEmptyRevealsCell() { 11 | open("seed=1"); 12 | assertTrue(isCellHidden(0, 0)); 13 | getCell(0, 0).click(); 14 | assertTrue(isCellEmpty(0, 0)); 15 | } 16 | 17 | @Test 18 | public void clickOnMineShowsNotification() { 19 | open("seed=1"); 20 | getCell(9, 0).click(); 21 | waitForBoomNotification(); 22 | } 23 | 24 | @Test 25 | public void solveSeed1Minefield() { 26 | open("seed=1&rows=10&cols=10"); 27 | for (int row = 0; row < 10; row++) { 28 | for (int col = 0; col < 10; col++) { 29 | if (!isMineSeed1(row, col)) { 30 | assertTrue(row + "," + col + " is revealed or a mine", 31 | isCellHidden(row, col) || isCellEmpty(row, col)); 32 | getCell(row, col).click(); 33 | } 34 | } 35 | } 36 | waitForSuccessNotification(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /demo-hello-worlds/src/main/java/com/vaadin/flow/demo/helloworld/Entrypoint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.helloworld; 17 | 18 | import com.vaadin.flow.component.html.Div; 19 | import com.vaadin.flow.router.PageTitle; 20 | import com.vaadin.flow.router.Route; 21 | 22 | /** 23 | * The navigation target to show when opening the application to root. 24 | */ 25 | @PageTitle("Hello worlds") 26 | @Route(value = "", layout = MainLayout.class) 27 | public class Entrypoint extends Div { 28 | 29 | /** 30 | * Navigation target constructor. 31 | */ 32 | public Entrypoint() { 33 | setText("Select version from the list above."); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /demo-route-menu/src/main/java/com/vaadin/flow/demo/menu/routes/FanOut.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.menu.routes; 17 | 18 | import com.vaadin.flow.component.Tag; 19 | import com.vaadin.flow.component.dependency.HtmlImport; 20 | import com.vaadin.flow.component.polymertemplate.PolymerTemplate; 21 | import com.vaadin.flow.router.Route; 22 | import com.vaadin.flow.templatemodel.TemplateModel; 23 | 24 | /** 25 | * Simple css component inside a Polymer element. 26 | */ 27 | @Route(value = "fan-out", layout = SubView.class) 28 | @Tag("fan-out") 29 | @HtmlImport("frontend://template/fanOut.html") 30 | public class FanOut extends PolymerTemplate { 31 | } 32 | -------------------------------------------------------------------------------- /demo-registration-form/src/main/java/com/vaadin/flow/demo/registrationform/ui/RegistrationTextField.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.registrationform.ui; 17 | 18 | import com.vaadin.flow.component.textfield.TextField; 19 | 20 | /** 21 | * Text field component extension. 22 | * 23 | * @author Vaadin Ltd 24 | * 25 | */ 26 | public class RegistrationTextField extends TextField 27 | implements AbstractTextField { 28 | 29 | private Object data; 30 | 31 | @Override 32 | public Object getData() { 33 | return data; 34 | } 35 | 36 | @Override 37 | public void setData(Object object) { 38 | data = object; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /demo-static-menu-router/src/main/resources/i18n/translations_ja.properties: -------------------------------------------------------------------------------- 1 | com.vaadin.flow.demo.staticmenu.framework.FrameworkView=フレームワーク 2 | com.vaadin.flow.demo.staticmenu.framework.TutorialView=チュートリアル 3 | 4 | com.vaadin.flow.demo.staticmenu.elements.ElementDemoView=デモ 5 | com.vaadin.flow.demo.staticmenu.elements.ElementsView=エレメント 6 | 7 | com.vaadin.flow.demo.staticmenu.download.DocsView=ドキュメント 8 | com.vaadin.flow.demo.staticmenu.download.DocsView.FrameworkDocumentation=ドキュメンテーション 9 | com.vaadin.flow.demo.staticmenu.download.DocsView.-/part/elements/elements-getting-started.html=入門 10 | com.vaadin.flow.demo.staticmenu.download.DownloadView=ダウンロード 11 | com.vaadin.flow.demo.staticmenu.download.IconsAboutView=アバウト 12 | com.vaadin.flow.demo.staticmenu.download.IconsView=Vaadin アイコン 13 | 14 | com.vaadin.flow.demo.staticmenu.community.blog.BlogList=ブログ 15 | 16 | # blog post creation 17 | new.blog.post=新しいブログポストを追加 18 | new.blog.post.title=タイトル 19 | new.blog.post.content=コンテンツ 20 | 21 | dialog.title=変更があります 22 | dialog.question=ナビゲーションを続けたいと確信していますか 23 | 24 | common.cancel=キャンセル 25 | common.ok=Ok 26 | common.reset=リセット 27 | common.save=セーブ 28 | 29 | blog.post.not.found=指定したIDのブログが見つかりません. 場所{0}を確認してからもう一度お試しください. 30 | 31 | docs.viewing.page=表示ページ {0} 32 | com.vaadin.flow.demo.staticmenu.HomeView=ホームページ 33 | dummy.view=これは{0}ビューです 34 | -------------------------------------------------------------------------------- /demo-dynamic-routes/src/main/java/com/vaadin/flow/demo/LooseCenterLayout.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2018 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo; 17 | 18 | import com.vaadin.flow.component.html.Div; 19 | import com.vaadin.flow.component.html.Span; 20 | import com.vaadin.flow.router.RouterLayout; 21 | 22 | /** 23 | * This is a layout that is used to demonstrate that any {@link RouterLayout} 24 | * can be used as a parent layout at any position without having any 25 | * annotations. 26 | */ 27 | public class LooseCenterLayout extends Div implements RouterLayout { 28 | 29 | /** 30 | * Constructor. 31 | */ 32 | public LooseCenterLayout() { 33 | add(new Span("Un-linked center layout")); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /demo-spring-boot/src/main/java/com/vaadin/flow/demo/contactform/ui/ContactFormApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2018 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.contactform.ui; 17 | 18 | import org.springframework.boot.SpringApplication; 19 | import org.springframework.boot.autoconfigure.SpringBootApplication; 20 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; 21 | 22 | /** 23 | * The entry point of the Spring Boot application. 24 | */ 25 | @SpringBootApplication 26 | public class ContactFormApplication extends SpringBootServletInitializer { 27 | 28 | public static void main(String[] args) { 29 | SpringApplication.run(ContactFormApplication.class, args); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /demo-registration-form/src/main/java/com/vaadin/flow/demo/registrationform/ui/RegistrationPasswordField.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.registrationform.ui; 17 | 18 | import com.vaadin.flow.component.textfield.PasswordField; 19 | 20 | /** 21 | * Password field component extension. 22 | * 23 | * @author Vaadin Ltd 24 | * 25 | */ 26 | public class RegistrationPasswordField extends PasswordField 27 | implements AbstractTextField { 28 | 29 | private Object data; 30 | 31 | @Override 32 | public Object getData() { 33 | return data; 34 | } 35 | 36 | @Override 37 | public void setData(Object object) { 38 | data = object; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /demo-dynamic-menu/src/main/java/com/vaadin/flow/demo/dynamicmenu/HomeView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.dynamicmenu; 17 | 18 | import com.vaadin.flow.component.HtmlContainer; 19 | import com.vaadin.flow.component.Tag; 20 | import com.vaadin.flow.router.PageTitle; 21 | import com.vaadin.flow.router.Route; 22 | 23 | /** 24 | * The static home page. 25 | * 26 | * @since 27 | * @author Vaadin Ltd 28 | */ 29 | @PageTitle("Home") 30 | @Tag("p") 31 | @Route(value = "", layout = MainLayout.class) 32 | public class HomeView extends HtmlContainer { 33 | /** 34 | * Creates a new home view. 35 | */ 36 | public HomeView() { 37 | setText("Please select a category in the menu"); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /demo-web-site/src/main/java/com/vaadin/flow/demo/website/AboutView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.website; 17 | 18 | import com.vaadin.flow.component.html.Div; 19 | import com.vaadin.flow.router.Route; 20 | 21 | /** 22 | * The static about view. 23 | * 24 | * @since 25 | * @author Vaadin Ltd 26 | */ 27 | @Route(value = "about", layout = MainLayout.class) 28 | public final class AboutView extends SimpleView { 29 | /** 30 | * Creates as new view. 31 | */ 32 | public AboutView() { 33 | add(super.getMappingInfo("about")); 34 | Div div = new Div(); 35 | div.setText("This is the about page"); 36 | div.setClassName("content"); 37 | add(div); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /demo-web-site/src/main/java/com/vaadin/flow/demo/website/HomeView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.website; 17 | 18 | import com.vaadin.flow.component.html.Div; 19 | import com.vaadin.flow.router.Route; 20 | 21 | /** 22 | * The static home page. 23 | * 24 | * @since 25 | * @author Vaadin Ltd 26 | */ 27 | @Route(value = "", layout = MainLayout.class) 28 | public final class HomeView extends SimpleView { 29 | /** 30 | * Creates a new home view. 31 | */ 32 | public HomeView() { 33 | add(super.getMappingInfo("")); 34 | Div div = new Div(); 35 | div.setText("This is the home page"); 36 | div.setClassName("content"); 37 | add(div); 38 | } 39 | 40 | 41 | } 42 | -------------------------------------------------------------------------------- /demo-route-menu/src/main/java/com/vaadin/flow/demo/menu/routes/Home.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.menu.routes; 17 | 18 | import com.vaadin.flow.component.html.Div; 19 | import com.vaadin.flow.component.html.Label; 20 | import com.vaadin.flow.demo.menu.ApplicationLayout; 21 | import com.vaadin.flow.router.Route; 22 | 23 | /** 24 | * Default navigation route target of the application. 25 | */ 26 | @Route(value = "", layout = ApplicationLayout.class) 27 | public class Home extends Div { 28 | 29 | /** 30 | * Constructor. 31 | */ 32 | public Home() { 33 | init(); 34 | } 35 | 36 | private void init() { 37 | add(new Label("This is the home target for this demo")); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /demo-jquery-table/src/main/java/com/vaadin/flow/demo/jquerytable/persistence/Project.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.jquerytable.persistence; 17 | 18 | /** 19 | * Entity that represents a project in the database. 20 | * 21 | */ 22 | public class Project extends BaseEntity { 23 | 24 | private String name; 25 | 26 | /** 27 | * Gets the name of the project. 28 | * 29 | * @return the name 30 | */ 31 | public String getName() { 32 | return name; 33 | } 34 | 35 | /** 36 | * Sets the name of the project. 37 | * 38 | * @param name 39 | * the name to set 40 | */ 41 | public void setName(String name) { 42 | this.name = name; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /demo-addressbook-polymer/src/main/webapp/frontend/components/ContactForm.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 24 | 25 | 34 | 35 | -------------------------------------------------------------------------------- /demo-static-menu-router/src/main/java/com/vaadin/flow/demo/staticmenu/MainLayout.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.staticmenu; 17 | 18 | import com.vaadin.flow.component.dependency.StyleSheet; 19 | import com.vaadin.flow.component.html.Div; 20 | import com.vaadin.flow.router.RouterLayout; 21 | import com.vaadin.flow.theme.Theme; 22 | import com.vaadin.flow.theme.lumo.Lumo; 23 | 24 | /** 25 | * Application main layout containing everything. 26 | * 27 | * @author Vaadin 28 | */ 29 | @StyleSheet("frontend://src/site.css") 30 | @Theme(Lumo.class) 31 | public class MainLayout extends Div implements RouterLayout { 32 | 33 | private MainMenuBar menu = new MainMenu(); 34 | 35 | /** 36 | * Setup main layout. 37 | */ 38 | public MainLayout() { 39 | add(menu); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /demo-static-menu-router/src/main/resources/i18n/translations_en_GB.properties: -------------------------------------------------------------------------------- 1 | com.vaadin.flow.demo.staticmenu.framework.FrameworkView=Framework 2 | com.vaadin.flow.demo.staticmenu.framework.TutorialView=Tutorial 3 | 4 | com.vaadin.flow.demo.staticmenu.elements.ElementDemoView=Demos 5 | com.vaadin.flow.demo.staticmenu.elements.ElementsView=Elements 6 | 7 | com.vaadin.flow.demo.staticmenu.download.DocsView=Docs 8 | com.vaadin.flow.demo.staticmenu.download.DocsView.FrameworkDocumentation=Documentation 9 | com.vaadin.flow.demo.staticmenu.download.DocsView.-/part/elements/elements-getting-started.html=Getting Started 10 | com.vaadin.flow.demo.staticmenu.download.DownloadView=Download 11 | com.vaadin.flow.demo.staticmenu.download.IconsAboutView=About 12 | com.vaadin.flow.demo.staticmenu.download.IconsView=Vaadin Icons 13 | 14 | com.vaadin.flow.demo.staticmenu.community.blog.BlogList=Blogs 15 | 16 | # blog post creation 17 | new.blog.post=Add new blog post 18 | new.blog.post.title=Title 19 | new.blog.post.content=Blog content 20 | 21 | dialog.title=Unsaved changes 22 | dialog.question=Are you certain you want to continue navigation? 23 | 24 | common.cancel=Cancel 25 | common.ok=Ok 26 | common.reset=Reset 27 | common.save=Save 28 | 29 | blog.post.not.found=No blog found for given id. Please check the location {0} and try again. 30 | 31 | docs.viewing.page=Viewing {0} 32 | com.vaadin.flow.demo.staticmenu.HomeView=Home View 33 | dummy.view=This is the {0} view 34 | -------------------------------------------------------------------------------- /demo-validator/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.vaadin.flow.demo 7 | flow-demo-project 8 | 2.1-SNAPSHOT 9 | 10 | Demo validator 11 | demo-validator 12 | jar 13 | 14 | 15 | 16 | com.vaadin.flow.demo 17 | demo-test-util 18 | 19 | 20 | 21 | 22 | 23 | 24 | maven-failsafe-plugin 25 | ${maven.failsafe.plugin.version} 26 | 27 | false 28 | 29 | ${project.rootdir} 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /demo-dynamic-menu/src/main/java/com/vaadin/flow/demo/dynamicmenu/data/Category.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.dynamicmenu.data; 17 | 18 | import java.io.Serializable; 19 | 20 | /** 21 | * Data describing a product category. 22 | * 23 | * @author Vaadin 24 | * @since 25 | */ 26 | public class Category implements Serializable { 27 | 28 | private int id; 29 | private String name; 30 | 31 | public int getId() { 32 | return id; 33 | } 34 | 35 | public void setId(int id) { 36 | this.id = id; 37 | } 38 | 39 | public String getName() { 40 | return name; 41 | } 42 | 43 | public void setName(String name) { 44 | this.name = name; 45 | } 46 | 47 | @Override 48 | public String toString() { 49 | return getName(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /demo-static-menu-router/src/main/java/com/vaadin/flow/demo/staticmenu/ApplicationServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.staticmenu; 17 | 18 | import javax.servlet.annotation.WebInitParam; 19 | import javax.servlet.annotation.WebServlet; 20 | 21 | import com.vaadin.flow.server.Constants; 22 | import com.vaadin.flow.server.VaadinServlet; 23 | import com.vaadin.flow.server.VaadinServletConfiguration; 24 | 25 | /** 26 | * Servlet class for defining the I18N provider class as a web init parameter. 27 | */ 28 | @WebServlet(urlPatterns = "/*", name = "static-menu", asyncSupported = true, initParams = { 29 | @WebInitParam(name = Constants.I18N_PROVIDER, value = "com.vaadin.flow.demo.staticmenu.Lang") }) 30 | @VaadinServletConfiguration(productionMode = false) 31 | public class ApplicationServlet extends VaadinServlet { 32 | } 33 | -------------------------------------------------------------------------------- /demo-minesweeper-component/src/main/java/com/vaadin/flow/demo/minesweeper/component/component/Notification.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.minesweeper.component.component; 17 | 18 | import com.vaadin.flow.component.html.Div; 19 | 20 | /** 21 | * A really simple notification component, which is just a {@link Div} with a 22 | * class name. 23 | * 24 | * @author Vaadin Ltd 25 | * @since 26 | */ 27 | public class Notification extends Div { 28 | 29 | /** 30 | * Creates a notification with the given text and class name. 31 | * 32 | * @param text 33 | * the text to show 34 | * @param className 35 | * the class name to use 36 | */ 37 | public Notification(String text, String className) { 38 | setText(text); 39 | addClassName(className); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /demo-minesweeper-polymer/src/main/java/com/vaadin/flow/demo/minesweeper/component/component/Notification.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.minesweeper.component.component; 17 | 18 | import com.vaadin.flow.component.html.Div; 19 | 20 | /** 21 | * A really simple notification component, which is just a {@link Div} with a 22 | * class name. 23 | * 24 | * @author Vaadin Ltd 25 | * @since 26 | */ 27 | public class Notification extends Div { 28 | 29 | /** 30 | * Creates a notification with the given text and class name. 31 | * 32 | * @param text 33 | * the text to show 34 | * @param className 35 | * the class name to use 36 | */ 37 | public Notification(String text, String className) { 38 | setText(text); 39 | addClassName(className); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /demo-static-menu-router/src/main/java/com/vaadin/flow/demo/staticmenu/download/DownloadMenuView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.staticmenu.download; 17 | 18 | import com.vaadin.flow.demo.staticmenu.MainLayout; 19 | import com.vaadin.flow.demo.staticmenu.SimpleMenuBar; 20 | import com.vaadin.flow.router.ParentLayout; 21 | import com.vaadin.flow.router.RoutePrefix; 22 | import com.vaadin.flow.router.RouterLayout; 23 | 24 | /** 25 | * The Download menu. 26 | * 27 | * @author Vaadin Ltd 28 | */ 29 | @RoutePrefix("download") 30 | @ParentLayout(MainLayout.class) 31 | public class DownloadMenuView extends SimpleMenuBar implements RouterLayout { 32 | 33 | /** 34 | * Creates the view. 35 | */ 36 | public DownloadMenuView() { 37 | addMenuElement(DocsView.class); 38 | addMenuElement(IconsView.class); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /demo-jquery-table/src/main/java/com/vaadin/flow/demo/jquerytable/element/tablesorter/SelectionChangeEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.jquerytable.element.tablesorter; 17 | 18 | import com.vaadin.flow.component.ComponentEvent; 19 | 20 | /** 21 | * Event for selection changes in {@link RichTable}s. 22 | */ 23 | public class SelectionChangeEvent extends ComponentEvent> { 24 | 25 | /** 26 | * Constructor for the event. 27 | * 28 | * @param source 29 | * the table from where the event was originated. 30 | * @param fromClient 31 | * true for client-side events, false 32 | * otherwise. 33 | */ 34 | public SelectionChangeEvent(RichTable source, boolean fromClient) { 35 | super(source, fromClient); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /demo-static-menu-router/src/main/resources/i18n/translations_fi_FI.properties: -------------------------------------------------------------------------------- 1 | com.vaadin.flow.demo.staticmenu.framework.FrameworkView=Framework 2 | com.vaadin.flow.demo.staticmenu.framework.TutorialView=Johdatuskurssi 3 | 4 | com.vaadin.flow.demo.staticmenu.elements.ElementDemoView=Esittelyt 5 | com.vaadin.flow.demo.staticmenu.elements.ElementsView=Elementit 6 | 7 | com.vaadin.flow.demo.staticmenu.download.DocsView=Dokumentaatio 8 | com.vaadin.flow.demo.staticmenu.download.DocsView.FrameworkDocumentation=Dokumentaatio 9 | com.vaadin.flow.demo.staticmenu.download.DocsView.-/part/elements/elements-getting-started.html=Alkuun pääseminen 10 | com.vaadin.flow.demo.staticmenu.download.DownloadView=Lataus 11 | com.vaadin.flow.demo.staticmenu.download.IconsAboutView=Tietoja 12 | com.vaadin.flow.demo.staticmenu.download.IconsView=Vaadin kuvakkeet 13 | 14 | com.vaadin.flow.demo.staticmenu.community.blog.BlogList=Blogit 15 | 16 | # blog post creation 17 | new.blog.post=Lisää uusi blogi 18 | new.blog.post.title=Aihe 19 | new.blog.post.content=Sisältö 20 | 21 | dialog.title=Tallentamattomia muutoksia 22 | dialog.question=Oletko varma että haluat jatkaa siirtymistä? 23 | 24 | common.cancel=Peruuta 25 | common.ok=Ok 26 | common.reset=Tyhjennä 27 | common.save=Tallenna 28 | 29 | blog.post.not.found=Blogia ei löytynyt annetulle tunnisteelle. Tarkista osoite {0} ja yritä uudelleen. 30 | 31 | docs.viewing.page=Näkymässä {0} 32 | com.vaadin.flow.demo.staticmenu.HomeView=Koti näkymä 33 | dummy.view=Tämä on {0} näkymä 34 | -------------------------------------------------------------------------------- /demo-textfield-component/src/main/java/com/vaadin/flow/demo/textfieldcomponent/ApplicationServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.textfieldcomponent; 17 | 18 | import javax.servlet.annotation.WebInitParam; 19 | import javax.servlet.annotation.WebServlet; 20 | 21 | import com.vaadin.flow.server.Constants; 22 | import com.vaadin.flow.server.VaadinServlet; 23 | import com.vaadin.flow.server.VaadinServletConfiguration; 24 | 25 | /*** 26 | * Servlet class for using original frontend resources for the project. 27 | */ 28 | 29 | @WebServlet(urlPatterns = "/*", name = "ApplicationServlet", initParams = { 30 | @WebInitParam(name = Constants.USE_ORIGINAL_FRONTEND_RESOURCES, value = "true") }) 31 | @VaadinServletConfiguration(productionMode = false) 32 | public class ApplicationServlet extends VaadinServlet { 33 | } 34 | -------------------------------------------------------------------------------- /demo-date-field/src/main/java/com/vaadin/flow/demo/datefield/customelement/ApplicationServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.datefield.customelement; 17 | 18 | import javax.servlet.annotation.WebInitParam; 19 | import javax.servlet.annotation.WebServlet; 20 | 21 | import com.vaadin.flow.server.Constants; 22 | import com.vaadin.flow.server.VaadinServlet; 23 | import com.vaadin.flow.server.VaadinServletConfiguration; 24 | 25 | /*** 26 | * Servlet class for using the original frontend resources of the project. 27 | */ 28 | 29 | @WebServlet(urlPatterns = "/*", name = "ApplicationServlet", initParams = { 30 | @WebInitParam(name = Constants.USE_ORIGINAL_FRONTEND_RESOURCES, value = "true") }) 31 | @VaadinServletConfiguration(productionMode = false) 32 | public class ApplicationServlet extends VaadinServlet { 33 | } 34 | -------------------------------------------------------------------------------- /demo-textfield-composite/src/main/java/com/vaadin/flow/demo/textfieldcomposite/ApplicationServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.textfieldcomposite; 17 | 18 | import javax.servlet.annotation.WebInitParam; 19 | import javax.servlet.annotation.WebServlet; 20 | 21 | import com.vaadin.flow.server.Constants; 22 | import com.vaadin.flow.server.VaadinServlet; 23 | import com.vaadin.flow.server.VaadinServletConfiguration; 24 | 25 | /*** 26 | * Servlet class for using the original frontend resources of the project. 27 | */ 28 | 29 | @WebServlet(urlPatterns = "/*", name = "ApplicationServlet", initParams = { 30 | @WebInitParam(name = Constants.USE_ORIGINAL_FRONTEND_RESOURCES, value = "true") }) 31 | @VaadinServletConfiguration(productionMode = false) 32 | public class ApplicationServlet extends VaadinServlet { 33 | } 34 | -------------------------------------------------------------------------------- /demo-static-menu-router/src/main/java/com/vaadin/flow/demo/staticmenu/DummyView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.staticmenu; 17 | 18 | import com.vaadin.flow.component.html.Div; 19 | import com.vaadin.flow.i18n.LocaleChangeEvent; 20 | import com.vaadin.flow.i18n.LocaleChangeObserver; 21 | 22 | /** 23 | * An abstract view which automatically contains a text, which tells the name of 24 | * the view. 25 | * 26 | * @author Vaadin 27 | */ 28 | public abstract class DummyView extends Div implements LocaleChangeObserver { 29 | 30 | /** 31 | * Creates the view. 32 | */ 33 | public DummyView() { 34 | setClassName("content"); 35 | } 36 | 37 | @Override 38 | public void localeChange(LocaleChangeEvent event) { 39 | setText(getTranslation("dummy.view", 40 | Util.getNavigationTargetName(getClass()))); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /demo-model-converters/src/main/java/com/vaadin/flow/demo/helloworld/template/LongToStringConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.helloworld.template; 17 | 18 | import java.util.Optional; 19 | 20 | import com.vaadin.flow.templatemodel.ModelEncoder; 21 | 22 | /** 23 | * Converts {@link Long} to {@link String} to use the value on the client side. 24 | * 25 | * @author Vaadin Ltd 26 | * 27 | */ 28 | public class LongToStringConverter implements ModelEncoder { 29 | 30 | @Override 31 | public String encode(Long modelValue) { 32 | return Optional.ofNullable(modelValue).map(Object::toString) 33 | .orElse(null); 34 | } 35 | 36 | @Override 37 | public Long decode(String presentationValue) { 38 | return Optional.ofNullable(presentationValue).map(Long::parseLong) 39 | .orElse(null); 40 | 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /demo-dynamic-routes/src/main/java/com/vaadin/flow/demo/NoRouteError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2018 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo; 17 | 18 | import javax.servlet.http.HttpServletResponse; 19 | 20 | import com.vaadin.flow.component.Tag; 21 | import com.vaadin.flow.router.BeforeEnterEvent; 22 | import com.vaadin.flow.router.ErrorParameter; 23 | import com.vaadin.flow.router.NotFoundException; 24 | import com.vaadin.flow.router.RouteNotFoundError; 25 | import com.vaadin.flow.theme.NoTheme; 26 | 27 | /** 28 | * Not found will reroute to Login or what ever might be registered to "" at the 29 | * time. 30 | */ 31 | @Tag(Tag.DIV) 32 | @NoTheme 33 | public class NoRouteError extends RouteNotFoundError { 34 | 35 | @Override 36 | public int setErrorParameter(BeforeEnterEvent event, 37 | ErrorParameter parameter) { 38 | event.rerouteTo(""); 39 | return HttpServletResponse.SC_NO_CONTENT; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /demo-static-menu-router/src/main/java/com/vaadin/flow/demo/staticmenu/framework/FrameworkMenuBar.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.staticmenu.framework; 17 | 18 | import com.vaadin.flow.demo.staticmenu.download.DocsView; 19 | import com.vaadin.flow.demo.staticmenu.MainLayout; 20 | import com.vaadin.flow.demo.staticmenu.SimpleMenuBar; 21 | import com.vaadin.flow.router.ParentLayout; 22 | import com.vaadin.flow.router.RoutePrefix; 23 | import com.vaadin.flow.router.RouterLayout; 24 | 25 | /** 26 | * The Framework menu. 27 | * 28 | * @author Vaadin 29 | */ 30 | @RoutePrefix("framework") 31 | @ParentLayout(MainLayout.class) 32 | public class FrameworkMenuBar extends SimpleMenuBar implements RouterLayout { 33 | 34 | /** 35 | * Creates the view. 36 | */ 37 | public FrameworkMenuBar() { 38 | addMenuElement(TutorialView.class); 39 | addMenuElement(DocsView.class, "FrameworkDocumentation"); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /demo-static-menu-router/src/main/java/com/vaadin/flow/demo/staticmenu/download/IconsMenuView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.staticmenu.download; 17 | 18 | import com.vaadin.flow.demo.staticmenu.SimpleMenuBar; 19 | import com.vaadin.flow.router.PageTitle; 20 | import com.vaadin.flow.router.ParentLayout; 21 | import com.vaadin.flow.router.RoutePrefix; 22 | import com.vaadin.flow.router.RouterLayout; 23 | 24 | /** 25 | * The Icons menu. 26 | * 27 | * @author Vaadin Ltd 28 | */ 29 | @PageTitle("Vaadin Icons") 30 | @RoutePrefix(value = "icons", absolute = true) 31 | @ParentLayout(DownloadMenuView.class) 32 | public class IconsMenuView extends SimpleMenuBar implements RouterLayout { 33 | 34 | /** 35 | * Creates the view. 36 | */ 37 | public IconsMenuView() { 38 | getMenu().setClassName("subsubmenu"); 39 | 40 | addMenuElement(IconsView.class); 41 | addMenuElement(IconsAboutView.class); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /demo-todo-template/src/main/webapp/frontend/components/TodoTemplate.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 42 | 43 | 51 | 52 | -------------------------------------------------------------------------------- /demo-dynamic-routes/src/main/java/com/vaadin/flow/demo/dynamic/VersionView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2018 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.dynamic; 17 | 18 | import com.vaadin.flow.component.html.Span; 19 | import com.vaadin.flow.component.orderedlayout.VerticalLayout; 20 | import com.vaadin.flow.demo.Login; 21 | import com.vaadin.flow.demo.MainLayout; 22 | import com.vaadin.flow.router.ParentLayout; 23 | import com.vaadin.flow.router.RouterLink; 24 | 25 | /** 26 | * Dynamic view that is partly setup manually. 27 | * No {@link com.vaadin.flow.router.Route} help, but layout chain is done using 28 | * {@link ParentLayout} 29 | */ 30 | @ParentLayout(MainLayout.class) 31 | public class VersionView extends VerticalLayout { 32 | 33 | /** 34 | * Constructor. 35 | */ 36 | public VersionView() { 37 | Span text = new Span("Version view"); 38 | RouterLink back = new RouterLink("return", Login.class); 39 | back.setId("version-return"); 40 | add(text, back); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /demo-registration-form/src/main/java/com/vaadin/flow/demo/registrationform/ui/Person.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.registrationform.ui; 17 | 18 | /** 19 | * Person bean class. 20 | * 21 | * @author Vaadin Ltd 22 | * 23 | */ 24 | public class Person { 25 | 26 | private String fullName; 27 | 28 | private String emailOrPhone; 29 | 30 | private String password; 31 | 32 | public String getFullName() { 33 | return fullName; 34 | } 35 | 36 | public void setFullName(String fullName) { 37 | this.fullName = fullName; 38 | } 39 | 40 | public String getEmailOrPhone() { 41 | return emailOrPhone; 42 | } 43 | 44 | public void setEmailOrPhone(String emailOrPhone) { 45 | this.emailOrPhone = emailOrPhone; 46 | } 47 | 48 | public String getPassword() { 49 | return password; 50 | } 51 | 52 | public void setPassword(String password) { 53 | this.password = password; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /demo-static-menu-router/src/main/java/com/vaadin/flow/demo/staticmenu/elements/ElementsMenuView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.staticmenu.elements; 17 | 18 | import com.vaadin.flow.demo.staticmenu.MainLayout; 19 | import com.vaadin.flow.demo.staticmenu.SimpleMenuBar; 20 | import com.vaadin.flow.demo.staticmenu.download.DocsView; 21 | import com.vaadin.flow.router.ParentLayout; 22 | import com.vaadin.flow.router.RoutePrefix; 23 | import com.vaadin.flow.router.RouterLayout; 24 | 25 | /** 26 | * The elements menu. 27 | * 28 | * @author Vaadin 29 | */ 30 | @RoutePrefix("elements") 31 | @ParentLayout(MainLayout.class) 32 | public class ElementsMenuView extends SimpleMenuBar implements RouterLayout { 33 | 34 | /** 35 | * Creates the view. 36 | */ 37 | public ElementsMenuView() { 38 | addMenuElement(ElementDemoView.class); 39 | addMenuElement(DocsView.class, 40 | "-/part/elements/elements-getting-started.html"); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /demo-hello-worlds/src/main/webapp/frontend/src/HelloWorld.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 29 | 30 | 31 | 39 | 40 | -------------------------------------------------------------------------------- /demo-minesweeper-element/src/test/java/com/vaadin/flow/demo/minesweeper/element/MinesweeperIT.java: -------------------------------------------------------------------------------- 1 | package com.vaadin.flow.demo.minesweeper.element; 2 | 3 | import org.junit.Test; 4 | import org.openqa.selenium.By; 5 | import org.openqa.selenium.WebElement; 6 | 7 | public class MinesweeperIT extends MinesweeperPageObject { 8 | 9 | @Test 10 | public void clickOnEmptyRevealsCell() { 11 | open("seed=1"); 12 | assertCellHidden(0, 0); 13 | getCell(0, 0).click(); 14 | assertCellEmpty(0, 0); 15 | } 16 | 17 | @Test 18 | public void clickOnMineShowsNotification() { 19 | open("seed=1"); 20 | getCell(9, 0).click(); 21 | waitForBoomNotification(); 22 | } 23 | 24 | @Test 25 | public void solveSeed1Minefield() { 26 | open("seed=1&rows=10&cols=10"); 27 | for (int row = 0; row < 10; row++) { 28 | for (int col = 0; col < 10; col++) { 29 | if (!isMineSeed1(row, col)) { 30 | assertCellHiddenOrEmpty( 31 | row + "," + col + " is revealed or a mine", row, 32 | col); 33 | getCell(row, col).click(); 34 | } 35 | } 36 | } 37 | waitForSuccessNotification(); 38 | } 39 | 40 | private Minefield minefieldSeed1 = new Minefield(); 41 | 42 | { 43 | minefieldSeed1.init(10, 10, 1, 0.2); 44 | } 45 | 46 | private boolean isMineSeed1(int row, int col) { 47 | return minefieldSeed1.isMine(row, col); 48 | } 49 | 50 | @Override 51 | protected WebElement getMineField() { 52 | return findElement(By.cssSelector("table")); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /demo-web-site/src/main/java/com/vaadin/flow/demo/website/SimpleView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.website; 17 | 18 | import com.vaadin.flow.component.HtmlContainer; 19 | import com.vaadin.flow.component.html.Div; 20 | import com.vaadin.flow.router.HasDynamicTitle; 21 | 22 | /** 23 | * Abstract view class using the same element all the time. 24 | * 25 | * @since 26 | * @author Vaadin Ltd 27 | */ 28 | public abstract class SimpleView extends Div implements HasDynamicTitle { 29 | 30 | protected final Div getMappingInfo(String mappingInfo) { 31 | Div mapping = new Div(); 32 | HtmlContainer textElement = new HtmlContainer("strong"); 33 | textElement.setText("Mapped using \"" + mappingInfo + "\""); 34 | textElement.getStyle().set("borderBottom", "1px solid black"); 35 | mapping.getStyle().set("marginBottom", "1em"); 36 | 37 | mapping.add(textElement); 38 | return mapping; 39 | 40 | } 41 | 42 | @Override 43 | public String getPageTitle() { 44 | // Title used for all views 45 | return "Flow Web Site Demo"; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /demo-minesweeper-component/src/main/java/com/vaadin/flow/demo/minesweeper/component/component/Row.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.minesweeper.component.component; 17 | 18 | import com.vaadin.flow.component.Component; 19 | import com.vaadin.flow.component.Tag; 20 | 21 | /** 22 | * A component which represents a row in the minesweeper grid. 23 | * 24 | * @author Vaadin Ltd 25 | * @since 26 | */ 27 | @Tag("tr") 28 | public class Row extends Component { 29 | 30 | /** 31 | * Creates a new row. 32 | */ 33 | public Row() { 34 | // No need to do anything, super constructor creates element 35 | } 36 | 37 | /** 38 | * Adds the given cell to the row. 39 | * 40 | * @param cell 41 | * the cell to add 42 | */ 43 | public void add(Cell cell) { 44 | getElement().appendChild(cell.getElement()); 45 | } 46 | 47 | /** 48 | * Gets the row index for this row. 49 | * 50 | * @return the index of the row 51 | */ 52 | public int getRow() { 53 | return getElement().getParent().indexOfChild(getElement()); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /demo-route-menu/src/main/java/com/vaadin/flow/demo/menu/routes/RayTrace.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.menu.routes; 17 | 18 | import com.vaadin.flow.component.UI; 19 | import com.vaadin.flow.component.html.Div; 20 | import com.vaadin.flow.dom.Element; 21 | import com.vaadin.flow.router.Route; 22 | import com.vaadin.flow.shared.ui.LoadMode; 23 | 24 | /** 25 | * Simple canvas ray trace component. 26 | * Script from http://ncase.me/sight-and-light/ 27 | */ 28 | @Route(value = "ray-trace", layout = SubView.class) 29 | public class RayTrace extends Div { 30 | 31 | /** 32 | * Constructor. 33 | */ 34 | public RayTrace() { 35 | init(); 36 | } 37 | 38 | private void init() { 39 | Element baseCanvas = new Element("canvas"); 40 | baseCanvas.setAttribute("id", "canvas"); 41 | baseCanvas.setAttribute("width", "640"); 42 | baseCanvas.setAttribute("height", "360"); 43 | 44 | getElement().appendChild(baseCanvas); 45 | 46 | UI.getCurrent().getPage() 47 | .addJavaScript("frontend://script/rayTrace.js", LoadMode.LAZY); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /demo-date-field/src/main/java/com/vaadin/flow/demo/datefield/customelement/DateView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.datefield.customelement; 17 | 18 | import java.time.LocalDate; 19 | import java.time.format.DateTimeFormatter; 20 | 21 | import com.vaadin.flow.component.html.Div; 22 | import com.vaadin.flow.router.Route; 23 | 24 | /** 25 | * View containing text field and a div with text that is updated when selection 26 | * changes in the DateField. 27 | */ 28 | @Route("") 29 | public class DateView extends Div { 30 | 31 | private Div text = new Div(); 32 | 33 | /** 34 | * Initializes the view. Invoked by the framework when needed. 35 | */ 36 | public DateView() { 37 | DateField dateField = new DateField(); 38 | dateField.setId("date-field"); 39 | 40 | dateField.addValueChangeListener( 41 | valueChangeEvent -> updateTextContents(dateField.getValue())); 42 | text.setId("value"); 43 | 44 | add(dateField, text); 45 | } 46 | 47 | private void updateTextContents(LocalDate value) { 48 | text.setText(value.format(DateTimeFormatter.ofPattern("dd.MM.yyyy"))); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /demo-minesweeper-component/src/test/java/com/vaadin/flow/demo/minesweeper/component/MinesweeperIT.java: -------------------------------------------------------------------------------- 1 | package com.vaadin.flow.demo.minesweeper.component; 2 | 3 | import org.junit.Test; 4 | import org.openqa.selenium.By; 5 | import org.openqa.selenium.WebElement; 6 | 7 | import com.vaadin.flow.demo.minesweeper.component.data.MineFieldData; 8 | 9 | public class MinesweeperIT extends MinesweeperPageObject { 10 | 11 | @Test 12 | public void clickOnEmptyRevealsCell() { 13 | open("seed=1"); 14 | assertCellHidden(0, 0); 15 | getCell(0, 0).click(); 16 | assertCellEmpty(0, 0); 17 | } 18 | 19 | @Test 20 | public void clickOnMineShowsNotification() { 21 | open("seed=1"); 22 | getCell(9, 0).click(); 23 | waitForBoomNotification(); 24 | } 25 | 26 | @Test 27 | public void solveSeed1Minefield() { 28 | open("seed=1&rows=10&cols=10"); 29 | for (int row = 0; row < 10; row++) { 30 | for (int col = 0; col < 10; col++) { 31 | if (!isMineSeed1(row, col)) { 32 | assertCellHiddenOrEmpty( 33 | row + "," + col + " is revealed or a mine", row, 34 | col); 35 | getCell(row, col).click(); 36 | } 37 | } 38 | } 39 | waitForSuccessNotification(); 40 | } 41 | 42 | private MineFieldData minefieldSeed1 = new MineFieldData(); 43 | 44 | { 45 | minefieldSeed1.init(10, 10, 1, 0.2); 46 | } 47 | 48 | private boolean isMineSeed1(int row, int col) { 49 | return minefieldSeed1.isMine(row, col); 50 | } 51 | 52 | @Override 53 | protected WebElement getMineField() { 54 | return findElement(By.cssSelector("table")); 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /demo-static-menu-router/src/main/java/com/vaadin/flow/demo/staticmenu/download/DocsView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.staticmenu.download; 17 | 18 | import com.vaadin.flow.component.html.Div; 19 | import com.vaadin.flow.demo.staticmenu.DummyView; 20 | import com.vaadin.flow.router.BeforeEvent; 21 | import com.vaadin.flow.router.HasUrlParameter; 22 | import com.vaadin.flow.router.Route; 23 | import com.vaadin.flow.router.WildcardParameter; 24 | 25 | /** 26 | * The Docs view. 27 | * 28 | * @author Vaadin Ltd 29 | */ 30 | @Route(value = "docs", layout = DownloadMenuView.class, absolute = true) 31 | public class DocsView extends DummyView implements HasUrlParameter { 32 | Div div = new Div(); 33 | 34 | /** 35 | * Constructor for the docs view. 36 | */ 37 | public DocsView() { 38 | add(div); 39 | } 40 | 41 | @Override 42 | public void setParameter(BeforeEvent event, 43 | @WildcardParameter String parameter) { 44 | if (!parameter.isEmpty()) { 45 | div.setText(getTranslation("docs.viewing.page", parameter)); 46 | } else { 47 | div.setText(""); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /demo-date-field/src/test/java/com/vaadin/flow/demo/datefield/customelement/DateFieldIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.datefield.customelement; 17 | 18 | import org.junit.Assert; 19 | import org.junit.Test; 20 | import org.openqa.selenium.By; 21 | import org.openqa.selenium.Keys; 22 | import org.openqa.selenium.WebElement; 23 | 24 | import com.vaadin.flow.demo.testutil.AbstractChromeTest; 25 | 26 | public class DateFieldIT extends AbstractChromeTest { 27 | 28 | @Test 29 | public void basicFunctionality() { 30 | open(); 31 | 32 | WebElement dateField = findElement(By.id("date-field")); 33 | // Finds the first select element which is the day 34 | WebElement selectElement = getInShadowRoot(dateField, 35 | By.cssSelector("select")); 36 | selectElement.sendKeys(Keys.TAB); 37 | selectElement.sendKeys(Keys.ENTER); 38 | selectElement.sendKeys(Keys.ARROW_DOWN, Keys.ARROW_DOWN, 39 | Keys.ARROW_DOWN); 40 | selectElement.sendKeys(Keys.ENTER); 41 | 42 | WebElement value = findElement(By.id("value")); 43 | 44 | Assert.assertEquals("04.01.1900", value.getText()); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /demo-static-menu-router/src/main/java/com/vaadin/flow/demo/staticmenu/IllegalArgumentsError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.staticmenu; 17 | 18 | import javax.servlet.http.HttpServletResponse; 19 | 20 | import com.vaadin.flow.component.html.Div; 21 | import com.vaadin.flow.component.html.Label; 22 | import com.vaadin.flow.router.BeforeEnterEvent; 23 | import com.vaadin.flow.router.ErrorParameter; 24 | import com.vaadin.flow.router.HasErrorParameter; 25 | import com.vaadin.flow.router.ParentLayout; 26 | 27 | /** 28 | * Error view for showing illegal argument information. 29 | */ 30 | @ParentLayout(MainLayout.class) 31 | public class IllegalArgumentsError extends Div 32 | implements HasErrorParameter { 33 | 34 | /** 35 | * Default constructor. 36 | */ 37 | public IllegalArgumentsError() { 38 | setId("error-content"); 39 | } 40 | 41 | @Override 42 | public int setErrorParameter(BeforeEnterEvent event, 43 | ErrorParameter parameter) { 44 | Label message = new Label(parameter.getCustomMessage()); 45 | add(message); 46 | 47 | return HttpServletResponse.SC_NOT_FOUND; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /demo-dynamic-menu/src/main/java/com/vaadin/flow/demo/dynamicmenu/ErrorView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.dynamicmenu; 17 | 18 | import javax.servlet.http.HttpServletResponse; 19 | 20 | import com.vaadin.flow.dom.ElementFactory; 21 | import com.vaadin.flow.router.BeforeEnterEvent; 22 | import com.vaadin.flow.router.ErrorParameter; 23 | import com.vaadin.flow.router.NotFoundException; 24 | import com.vaadin.flow.router.RouteNotFoundError; 25 | 26 | /** 27 | * An error view showing a message with the wrong location to the user. 28 | */ 29 | public class ErrorView extends RouteNotFoundError { 30 | 31 | @Override 32 | public int setErrorParameter(BeforeEnterEvent event, 33 | ErrorParameter parameter) { 34 | getElement().getStyle().set("textAlign", "center"); 35 | getElement().appendChild( 36 | ElementFactory.createHeading1("404 - Page not found"), 37 | ElementFactory.createSpan("Please check the location "), 38 | ElementFactory.createEmphasis(event.getLocation().getPath()), 39 | ElementFactory.createSpan(" and try again.")); 40 | 41 | return HttpServletResponse.SC_NOT_FOUND; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /demo-jquery-table/src/main/java/com/vaadin/flow/demo/jquerytable/element/html/Option.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.jquerytable.element.html; 17 | 18 | import com.vaadin.flow.component.HasText; 19 | import com.vaadin.flow.component.HtmlComponent; 20 | import com.vaadin.flow.component.PropertyDescriptor; 21 | import com.vaadin.flow.component.PropertyDescriptors; 22 | import com.vaadin.flow.component.Tag; 23 | 24 | /** 25 | * Component representing a <option> element. 26 | */ 27 | @Tag(Tag.OPTION) 28 | public class Option extends HtmlComponent implements HasText { 29 | 30 | private static final PropertyDescriptor valueDescriptor = PropertyDescriptors 31 | .propertyWithDefault("value", ""); 32 | 33 | /** 34 | * Sets the model value of the option. 35 | * 36 | * @param value 37 | * the model value 38 | */ 39 | public void setValue(String value) { 40 | set(valueDescriptor, value); 41 | } 42 | 43 | /** 44 | * Gets the model value of the option. 45 | * 46 | * @return the model value 47 | */ 48 | public String getValue() { 49 | return get(valueDescriptor); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /demo-textfield-composite/src/test/java/com/vaadin/flow/demo/component/textfield/TextFieldIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.component.textfield; 17 | 18 | import java.util.List; 19 | 20 | import org.junit.Assert; 21 | import org.junit.Test; 22 | import org.openqa.selenium.By; 23 | import org.openqa.selenium.Keys; 24 | import org.openqa.selenium.WebElement; 25 | 26 | import com.vaadin.flow.demo.testutil.AbstractChromeTest; 27 | 28 | public class TextFieldIT extends AbstractChromeTest { 29 | 30 | @Test 31 | public void basicFunctionality() { 32 | open(); 33 | WebElement input = findElement(By.xpath("//input")); 34 | changeInput(input, "14"); 35 | changeInput(input, "44"); 36 | 37 | List divs = findElements(By.id("message")); 38 | Assert.assertEquals("Oh my, 14 is so young!", divs.get(0).getText()); 39 | 40 | Assert.assertEquals("Gosh, 44 is so old!", divs.get(1).getText()); 41 | 42 | } 43 | 44 | private void changeInput(WebElement input, String string) { 45 | input.sendKeys(Keys.BACK_SPACE, Keys.BACK_SPACE, Keys.BACK_SPACE, 46 | Keys.BACK_SPACE, Keys.BACK_SPACE); 47 | input.sendKeys(string); 48 | blur(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /demo-jquery-table/src/main/java/com/vaadin/flow/demo/jquerytable/persistence/ProjectVersion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.jquerytable.persistence; 17 | 18 | /** 19 | * Entity that represents a project version in the database. 20 | */ 21 | public class ProjectVersion extends BaseEntity { 22 | 23 | private Project project; 24 | private String name; 25 | 26 | /** 27 | * Gets the {@link Project} of this version. 28 | * 29 | * @return the project 30 | */ 31 | public Project getProject() { 32 | return project; 33 | } 34 | 35 | /** 36 | * Sets the {@link Project} of this version. 37 | * 38 | * @param project 39 | * the project to set 40 | */ 41 | public void setProject(Project project) { 42 | this.project = project; 43 | } 44 | 45 | /** 46 | * Gets the name of this version. 47 | * 48 | * @return the name 49 | */ 50 | public String getName() { 51 | return name; 52 | } 53 | 54 | /** 55 | * Sets the name of this version. 56 | * 57 | * @param name 58 | * the name to set 59 | */ 60 | public void setName(String name) { 61 | this.name = name; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /demo-addressbook-polymer/src/main/webapp/frontend/components/ContactsTable.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 23 | 47 | 48 | -------------------------------------------------------------------------------- /demo-dynamic-routes/src/main/java/com/vaadin/flow/demo/dynamic/TimeView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2018 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.dynamic; 17 | 18 | import java.time.LocalDateTime; 19 | 20 | import com.vaadin.flow.component.UI; 21 | import com.vaadin.flow.component.button.Button; 22 | import com.vaadin.flow.component.html.Span; 23 | import com.vaadin.flow.component.orderedlayout.VerticalLayout; 24 | import com.vaadin.flow.router.RouteConfiguration; 25 | 26 | /** 27 | * Dynamic view that is setup manually. 28 | * No @Route help or other automation. 29 | */ 30 | public class TimeView extends VerticalLayout { 31 | 32 | /** 33 | * Constructor. 34 | */ 35 | public TimeView() { 36 | Span text = new Span("Time view " + LocalDateTime.now().toString()); 37 | Button back = new Button("Return", 38 | event -> UI.getCurrent().navigate("")); 39 | back.setId("time-return"); 40 | 41 | Button remove = new Button("Remove time view", 42 | event -> RouteConfiguration.forSessionScope() 43 | .removeRoute(TimeView.class)); 44 | remove.setId("time-remove"); 45 | Button reload = new Button("Reload page", 46 | event -> UI.getCurrent().getPage().reload()); 47 | reload.setId("time-reload"); 48 | 49 | add(text, back, remove, reload); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /demo-jquery-table/src/main/java/com/vaadin/flow/demo/jquerytable/persistence/BaseEntity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.jquerytable.persistence; 17 | 18 | import java.io.Serializable; 19 | 20 | /** 21 | * Base class of all entities. 22 | */ 23 | public abstract class BaseEntity 24 | implements Serializable, Comparable { 25 | 26 | protected long id; 27 | 28 | /** 29 | * Gets the unique identifier of the entity. 30 | * 31 | * @return the id 32 | */ 33 | public long getId() { 34 | return id; 35 | } 36 | 37 | /** 38 | * Sets the unique identifier of the entity. 39 | * 40 | * @param id 41 | * the id to set 42 | */ 43 | public void setId(long id) { 44 | this.id = id; 45 | } 46 | 47 | @Override 48 | public boolean equals(Object obj) { 49 | if (obj == this) { 50 | return true; 51 | } 52 | if (obj instanceof BaseEntity) { 53 | BaseEntity that = (BaseEntity) obj; 54 | return id == that.id; 55 | } 56 | return false; 57 | } 58 | 59 | @Override 60 | public int hashCode() { 61 | return Long.hashCode(id); 62 | } 63 | 64 | @Override 65 | public int compareTo(BaseEntity o) { 66 | return Long.compare(id, o.id); 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /demo-textfield-component/src/test/java/com/vaadin/flow/demo/textfieldcomponent/TextFieldIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.textfieldcomponent; 17 | 18 | import java.util.List; 19 | 20 | import org.junit.Assert; 21 | import org.junit.Test; 22 | import org.openqa.selenium.By; 23 | import org.openqa.selenium.Keys; 24 | import org.openqa.selenium.WebElement; 25 | 26 | import com.vaadin.flow.demo.testutil.AbstractChromeTest; 27 | 28 | public class TextFieldIT extends AbstractChromeTest { 29 | 30 | @Test 31 | public void basicFunctionality() { 32 | open(); 33 | WebElement input = findElement(By.xpath("//input")); 34 | changeInput(input, "14"); 35 | changeInput(input, "44"); 36 | changeInput(input, "Foo"); 37 | 38 | List divs = findElements(By.id("message")); 39 | Assert.assertEquals("Oh my, 14 is so young!", divs.get(0).getText()); 40 | Assert.assertEquals("Gosh, 44 is so old!", divs.get(1).getText()); 41 | Assert.assertEquals("That's not even a real age!", 42 | divs.get(2).getText()); 43 | } 44 | 45 | private void changeInput(WebElement input, String string) { 46 | input.sendKeys(Keys.BACK_SPACE, Keys.BACK_SPACE, Keys.BACK_SPACE, 47 | Keys.BACK_SPACE, Keys.BACK_SPACE); 48 | input.sendKeys(string); 49 | blur(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /demo-registration-form/src/main/java/com/vaadin/flow/demo/registrationform/ui/AbstractTextField.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.registrationform.ui; 17 | 18 | import java.util.Optional; 19 | 20 | import com.vaadin.flow.component.HasSize; 21 | 22 | /** 23 | * Abstract component with common text field functionality. 24 | * 25 | * @param 26 | * the Flow text field component type 27 | * 28 | * @author Vaadin Ltd 29 | * 30 | */ 31 | public interface AbstractTextField extends HasSize { 32 | 33 | /** 34 | * A hint to the user of what can be entered in the control. 35 | * 36 | * @param placeholder 37 | * the String value to set 38 | * @return this instance, for method chaining 39 | */ 40 | void setPlaceholder(String placeholder); 41 | 42 | /** 43 | * Sets an arbitrary data into the instance. 44 | * 45 | * @see #getData() 46 | * 47 | * @param object 48 | * a data to set 49 | */ 50 | void setData(Object object); 51 | 52 | /** 53 | * Gets the data set via {@link #setData(Object)}. 54 | * 55 | * @see #setData(Object) 56 | * @return the stored data 57 | */ 58 | Object getData(); 59 | 60 | /** 61 | * Gets the id of the component. 62 | * 63 | * @return the element id. 64 | */ 65 | Optional getId(); 66 | } 67 | -------------------------------------------------------------------------------- /demo-google-signin/src/main/java/com/vaadin/flow/demo/googlesignin/model/ProfileInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.googlesignin.model; 17 | 18 | import com.vaadin.flow.templatemodel.TemplateModel; 19 | 20 | /** 21 | * Model interface for the user profile properties. 22 | */ 23 | public interface ProfileInfo extends TemplateModel { 24 | 25 | /** 26 | * Gets the user email from the model. 27 | * 28 | * @return the email. 29 | */ 30 | String getEmail(); 31 | 32 | /** 33 | * Sets the user email in the model. 34 | * 35 | * @param email 36 | * the email. 37 | */ 38 | void setEmail(String email); 39 | 40 | /** 41 | * Gets the user name from the model. 42 | * 43 | * @return the user name. 44 | */ 45 | String getName(); 46 | 47 | /** 48 | * Sets the user name in the model. 49 | * 50 | * @param name 51 | * the user name. 52 | */ 53 | void setName(String name); 54 | 55 | /** 56 | * Gets the user picture URL from the model. 57 | * 58 | * @return the user picture URL. 59 | */ 60 | String getPicture(); 61 | 62 | /** 63 | * Sets the user picture URL in the model. 64 | * 65 | * @param picture 66 | * the user picture URL. 67 | */ 68 | void setPicture(String picture); 69 | 70 | } 71 | -------------------------------------------------------------------------------- /demo-dynamic-routes/src/main/java/com/vaadin/flow/demo/GlobalView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2018 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo; 17 | 18 | import com.vaadin.flow.component.UI; 19 | import com.vaadin.flow.component.button.Button; 20 | import com.vaadin.flow.component.html.Span; 21 | import com.vaadin.flow.component.orderedlayout.VerticalLayout; 22 | import com.vaadin.flow.router.Route; 23 | import com.vaadin.flow.router.RouteConfiguration; 24 | import com.vaadin.flow.router.RouterLink; 25 | 26 | /** 27 | * This is a global route that is in the demo registerable to the global 28 | * application scope from the AdminView. 29 | */ 30 | @Route(value = "global", registerAtStartup = false) 31 | public class GlobalView extends VerticalLayout { 32 | 33 | /** 34 | * GlobalView Constructor. 35 | */ 36 | public GlobalView() { 37 | Button remove = new Button("Remove from global and reload", event -> { 38 | RouteConfiguration.forApplicationScope().removeRoute("global"); 39 | UI.getCurrent().getPage().reload(); 40 | }); 41 | remove.setId("remove-global"); 42 | 43 | RouterLink tologin = new RouterLink("To login", Login.class); 44 | tologin.setId("to-root-link"); 45 | 46 | add(new Span( 47 | "This is a view registered from the admin view to the global servlet scope."), 48 | remove, tologin); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /demo-static-menu-router/src/test/java/com/vaadin/flow/demo/website/BlogPostIT.java: -------------------------------------------------------------------------------- 1 | package com.vaadin.flow.demo.website; 2 | 3 | import org.junit.Assert; 4 | import org.junit.Test; 5 | 6 | import org.openqa.selenium.By; 7 | 8 | public class BlogPostIT extends AbstractComplexStaticMenuTest { 9 | 10 | @Test 11 | public void blog_list_visible() { 12 | openRouteUrl("blog"); 13 | 14 | Assert.assertTrue("Blog post 1 link not present", 15 | isElementPresent(By.xpath("//a[contains(@href,'blog/1')]"))); 16 | Assert.assertTrue("Blog post 2 link not present", 17 | isElementPresent(By.xpath("//a[contains(@href,'blog/2')]"))); 18 | Assert.assertTrue("Blog post 3 link not present", 19 | isElementPresent(By.xpath("//a[contains(@href,'blog/3')]"))); 20 | } 21 | 22 | @Test 23 | public void valid_blog_post_url() { 24 | openRouteUrl("blog/1"); 25 | Assert.assertTrue("Blog post content should be present", 26 | isElementPresent(By.className("blog-content"))); 27 | } 28 | 29 | @Test 30 | public void invalid_blog_post_url() { 31 | openRouteUrl("blog/99"); 32 | waitForElementPresent(By.id("error-content")); 33 | Assert.assertTrue("Error view content is not present", 34 | isElementPresent(By.id("error-content"))); 35 | Assert.assertTrue( 36 | "Top navigation, i.e. the MainLayout is not present", 37 | isElementPresent(By.className("topnav"))); 38 | } 39 | 40 | @Test 41 | public void blog_post_title_set_dynamically() { 42 | openRouteUrl("blog/1"); 43 | Assert.assertEquals("Blog title is wrong for post #1 -", 44 | "Vaadin Charts for the Web Component world", 45 | getDriver().getTitle()); 46 | openRouteUrl("blog/3"); 47 | Assert.assertEquals("Blog title is wrong for post #3 -", 48 | "Community Spotlight - February 2016", getDriver().getTitle()); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /demo-textfield-composite/src/main/java/com/vaadin/flow/demo/textfieldcomposite/TextFieldView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.textfieldcomposite; 17 | 18 | import com.vaadin.flow.component.html.Div; 19 | import com.vaadin.flow.router.Route; 20 | 21 | /** 22 | * View which demonstrates how a text field component can be used. 23 | */ 24 | @Route("") 25 | public class TextFieldView extends Div { 26 | 27 | /** 28 | * Create view for demonstrates a text field. 29 | */ 30 | public TextFieldView() { 31 | TextField tf = new TextField("Enter your age"); 32 | tf.addChangeListener(event -> { 33 | int age; 34 | try { 35 | age = Integer.parseInt(tf.getValue()); 36 | } catch (NumberFormatException e) { 37 | age = -1; 38 | } 39 | 40 | Div message = new Div(); 41 | message.setText(getAgeMessage(age)); 42 | message.setId("message"); 43 | add(message); 44 | }); 45 | add(tf); 46 | } 47 | 48 | private static String getAgeMessage(int age) { 49 | if (age < 0) { 50 | return "That's not even a real age!"; 51 | } else if (age > 18) { 52 | return "Gosh, " + age + " is so old!"; 53 | } else { 54 | return "Oh my, " + age + " is so young!"; 55 | } 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /demo-textfield-component/src/main/java/com/vaadin/flow/demo/textfieldcomponent/TextFieldView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.textfieldcomponent; 17 | 18 | import com.vaadin.flow.component.html.Div; 19 | import com.vaadin.flow.router.Route; 20 | 21 | /** 22 | * View which demonstrates how a text field component can be used. 23 | */ 24 | @Route("") 25 | public class TextFieldView extends Div { 26 | 27 | /** 28 | * Create view for demonstrating a text field. 29 | */ 30 | public TextFieldView() { 31 | TextField tf = new TextField("Enter your age"); 32 | tf.addChangeListener(event -> { 33 | int age; 34 | try { 35 | age = Integer.parseInt(event.getNewValue()); 36 | } catch (NumberFormatException e) { 37 | age = -1; 38 | } 39 | 40 | Div message = new Div(); 41 | message.setText(getAgeMessage(age)); 42 | message.setId("message"); 43 | add(message); 44 | }); 45 | add(tf); 46 | } 47 | 48 | private static String getAgeMessage(int age) { 49 | if (age < 0) { 50 | return "That's not even a real age!"; 51 | } else if (age > 18) { 52 | return "Gosh, " + age + " is so old!"; 53 | } else { 54 | return "Oh my, " + age + " is so young!"; 55 | } 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /demo-google-signin/src/test/java/com/vaadin/flow/demo/googlesignin/component/SigninIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.googlesignin.component; 17 | 18 | import java.util.List; 19 | 20 | import org.junit.Assert; 21 | import org.junit.Test; 22 | import org.openqa.selenium.By; 23 | import org.openqa.selenium.WebElement; 24 | 25 | import com.vaadin.flow.demo.testutil.AbstractChromeTest; 26 | 27 | /** 28 | * Tests the basic layout of the demo, which includes the server rendering 29 | * inside the template by using {@link com.vaadin.ui.polymertemplate.Id}. The authentication mechanism itself 30 | * is not tested, because it opens a second window for specific credentials. 31 | */ 32 | public class SigninIT extends AbstractChromeTest { 33 | 34 | @Test 35 | public void loadPage() { 36 | open(); 37 | 38 | waitForElementPresent(By.tagName("signin-page")); 39 | WebElement element = findElement(By.tagName("signin-page")); 40 | List components = findInShadowRoot(element, 41 | By.id("login-info")); 42 | Assert.assertFalse(components.isEmpty()); 43 | 44 | WebElement h2 = components.get(0).findElement(By.tagName("h2")); 45 | Assert.assertEquals("Google signin", h2.getText()); 46 | 47 | components = findInShadowRoot(element, By.id("glogin")); 48 | Assert.assertFalse(components.isEmpty()); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /demo-google-signin/src/main/java/com/vaadin/flow/demo/googlesignin/component/SigninInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.googlesignin.component; 17 | 18 | import com.vaadin.flow.component.Tag; 19 | import com.vaadin.flow.component.dependency.HtmlImport; 20 | import com.vaadin.flow.component.polymertemplate.PolymerTemplate; 21 | import com.vaadin.flow.demo.googlesignin.model.ProfileInfo; 22 | 23 | /** 24 | * Component that shows the profile information of the logged user, such as 25 | * name, email and picture. 26 | */ 27 | @Tag("signin-info") 28 | @HtmlImport("frontend://components/info.html") 29 | public class SigninInfo extends PolymerTemplate 30 | implements ProfileInfo { 31 | 32 | @Override 33 | public String getEmail() { 34 | return getModel().getEmail(); 35 | } 36 | 37 | @Override 38 | public void setEmail(String email) { 39 | getModel().setEmail(email); 40 | } 41 | 42 | @Override 43 | public String getName() { 44 | return getModel().getName(); 45 | } 46 | 47 | @Override 48 | public void setName(String name) { 49 | getModel().setName(name); 50 | } 51 | 52 | @Override 53 | public String getPicture() { 54 | return getModel().getPicture(); 55 | } 56 | 57 | @Override 58 | public void setPicture(String picture) { 59 | getModel().setPicture(picture); 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /demo-static-menu-router/src/main/java/com/vaadin/flow/demo/staticmenu/community/blog/backend/BlogRecord.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.staticmenu.community.blog.backend; 17 | 18 | import java.io.Serializable; 19 | import java.time.LocalDateTime; 20 | 21 | /** 22 | * Blog DTO. 23 | * 24 | * @author Vaadin Ltd 25 | * 26 | */ 27 | public class BlogRecord implements Serializable { 28 | 29 | private String text; 30 | 31 | private long id; 32 | 33 | private String title; 34 | 35 | private String author; 36 | 37 | private LocalDateTime date; 38 | 39 | public long getId() { 40 | return id; 41 | } 42 | 43 | public void setId(long id) { 44 | this.id = id; 45 | } 46 | 47 | public String getTitle() { 48 | return title; 49 | } 50 | 51 | public void setTitle(String title) { 52 | this.title = title; 53 | } 54 | 55 | public String getAuthor() { 56 | return author; 57 | } 58 | 59 | public void setAuthor(String author) { 60 | this.author = author; 61 | } 62 | 63 | public LocalDateTime getDate() { 64 | return date; 65 | } 66 | 67 | public void setDate(LocalDateTime date) { 68 | this.date = date; 69 | } 70 | 71 | public String getText() { 72 | return text; 73 | } 74 | 75 | public void setText(String text) { 76 | this.text = text; 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /demo-date-field/src/main/java/com/vaadin/flow/demo/datefield/customelement/SelectElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.datefield.customelement; 17 | 18 | import com.vaadin.flow.component.AbstractSinglePropertyField; 19 | import com.vaadin.flow.component.Tag; 20 | import com.vaadin.flow.dom.Element; 21 | import com.vaadin.flow.dom.ElementFactory; 22 | 23 | /** 24 | * Native select element for selecting items. 25 | */ 26 | @Tag("select") 27 | public class SelectElement 28 | extends AbstractSinglePropertyField { 29 | 30 | public static final String VALUE_PROPERTY = "value"; 31 | 32 | /** 33 | * Init select element with the selections given. 34 | * 35 | * @param options 36 | * select options to populate select with 37 | */ 38 | public SelectElement(String... options) { 39 | super(VALUE_PROPERTY, "", false); 40 | if (options.length == 0) { 41 | throw new IllegalArgumentException( 42 | "Select should be given at least one option"); 43 | } 44 | 45 | for (String selection : options) { 46 | Element option = ElementFactory.createOption(selection); 47 | getElement().appendChild(option); 48 | } 49 | setValue(options[0]); 50 | getElement().setProperty("selectedIndex", 0); 51 | getElement().synchronizeProperty(VALUE_PROPERTY, "change"); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /demo-static-menu-router/src/main/java/com/vaadin/flow/demo/staticmenu/Util.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.staticmenu; 17 | 18 | import java.util.Optional; 19 | 20 | import com.vaadin.flow.component.Component; 21 | import com.vaadin.flow.component.UI; 22 | import com.vaadin.flow.internal.AnnotationReader; 23 | import com.vaadin.flow.router.PageTitle; 24 | import com.vaadin.flow.server.VaadinService; 25 | 26 | /** 27 | * Generic helpers for the demo. 28 | * 29 | * @author Vaadin 30 | */ 31 | public interface Util { 32 | 33 | /** 34 | * Gets the name of the view. 35 | *

36 | * This utility method exists so we can get the title based on only the view 37 | * class, for the menu. This works as we do not have any dynamic view names 38 | * in this site. 39 | * 40 | * @param navigationTarget 41 | * the navigation target class 42 | * @return the target's name 43 | */ 44 | static String getNavigationTargetName( 45 | Class navigationTarget) { 46 | Optional title = AnnotationReader 47 | .getAnnotationFor(navigationTarget, PageTitle.class) 48 | .map(PageTitle::value); 49 | return title.orElse(VaadinService.getCurrent().getInstantiator() 50 | .getI18NProvider().getTranslation(navigationTarget.getName(), 51 | UI.getCurrent().getLocale())); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /demo-registration-form/src/main/java/com/vaadin/flow/demo/registrationform/ui/PasswordValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.registrationform.ui; 17 | 18 | import com.vaadin.flow.data.binder.ValidationResult; 19 | import com.vaadin.flow.data.binder.ValueContext; 20 | import com.vaadin.flow.data.validator.StringLengthValidator; 21 | 22 | /** 23 | * Custom password validator class. 24 | * 25 | * @author Vaadin Ltd 26 | * 27 | */ 28 | public class PasswordValidator extends StringLengthValidator { 29 | 30 | /** 31 | * Creates a new instance. 32 | */ 33 | public PasswordValidator() { 34 | super("", 6, Integer.MAX_VALUE); 35 | } 36 | 37 | @Override 38 | public ValidationResult apply(String value, ValueContext context) { 39 | ValidationResult result = super.apply(value, context); 40 | if (result.isError()) { 41 | return ValidationResult 42 | .error("Password should contain at least 6 characters"); 43 | } else if (!hasDigit(value) || !hasLetter(value)) { 44 | return ValidationResult 45 | .error("Password must contain a letter and a number"); 46 | } 47 | return result; 48 | } 49 | 50 | private boolean hasDigit(String pwd) { 51 | return pwd.chars().anyMatch(Character::isDigit); 52 | } 53 | 54 | private boolean hasLetter(String pwd) { 55 | return pwd.chars().anyMatch(Character::isLetter); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /demo-dynamic-menu/src/main/java/com/vaadin/flow/demo/dynamicmenu/data/Product.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.dynamicmenu.data; 17 | 18 | import java.io.Serializable; 19 | import java.math.BigDecimal; 20 | 21 | /** 22 | * Data describing a product. 23 | * 24 | * @author Vaadin 25 | * @since 26 | */ 27 | public class Product implements Serializable { 28 | 29 | private int id = -1; 30 | private String productName = ""; 31 | private BigDecimal price = BigDecimal.ZERO; 32 | private Category category; 33 | private int stockCount = 0; 34 | 35 | public int getId() { 36 | return id; 37 | } 38 | 39 | public void setId(int id) { 40 | this.id = id; 41 | } 42 | 43 | public String getProductName() { 44 | return productName; 45 | } 46 | 47 | public void setProductName(String productName) { 48 | this.productName = productName; 49 | } 50 | 51 | public BigDecimal getPrice() { 52 | return price; 53 | } 54 | 55 | public void setPrice(BigDecimal price) { 56 | this.price = price; 57 | } 58 | 59 | public Category getCategory() { 60 | return category; 61 | } 62 | 63 | public void setCategory(Category category) { 64 | this.category = category; 65 | } 66 | 67 | public int getStockCount() { 68 | return stockCount; 69 | } 70 | 71 | public void setStockCount(int stockCount) { 72 | this.stockCount = stockCount; 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /demo-model-converters/src/main/webapp/frontend/components/SignInForm.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 34 | 42 | 43 | -------------------------------------------------------------------------------- /demo-minesweeper-polymer/src/main/webapp/frontend/components/minesweeper.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 47 | 48 | 74 | 75 | -------------------------------------------------------------------------------- /demo-minesweeper-polymer/src/test/java/com/vaadin/flow/demo/minesweeper/component/MinesweeperPageObject.java: -------------------------------------------------------------------------------- 1 | package com.vaadin.flow.demo.minesweeper.component; 2 | 3 | import org.openqa.selenium.By; 4 | import org.openqa.selenium.WebElement; 5 | 6 | import com.vaadin.flow.demo.minesweeper.component.data.MineFieldData; 7 | import com.vaadin.flow.demo.testutil.AbstractChromeTest; 8 | 9 | abstract class MinesweeperPageObject extends AbstractChromeTest { 10 | private final MineFieldData seed1MineFieldData = new MineFieldData(10, 10, 11 | 1, 0.2); 12 | 13 | @Override 14 | protected void open() { 15 | super.open(); 16 | waitForElementPresent(By.id("template")); 17 | } 18 | 19 | @Override 20 | protected void open(String... parameters) { 21 | super.open(parameters); 22 | waitForElementPresent(By.id("template")); 23 | } 24 | 25 | boolean isMineSeed1(int row, int col) { 26 | return seed1MineFieldData.isMine(row, col); 27 | } 28 | 29 | void waitForBoomNotification() { 30 | waitForNotification("BOOM! Reload to try again"); 31 | } 32 | 33 | private void waitForNotification(String string) { 34 | waitForElementPresent(By.xpath("//div[text()='" + string + "']")); 35 | } 36 | 37 | void waitForSuccessNotification() { 38 | waitForNotification("Congratulations!"); 39 | } 40 | 41 | boolean isCellHidden(int row, int col) { 42 | WebElement cell = getCell(row, col); 43 | return !hasCssClass(cell, "empty") && !hasCssClass(cell, "revealed"); 44 | } 45 | 46 | boolean isCellEmpty(int row, int col) { 47 | WebElement cell = getCell(row, col); 48 | return hasCssClass(cell, "empty"); 49 | } 50 | 51 | WebElement getCell(int row, int col) { 52 | WebElement template = findElement(By.id("template")); 53 | WebElement mineField = getInShadowRoot(template, 54 | By.cssSelector(".table")); 55 | WebElement rowE = mineField.findElements(By.cssSelector(".row")) 56 | .get(row); 57 | return rowE.findElements(By.cssSelector(".cell")).get(col); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /demo-todo-template/src/main/java/com/vaadin/flow/demo/helloworld/template/Todo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.helloworld.template; 17 | 18 | import java.io.Serializable; 19 | import java.time.LocalDateTime; 20 | 21 | /** 22 | * Todo item. 23 | */ 24 | public class Todo implements Serializable { 25 | 26 | private String task; 27 | private String user; 28 | private int rid; 29 | 30 | private LocalDateTime time; 31 | 32 | private boolean completed = false; 33 | 34 | 35 | public String getTask() { 36 | return task; 37 | } 38 | 39 | public void setTask(String task) { 40 | this.task = task; 41 | } 42 | 43 | public String getUser() { 44 | return user; 45 | } 46 | 47 | public void setUser(String user) { 48 | this.user = user; 49 | } 50 | 51 | public int getRid() { 52 | return rid; 53 | } 54 | 55 | public void setRid(int rid) { 56 | this.rid = rid; 57 | } 58 | 59 | public LocalDateTime getTime() { 60 | return time; 61 | } 62 | 63 | public void setTime(LocalDateTime time) { 64 | this.time = time; 65 | } 66 | 67 | public boolean isCompleted() { 68 | return completed; 69 | } 70 | 71 | public void setCompleted(boolean completed) { 72 | this.completed = completed; 73 | } 74 | 75 | @Override 76 | public String toString() { 77 | return String.format("Task: %s, User: %s, Id: %s", task, 78 | user, rid); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /demo-jquery-table/src/main/java/com/vaadin/flow/demo/jquerytable/element/html/Select.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.jquerytable.element.html; 17 | 18 | import java.util.Optional; 19 | 20 | import com.vaadin.flow.component.AbstractSinglePropertyField; 21 | import com.vaadin.flow.component.Tag; 22 | import com.vaadin.flow.dom.Element; 23 | 24 | /** 25 | * Component representing a <select> element. 26 | * 27 | * @see Option 28 | */ 29 | @Tag(Tag.SELECT) 30 | public class Select extends AbstractSinglePropertyField { 31 | 32 | public static final String VALUE_PROPERTY = "value"; 33 | 34 | /** 35 | * Creates an empty select. 36 | */ 37 | public Select() { 38 | super(VALUE_PROPERTY, "", false); 39 | getElement().synchronizeProperty(VALUE_PROPERTY, "change"); 40 | } 41 | 42 | /** 43 | * Adds an option to this select. 44 | * 45 | * @param option 46 | * A not null Option 47 | */ 48 | public void addOption(Option option) { 49 | if (option != null) { 50 | getElement().appendChild(option.getElement()); 51 | } 52 | } 53 | 54 | /** 55 | * Gets the selected String value, if any. 56 | * 57 | * @return the selected value in the select element 58 | */ 59 | public Optional getSelectedValue() { 60 | Element el = getElement(); 61 | String selectedValue = el.getProperty(VALUE_PROPERTY); 62 | return Optional.ofNullable(selectedValue); 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /demo-todo-template/src/main/java/com/vaadin/flow/demo/helloworld/template/TodoList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.helloworld.template; 17 | 18 | import com.vaadin.flow.component.Tag; 19 | import com.vaadin.flow.component.dependency.HtmlImport; 20 | import com.vaadin.flow.component.polymertemplate.Id; 21 | import com.vaadin.flow.component.polymertemplate.PolymerTemplate; 22 | import com.vaadin.flow.router.Route; 23 | import com.vaadin.flow.templatemodel.TemplateModel; 24 | 25 | /** 26 | * The main application view of the todo application. 27 | */ 28 | @Tag("todo-template") 29 | @HtmlImport("frontend://components/TodoTemplate.html") 30 | @Route("") 31 | public class TodoList extends PolymerTemplate { 32 | 33 | @Id("creator") 34 | private TodoCreator creator; 35 | 36 | /** 37 | * Creates the todo list applicaton base. 38 | */ 39 | public TodoList() { 40 | setId("template"); 41 | 42 | creator.addCreateCallback(todo -> addNewTodoItem(todo)); 43 | } 44 | 45 | private void addNewTodoItem(Todo todo) { 46 | TodoElement todoElement = new TodoElement(todo); 47 | 48 | todoElement.getElement().addEventListener("remove", 49 | e -> getElement().removeChild(todoElement.getElement())); 50 | 51 | todoElement.addStateChangeListener(() -> { 52 | if (todoElement.isCompleted()) { 53 | todoElement.getElement().setAttribute("slot", "done"); 54 | } 55 | }); 56 | 57 | getElement().appendChild(todoElement.getElement()); 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /demo-route-menu/src/main/webapp/frontend/styles/styles.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Skyrim-inspired Menu 3 | */ 4 | @import url(http://fonts.googleapis.com/css?family=Open+Sans:400,300); 5 | 6 | html { 7 | background: #333 0 0 repeat; 8 | font-family: "Open Sans", sans-serif; 9 | font-weight: 300; 10 | color: #FFF; 11 | } 12 | 13 | a { 14 | color: rgba(255, 255, 255, 0.6); 15 | text-decoration: none; 16 | } 17 | 18 | a:hover, li:hover > a { 19 | color: #FFF; 20 | } 21 | 22 | ul { 23 | list-style-type: none; 24 | margin: 0; 25 | padding: 0; 26 | } 27 | 28 | li { 29 | margin: 0; 30 | padding: 0; 31 | } 32 | 33 | #menu { 34 | border-left: 1px solid #FFF; 35 | border-right: 1px solid #FFF; 36 | background: rgba(0, 0, 0, 0.5); 37 | float: left; 38 | font-size: 1.5em; 39 | min-height: 100%; 40 | margin-left: 1em; 41 | margin-right: 1em; 42 | } 43 | 44 | #menu li { 45 | position: relative; 46 | z-index: 1; 47 | } 48 | 49 | #menu li a { 50 | display: block; 51 | padding: 0.5em 1em; 52 | white-space: nowrap; 53 | } 54 | 55 | #menu li ul { 56 | position: absolute; 57 | overflow: hidden; 58 | display: none; 59 | left: 100%; 60 | top: 0.5em; 61 | float: none; 62 | background-image: -moz-radial-gradient(0 50%, ellipse farthest-side, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.5) 33%, rgba(0, 0, 0, 0) 100%); 63 | background-image: -webkit-radial-gradient(0 50%, ellipse farthest-side, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.5) 33%, rgba(0, 0, 0, 0) 100%); 64 | background-image: radial-gradient(0 50%, ellipse farthest-side, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.5) 33%, rgba(0, 0, 0, 0) 100%); 65 | } 66 | 67 | #menu li:hover ul { 68 | display: block; 69 | } 70 | 71 | #menu li ul a { 72 | position: relative; 73 | font-size: 0.8em; 74 | } 75 | 76 | #menu li ul a:hover:before { 77 | content: ""; 78 | display: block; 79 | width: 1em; 80 | height: 1em; 81 | background: rgba(0, 0, 0, 0.75); 82 | border: 1px solid #FFF; 83 | position: absolute; 84 | top: 0.5em; 85 | left: -0.75em; 86 | -moz-transform: rotate(45deg); 87 | -webkit-transform: rotate(45deg); 88 | transform: rotate(45deg); 89 | } 90 | -------------------------------------------------------------------------------- /demo-web-site/src/main/java/com/vaadin/flow/demo/website/ParameterView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.website; 17 | 18 | import com.vaadin.flow.component.html.Div; 19 | import com.vaadin.flow.router.BeforeEvent; 20 | import com.vaadin.flow.router.HasUrlParameter; 21 | import com.vaadin.flow.router.Route; 22 | import com.vaadin.flow.router.RouterLink; 23 | import com.vaadin.flow.server.VaadinService; 24 | 25 | /** 26 | * A dynamic view that shows different content based on a parameter in the URL. 27 | * 28 | * @since 29 | * @author Vaadin Ltd 30 | */ 31 | @Route(value = "param", layout = MainLayout.class) 32 | public final class ParameterView extends SimpleView 33 | implements HasUrlParameter { 34 | 35 | private Div idElement; 36 | private RouterLink linkToNext; 37 | 38 | /** 39 | * Creates a new dynamic view. 40 | */ 41 | public ParameterView() { 42 | add(super.getMappingInfo("param/{id}")); 43 | Div content = new Div(); 44 | content.setClassName("content"); 45 | 46 | idElement = new Div(); 47 | linkToNext = new RouterLink("Open the same view with another parameter", 48 | ParameterView.class, 1); 49 | 50 | content.add(idElement, linkToNext); 51 | add(content); 52 | } 53 | 54 | @Override 55 | public void setParameter(BeforeEvent event, Integer parameter) { 56 | idElement.setText("Id parameter: " + parameter); 57 | linkToNext.setRoute(VaadinService.getCurrent().getRouter(), 58 | ParameterView.class, parameter + 1); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /demo-jquery-table/src/test/java/com/vaadin/flow/demo/persistence/IssuesRepositoryTest.java: -------------------------------------------------------------------------------- 1 | package com.vaadin.flow.demo.persistence; 2 | 3 | import java.util.List; 4 | 5 | import org.junit.Assert; 6 | import org.junit.Before; 7 | import org.junit.Test; 8 | 9 | import com.vaadin.flow.demo.jquerytable.persistence.IssuesRepository; 10 | import com.vaadin.flow.demo.jquerytable.persistence.Project; 11 | import com.vaadin.flow.demo.jquerytable.persistence.ProjectVersion; 12 | import com.vaadin.flow.demo.jquerytable.persistence.Report; 13 | 14 | /** 15 | * The purpose of this test is not to test extensively the database, but to make 16 | * sure that there are sufficient data for the demo to run properly. 17 | */ 18 | public class IssuesRepositoryTest { 19 | 20 | private IssuesRepository repository; 21 | 22 | @Before 23 | public void setup() { 24 | repository = IssuesRepository.get(); 25 | } 26 | 27 | /* 28 | * This test ensures that the database has at least 1 project. 29 | */ 30 | @Test 31 | public void testFindProjects() { 32 | List projects = repository.findProjects(); 33 | Assert.assertNotNull(projects); 34 | Assert.assertFalse(projects.isEmpty()); 35 | } 36 | 37 | /* 38 | * This test ensures that there is at least 1 version for the first project. 39 | */ 40 | @Test 41 | public void testFindVersions() { 42 | List projects = repository.findProjects(); 43 | Project project = projects.stream().sorted().findFirst().get(); 44 | List versions = repository.findProjectVersions(project); 45 | Assert.assertNotNull(versions); 46 | Assert.assertFalse(versions.isEmpty()); 47 | } 48 | 49 | /* 50 | * This test ensures that there are at least 2 reports for the first 51 | * project. 52 | */ 53 | @Test 54 | public void testFindReports() { 55 | List projects = repository.findProjects(); 56 | Project project = projects.stream().sorted().findFirst().get(); 57 | 58 | List reports = repository.findReports(project, null); 59 | Assert.assertNotNull(reports); 60 | Assert.assertTrue(reports.size() > 1); 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /demo-minesweeper-polymer/src/main/java/com/vaadin/flow/demo/minesweeper/component/MinesweeperView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.minesweeper.component; 17 | 18 | import java.util.List; 19 | import java.util.Optional; 20 | 21 | import com.vaadin.flow.component.Component; 22 | import com.vaadin.flow.component.html.Div; 23 | import com.vaadin.flow.demo.minesweeper.component.component.MinesweeperComponent; 24 | import com.vaadin.flow.router.BeforeEnterEvent; 25 | import com.vaadin.flow.router.BeforeEnterObserver; 26 | import com.vaadin.flow.router.Route; 27 | 28 | /** 29 | * UI which demonstrates how you can use the Flow {@link Component} API to 30 | * create a Minesweeper game. 31 | */ 32 | @Route(value = "") 33 | public class MinesweeperView extends Div implements BeforeEnterObserver { 34 | 35 | private static int getParam(BeforeEnterEvent event, String name, 36 | int defaultValue) { 37 | List param = event.getLocation().getQueryParameters() 38 | .getParameters().get(name); 39 | return Optional.ofNullable(param).map(l -> l.get(0)) 40 | .map(Integer::parseInt).orElse(defaultValue); 41 | } 42 | 43 | @Override 44 | public void beforeEnter(BeforeEnterEvent event) { 45 | long seed = getParam(event, "seed", (int) System.currentTimeMillis()); 46 | double mineDensity = getParam(event, "mineDensity", 20) / 100.0; 47 | int rows = getParam(event, "rows", 10); 48 | int cols = getParam(event, "cols", 10); 49 | 50 | add(new MinesweeperComponent(seed, mineDensity, rows, cols)); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /demo-dynamic-routes/src/main/java/com/vaadin/flow/demo/dynamic/UserView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2018 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.dynamic; 17 | 18 | import com.vaadin.flow.component.button.Button; 19 | import com.vaadin.flow.component.html.Span; 20 | import com.vaadin.flow.component.orderedlayout.VerticalLayout; 21 | import com.vaadin.flow.demo.Login; 22 | import com.vaadin.flow.demo.MainLayout; 23 | import com.vaadin.flow.router.Route; 24 | import com.vaadin.flow.router.RouteConfiguration; 25 | import com.vaadin.flow.router.RouterLink; 26 | 27 | /** 28 | * User view that can be dynamically registered. 29 | * 30 | * The {@code DynamicRoute} annotation removes this class from the initial 31 | * registration 32 | * and lets us register it later with the default functionality expected of a 33 | * {@code Route} 34 | */ 35 | @Route(value = "", layout = MainLayout.class, registerAtStartup = false) 36 | public class UserView extends VerticalLayout { 37 | 38 | /** 39 | * Constructor. 40 | */ 41 | public UserView() { 42 | Span text = new Span("This is the view for a logged in user."); 43 | 44 | add(text); 45 | RouteConfiguration routeConfiguration = RouteConfiguration 46 | .forSessionScope(); 47 | if (routeConfiguration.isRouteRegistered(VersionView.class)) { 48 | add(new RouterLink("Version", VersionView.class)); 49 | } 50 | if (routeConfiguration.isRouteRegistered(TimeView.class)) { 51 | add(new RouterLink("Time", TimeView.class)); 52 | } 53 | Button logout = new Button("Logout", e -> Login.logout()); 54 | 55 | add(logout); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /demo-model-converters/src/main/java/com/vaadin/flow/demo/helloworld/template/DateToDateBeanConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.helloworld.template; 17 | 18 | import java.util.Calendar; 19 | import java.util.Date; 20 | import java.util.GregorianCalendar; 21 | 22 | import com.vaadin.flow.templatemodel.ModelEncoder; 23 | 24 | /** 25 | * Convert a {@link Date} to a {@link DateBean}. 26 | * 27 | * @author Vaadin Ltd 28 | * 29 | */ 30 | public class DateToDateBeanConverter implements ModelEncoder { 31 | 32 | @Override 33 | public DateBean encode(Date modelValue) { 34 | if (modelValue == null) { 35 | return null; 36 | } 37 | DateBean bean = new DateBean(); 38 | Calendar calendar = GregorianCalendar.getInstance(); 39 | calendar.setTime(modelValue); 40 | bean.setDay(Integer.toString(calendar.get(Calendar.DAY_OF_MONTH))); 41 | bean.setMonth(Integer.toString(calendar.get(Calendar.MONTH) + 1)); 42 | bean.setYear(Integer.toString(calendar.get(Calendar.YEAR))); 43 | return bean; 44 | } 45 | 46 | @Override 47 | public Date decode(DateBean presentationValue) { 48 | if (presentationValue == null) { 49 | return null; 50 | } 51 | int year = Integer.parseInt(presentationValue.getYear()); 52 | int day = Integer.parseInt(presentationValue.getDay()); 53 | int month = Integer.parseInt(presentationValue.getMonth()) - 1; 54 | Calendar calendar = GregorianCalendar.getInstance(); 55 | calendar.set(year, month, day); 56 | return calendar.getTime(); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /demo-todo-template/src/test/java/com/vaadin/flow/demo/helloworld/template/TodoIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2016 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.helloworld.template; 17 | 18 | import org.junit.Assert; 19 | import org.junit.Test; 20 | import org.openqa.selenium.By; 21 | import org.openqa.selenium.WebElement; 22 | 23 | import com.vaadin.flow.demo.testutil.AbstractChromeTest; 24 | 25 | public class TodoIT extends AbstractChromeTest { 26 | 27 | @Test 28 | public void basicFunctionality() { 29 | open(); 30 | 31 | WebElement template = findElement(By.id("template")); 32 | 33 | WebElement createTemplate = getInShadowRoot(template, 34 | By.id("creator")); 35 | 36 | WebElement todo = getInShadowRoot(createTemplate, By.id("task-input")); 37 | todo.sendKeys("Important task"); 38 | 39 | WebElement user = getInShadowRoot(createTemplate, 40 | By.id("user-name-input")); 41 | user.sendKeys("Teuvo testi"); 42 | 43 | WebElement createButton = getInShadowRoot(createTemplate, 44 | By.id("create-button")); 45 | createButton.click(); 46 | 47 | WebElement todoElement = template 48 | .findElement(By.tagName("todo-element")); 49 | Assert.assertEquals("Important task", 50 | getInShadowRoot(todoElement, By.id("task")) 51 | .getText()); 52 | 53 | getInShadowRoot(todoElement, By.id("checkbox")).click(); 54 | 55 | todoElement = template 56 | .findElement(By.tagName("todo-element")); 57 | Assert.assertEquals("done", todoElement.getAttribute("slot")); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /demo-minesweeper-element/src/test/java/com/vaadin/flow/demo/minesweeper/element/MinesweeperPageObject.java: -------------------------------------------------------------------------------- 1 | package com.vaadin.flow.demo.minesweeper.element; 2 | 3 | import org.junit.Assert; 4 | import org.openqa.selenium.By; 5 | import org.openqa.selenium.WebElement; 6 | 7 | import com.vaadin.flow.demo.testutil.AbstractChromeTest; 8 | 9 | public abstract class MinesweeperPageObject extends AbstractChromeTest { 10 | 11 | @Override 12 | protected void open() { 13 | super.open(); 14 | waitForElementPresent(By.tagName("table")); 15 | } 16 | 17 | @Override 18 | protected void open(String... parameters) { 19 | super.open(parameters); 20 | waitForElementPresent(By.tagName("table")); 21 | } 22 | 23 | protected void waitForBoomNotification() { 24 | waitForNotification("BOOM! Reload to try again"); 25 | } 26 | 27 | private void waitForNotification(String string) { 28 | waitForElementPresent(By.xpath("//div[text()='" + string + "']")); 29 | } 30 | 31 | protected void waitForSuccessNotification() { 32 | waitForNotification("Congratulations!"); 33 | } 34 | 35 | protected void assertCellHidden(int row, int col) { 36 | Assert.assertTrue(isCellHidden(row, col)); 37 | } 38 | 39 | private boolean isCellHidden(int row, int col) { 40 | WebElement cell = getCell(row, col); 41 | return !hasCssClass(cell, "empty") && !hasCssClass(cell, "revealed"); 42 | } 43 | 44 | private boolean isCellEmpty(int row, int col) { 45 | WebElement cell = getCell(row, col); 46 | return hasCssClass(cell, "empty"); 47 | } 48 | 49 | protected void assertCellEmpty(int row, int col) { 50 | Assert.assertTrue(isCellEmpty(row, col)); 51 | } 52 | 53 | protected void assertCellHiddenOrEmpty(String message, int row, int col) { 54 | Assert.assertTrue(message, 55 | isCellHidden(row, col) || isCellEmpty(row, col)); 56 | 57 | } 58 | 59 | protected WebElement getCell(int row, int col) { 60 | WebElement rowE = getMineField().findElements(By.xpath(".//tr")) 61 | .get(row); 62 | return rowE.findElements(By.xpath("td")).get(col); 63 | } 64 | 65 | protected abstract WebElement getMineField(); 66 | 67 | } 68 | -------------------------------------------------------------------------------- /demo-minesweeper-component/src/test/java/com/vaadin/flow/demo/minesweeper/component/MinesweeperPageObject.java: -------------------------------------------------------------------------------- 1 | package com.vaadin.flow.demo.minesweeper.component; 2 | 3 | import org.junit.Assert; 4 | import org.openqa.selenium.By; 5 | import org.openqa.selenium.WebElement; 6 | 7 | import com.vaadin.flow.demo.testutil.AbstractChromeTest; 8 | 9 | public abstract class MinesweeperPageObject extends AbstractChromeTest { 10 | 11 | @Override 12 | protected void open() { 13 | super.open(); 14 | waitForElementPresent(By.tagName("table")); 15 | } 16 | 17 | @Override 18 | protected void open(String... parameters) { 19 | super.open(parameters); 20 | waitForElementPresent(By.tagName("table")); 21 | } 22 | 23 | protected void waitForBoomNotification() { 24 | waitForNotification("BOOM! Reload to try again"); 25 | } 26 | 27 | private void waitForNotification(String string) { 28 | waitForElementPresent(By.xpath("//div[text()='" + string + "']")); 29 | } 30 | 31 | protected void waitForSuccessNotification() { 32 | waitForNotification("Congratulations!"); 33 | } 34 | 35 | protected void assertCellHidden(int row, int col) { 36 | Assert.assertTrue(isCellHidden(row, col)); 37 | } 38 | 39 | private boolean isCellHidden(int row, int col) { 40 | WebElement cell = getCell(row, col); 41 | return !hasCssClass(cell, "empty") && !hasCssClass(cell, "revealed"); 42 | } 43 | 44 | private boolean isCellEmpty(int row, int col) { 45 | WebElement cell = getCell(row, col); 46 | return hasCssClass(cell, "empty"); 47 | } 48 | 49 | protected void assertCellEmpty(int row, int col) { 50 | Assert.assertTrue(isCellEmpty(row, col)); 51 | } 52 | 53 | protected void assertCellHiddenOrEmpty(String message, int row, int col) { 54 | Assert.assertTrue(message, 55 | isCellHidden(row, col) || isCellEmpty(row, col)); 56 | 57 | } 58 | 59 | protected WebElement getCell(int row, int col) { 60 | WebElement rowE = getMineField().findElements(By.xpath(".//tr")) 61 | .get(row); 62 | return rowE.findElements(By.xpath("td")).get(col); 63 | } 64 | 65 | protected abstract WebElement getMineField(); 66 | 67 | } 68 | -------------------------------------------------------------------------------- /demo-minesweeper-element/src/main/java/com/vaadin/flow/demo/minesweeper/element/Point.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.minesweeper.element; 17 | 18 | import java.util.Objects; 19 | 20 | /** 21 | * A representation of a position (row and column) in a grid. 22 | */ 23 | public class Point { 24 | int row, col; 25 | 26 | /** 27 | * Creates a point with the given position. 28 | * 29 | * @param row 30 | * the row coordinate 31 | * @param col 32 | * the column coordinate 33 | */ 34 | public Point(int row, int col) { 35 | super(); 36 | this.row = row; 37 | this.col = col; 38 | } 39 | 40 | /** 41 | * Gets the row. 42 | * 43 | * @return the row 44 | */ 45 | public int getRow() { 46 | return row; 47 | } 48 | 49 | /** 50 | * Gets the column. 51 | * 52 | * @return the column 53 | */ 54 | public int getCol() { 55 | return col; 56 | } 57 | 58 | @Override 59 | public int hashCode() { 60 | return Objects.hash(row, col); 61 | } 62 | 63 | @Override 64 | public boolean equals(Object obj) { 65 | if (this == obj) { 66 | return true; 67 | } 68 | if (obj == null) { 69 | return false; 70 | } 71 | if (getClass() != obj.getClass()) { 72 | return false; 73 | } 74 | Point other = (Point) obj; 75 | return col == other.col && row == other.row; 76 | } 77 | 78 | @Override 79 | public String toString() { 80 | return "Point [row=" + row + ", col=" + col + "]"; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /demo-dynamic-menu/src/main/java/com/vaadin/flow/demo/dynamicmenu/MenuItemComponent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.dynamicmenu; 17 | 18 | import com.vaadin.flow.component.Component; 19 | import com.vaadin.flow.component.HtmlContainer; 20 | import com.vaadin.flow.component.Tag; 21 | import com.vaadin.flow.router.HasUrlParameter; 22 | import com.vaadin.flow.router.RouterLink; 23 | 24 | /** 25 | * A menu item component. 26 | * 27 | * @author Vaadin Ltd 28 | * 29 | */ 30 | @Tag("li") 31 | public class MenuItemComponent extends HtmlContainer { 32 | 33 | private static final String CLASS_SELECTED = "selected"; 34 | 35 | /** 36 | * Creates a new item component. 37 | * 38 | * @param viewClass 39 | * view class for the item's link to navigate 40 | * @param id 41 | * category id 42 | * @param name 43 | * category name 44 | */ 45 | public > MenuItemComponent( 46 | Class viewClass, int id, 47 | String name) { 48 | RouterLink categoryLink = new RouterLink(name, viewClass, id); 49 | add(categoryLink); 50 | } 51 | 52 | /** 53 | * Selects or deselects the item. 54 | * 55 | * @param select 56 | * if {@code true} then select the item and deselect it otherwise 57 | */ 58 | public void select(boolean select) { 59 | if (select) { 60 | getElement().getChild(0).getClassList().add(CLASS_SELECTED); 61 | } else { 62 | getElement().getChild(0).getClassList().remove(CLASS_SELECTED); 63 | } 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /demo-model-converters/src/test/java/com/vaadin/flow/demo/helloworld/template/SignInFormIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2016 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.helloworld.template; 17 | 18 | import java.time.LocalDate; 19 | import java.time.Period; 20 | 21 | import org.junit.Test; 22 | import org.openqa.selenium.By; 23 | import org.openqa.selenium.Keys; 24 | import org.openqa.selenium.WebElement; 25 | 26 | import com.vaadin.flow.demo.testutil.AbstractChromeTest; 27 | 28 | public class SignInFormIT extends AbstractChromeTest { 29 | 30 | @Test 31 | public void basicFunctionality() { 32 | open(); 33 | 34 | setText("name", "John Doe"); 35 | setText("day", "2"); 36 | setText("month", "4"); 37 | setText("year", "1975"); 38 | 39 | WebElement template = findElement(By.id("template")); 40 | getInShadowRoot(template, By.id("register")).click(); 41 | WebElement msg = getInShadowRoot(template, By.id("reg-msg")); 42 | 43 | LocalDate date = LocalDate.of(1975, 4, 2); 44 | waitUntil(driver -> msg.getText() 45 | .equals("Welcome John Doe, your are " 46 | + Period.between(date, LocalDate.now()).getYears() 47 | + " years old")); 48 | } 49 | 50 | private void setText(String inputId, String text) { 51 | WebElement input = getInShadowRoot(findElement(By.id("template")), By.id(inputId)); 52 | String value = input.getAttribute("value"); 53 | if (value != null) { 54 | for (int i = 0; i < value.length(); i++) { 55 | input.sendKeys(Keys.BACK_SPACE); 56 | } 57 | } 58 | input.sendKeys(text); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /demo-jquery-table/src/main/java/com/vaadin/flow/demo/jquerytable/element/tablesorter/RichColumn.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.jquerytable.element.tablesorter; 17 | 18 | import java.io.Serializable; 19 | import java.util.List; 20 | 21 | /** 22 | * Column definition used in conjunction with {@link RichTable}. 23 | * 24 | * @param 25 | * the type of the model object used with this column 26 | * @see RichTable#setColumns(List) 27 | */ 28 | public interface RichColumn extends Serializable { 29 | 30 | /** 31 | * Gets the name of the column, which is rendered at the table header. 32 | * 33 | * @return a not null name. Empty String is allowed. 34 | */ 35 | String getColumnName(); 36 | 37 | /** 38 | * Gets the CSS classes applied to the column at the table header. 39 | * 40 | * @return a list of CSS classes. 41 | */ 42 | List getColumnClasses(); 43 | 44 | /** 45 | * Gets the value of the object to be used in sorting and grouping. When 46 | * null, the value used for these widgets is the one returned by 47 | * {@link #getRenderedValue(Object)}. 48 | * 49 | * @param object 50 | * The model object 51 | * @return the model value. 52 | */ 53 | String getModelValue(T object); 54 | 55 | /** 56 | * Gets the value of the object to be rendered at the table body. This is 57 | * effectively what the user sees in the table. 58 | * 59 | * @param object 60 | * The model object 61 | * @return the rendered value. null Strings will be rendered as 62 | * "null". 63 | */ 64 | String getRenderedValue(T object); 65 | 66 | } 67 | -------------------------------------------------------------------------------- /demo-minesweeper-component/src/main/java/com/vaadin/flow/demo/minesweeper/component/MinesweeperView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.minesweeper.component; 17 | 18 | import com.vaadin.flow.component.Component; 19 | import com.vaadin.flow.component.dependency.StyleSheet; 20 | import com.vaadin.flow.component.html.Div; 21 | import com.vaadin.flow.demo.minesweeper.component.component.MinesweeperComponent; 22 | import com.vaadin.flow.router.Route; 23 | import com.vaadin.flow.server.VaadinRequest; 24 | import com.vaadin.flow.server.VaadinService; 25 | 26 | /** 27 | * View which demonstrates how you can use the Flow {@link Component} API to 28 | * create a Minesweeper game. 29 | */ 30 | @Route("") 31 | @StyleSheet("frontend://minesweeper.css") 32 | public class MinesweeperView extends Div { 33 | /** 34 | * Create Minesweeper view. 35 | */ 36 | public MinesweeperView() { 37 | VaadinRequest request = VaadinService.getCurrentRequest(); 38 | 39 | long seed = getParam(request, "seed", (int) System.currentTimeMillis()); 40 | double mineDensity = getParam(request, "mineDensity", 20) / 100.0; 41 | int rows = getParam(request, "rows", 10); 42 | int cols = getParam(request, "cols", 10); 43 | 44 | add(new MinesweeperComponent(seed, mineDensity, rows, cols)); 45 | } 46 | 47 | private static int getParam(VaadinRequest request, String name, 48 | int defaultValue) { 49 | int value; 50 | String colsParam = request.getParameter(name); 51 | if (colsParam != null) { 52 | value = Integer.parseInt(colsParam); 53 | } else { 54 | value = defaultValue; 55 | } 56 | return value; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /demo-minesweeper-component/src/main/java/com/vaadin/flow/demo/minesweeper/component/data/Point.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.minesweeper.component.data; 17 | 18 | import java.io.Serializable; 19 | import java.util.Objects; 20 | 21 | /** 22 | * A representation of a position (row and column) in a grid. 23 | */ 24 | public class Point implements Serializable { 25 | int row, col; 26 | 27 | /** 28 | * Creates a point with the given position. 29 | * 30 | * @param row 31 | * the row coordinate 32 | * @param col 33 | * the column coordinate 34 | */ 35 | public Point(int row, int col) { 36 | super(); 37 | this.row = row; 38 | this.col = col; 39 | } 40 | 41 | /** 42 | * Gets the row. 43 | * 44 | * @return the row 45 | */ 46 | public int getRow() { 47 | return row; 48 | } 49 | 50 | /** 51 | * Gets the column. 52 | * 53 | * @return the column 54 | */ 55 | public int getCol() { 56 | return col; 57 | } 58 | 59 | @Override 60 | public int hashCode() { 61 | return Objects.hash(row, col); 62 | } 63 | 64 | @Override 65 | public boolean equals(Object obj) { 66 | if (this == obj) { 67 | return true; 68 | } 69 | if (obj == null) { 70 | return false; 71 | } 72 | if (getClass() != obj.getClass()) { 73 | return false; 74 | } 75 | Point other = (Point) obj; 76 | return col == other.col && row == other.row; 77 | } 78 | 79 | @Override 80 | public String toString() { 81 | return "Point [row=" + row + ", col=" + col + "]"; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /demo-minesweeper-polymer/src/main/java/com/vaadin/flow/demo/minesweeper/component/data/Point.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.minesweeper.component.data; 17 | 18 | import java.io.Serializable; 19 | import java.util.Objects; 20 | 21 | /** 22 | * A representation of a position (row and column) in a grid. 23 | */ 24 | public class Point implements Serializable { 25 | int row, col; 26 | 27 | /** 28 | * Creates a point with the given position. 29 | * 30 | * @param row 31 | * the row coordinate 32 | * @param col 33 | * the column coordinate 34 | */ 35 | public Point(int row, int col) { 36 | super(); 37 | this.row = row; 38 | this.col = col; 39 | } 40 | 41 | /** 42 | * Gets the row. 43 | * 44 | * @return the row 45 | */ 46 | public int getRow() { 47 | return row; 48 | } 49 | 50 | /** 51 | * Gets the column. 52 | * 53 | * @return the column 54 | */ 55 | public int getCol() { 56 | return col; 57 | } 58 | 59 | @Override 60 | public int hashCode() { 61 | return Objects.hash(row, col); 62 | } 63 | 64 | @Override 65 | public boolean equals(Object obj) { 66 | if (this == obj) { 67 | return true; 68 | } 69 | if (obj == null) { 70 | return false; 71 | } 72 | if (getClass() != obj.getClass()) { 73 | return false; 74 | } 75 | Point other = (Point) obj; 76 | return col == other.col && row == other.row; 77 | } 78 | 79 | @Override 80 | public String toString() { 81 | return "Point [row=" + row + ", col=" + col + "]"; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /demo-model-converters/src/main/java/com/vaadin/flow/demo/helloworld/template/DateBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.helloworld.template; 17 | 18 | import java.io.Serializable; 19 | 20 | /** 21 | * Bean which contains a birthday as a 3 separate properties: year, month and 22 | * day. 23 | * 24 | * @author Vaadin Ltd 25 | * 26 | */ 27 | public class DateBean implements Serializable { 28 | 29 | private String day; 30 | private String month; 31 | private String year; 32 | 33 | /** 34 | * Gets the birthday. 35 | * 36 | * @return the birthday 37 | */ 38 | public String getDay() { 39 | return day; 40 | } 41 | 42 | /** 43 | * Sets the birthday. 44 | * 45 | * @param day 46 | * the birthday. 47 | */ 48 | public void setDay(String day) { 49 | this.day = day; 50 | } 51 | 52 | /** 53 | * Gets the month of birth date. 54 | * 55 | * @return the birthday 56 | */ 57 | public String getMonth() { 58 | return month; 59 | } 60 | 61 | /** 62 | * Sets the month of the birth date. 63 | * 64 | * @param month 65 | * the month of the birth date 66 | */ 67 | public void setMonth(String month) { 68 | this.month = month; 69 | } 70 | 71 | /** 72 | * Gets the year of the birth date. 73 | * 74 | * @return the year of the birth date 75 | */ 76 | public String getYear() { 77 | return year; 78 | } 79 | 80 | /** 81 | * Sets the year of the birth date. 82 | * 83 | * @param year 84 | * the year of the birth date 85 | */ 86 | public void setYear(String year) { 87 | this.year = year; 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /demo-dynamic-menu/src/main/java/com/vaadin/flow/demo/dynamicmenu/MainLayout.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.dynamicmenu; 17 | 18 | import com.vaadin.flow.component.HasElement; 19 | import com.vaadin.flow.component.dependency.StyleSheet; 20 | import com.vaadin.flow.component.html.Div; 21 | import com.vaadin.flow.router.BeforeEnterEvent; 22 | import com.vaadin.flow.router.BeforeEnterObserver; 23 | import com.vaadin.flow.router.RouterLayout; 24 | 25 | /** 26 | * Layout showing the main menu above a sub view. 27 | * 28 | * @since 29 | * @author Vaadin Ltd 30 | */ 31 | @StyleSheet("css/site.css") 32 | public final class MainLayout extends Div 33 | implements RouterLayout, BeforeEnterObserver { 34 | 35 | private final Div contentHolder = new Div(); 36 | private final Menu menu; 37 | 38 | /** 39 | * Creates a new layout. 40 | */ 41 | public MainLayout() { 42 | setClassName("main"); 43 | 44 | menu = new Menu(); 45 | add(menu, contentHolder); 46 | contentHolder.setClassName("content"); 47 | } 48 | 49 | @Override 50 | public void showRouterLayoutContent(HasElement content) { 51 | contentHolder.getElement().appendChild(content.getElement()); 52 | } 53 | 54 | /** 55 | * Called when the location changes so the menu can be updated based on the 56 | * currently shown view. 57 | * 58 | * @param event 59 | * before navigation change event 60 | */ 61 | @Override 62 | public void beforeEnter(BeforeEnterEvent event) { 63 | int categoryId = CategoryView.getCategoryId(event.getLocation()); 64 | int productId = ProductView.getProductId(event.getLocation()); 65 | menu.updateSelection(categoryId, productId); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /demo-static-menu-router/src/test/java/com/vaadin/flow/demo/website/HomePageIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.website; 17 | 18 | import org.junit.Assert; 19 | import org.junit.Test; 20 | 21 | import org.openqa.selenium.By; 22 | 23 | public class HomePageIT extends AbstractComplexStaticMenuTest { 24 | 25 | @Test 26 | public void topMenuIsPresent() { 27 | open(); 28 | 29 | Assert.assertTrue("Home link not present", 30 | isElementPresent(By.className("logo"))); 31 | Assert.assertTrue("Links present", 32 | isElementPresent(By.className("topnav"))); 33 | 34 | Assert.assertTrue("Framework link not present", getMenuItem("Framework").isDisplayed()); 35 | Assert.assertTrue("Elements link not present", getMenuItem("Elements").isDisplayed()); 36 | Assert.assertTrue("Download link not present", getMenuItem("Download").isDisplayed()); 37 | 38 | getMenuItem("Framework").click(); 39 | 40 | Assert.assertTrue("SubMenu item 'Tutorial' is missing", getSubMenuItem("Tutorial").isDisplayed()); 41 | 42 | getMenuItem("Elements").click(); 43 | 44 | Assert.assertTrue("SubMenu item 'Demos' is missing", getSubMenuItem("Demos").isDisplayed()); 45 | 46 | getMenuItem("Download").click(); 47 | 48 | Assert.assertTrue("SubMenu item 'Docs' is missing", getSubMenuItem("Docs").isDisplayed()); 49 | Assert.assertTrue("SubMenu item 'Vaadin Icons' is missing", getSubMenuItem("Vaadin Icons").isDisplayed()); 50 | 51 | getSubMenuItem("Vaadin Icons").click(); 52 | 53 | Assert.assertTrue("SubSubMenu item 'Icons' is missing", getSubSubMenuItem("Vaadin Icons").isDisplayed()); 54 | Assert.assertTrue("SubSubMenu item 'About' is missing", getSubSubMenuItem("About").isDisplayed()); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /demo-dynamic-menu/src/main/java/com/vaadin/flow/demo/dynamicmenu/backend/DataService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.dynamicmenu.backend; 17 | 18 | import java.util.Collection; 19 | import java.util.Optional; 20 | import java.util.stream.Stream; 21 | 22 | import com.vaadin.flow.demo.dynamicmenu.data.Category; 23 | import com.vaadin.flow.demo.dynamicmenu.data.Product; 24 | 25 | /** 26 | * Back-end service interface for retrieving and updating product data. 27 | */ 28 | public interface DataService { 29 | 30 | /** 31 | * Gets all products. 32 | * 33 | * @return all products 34 | */ 35 | Collection getAllProducts(); 36 | 37 | /** 38 | * Gets all categories. 39 | * 40 | * @return all categories 41 | */ 42 | Collection getAllCategories(); 43 | 44 | /** 45 | * Gets the product with the given id. 46 | * 47 | * @param productId 48 | * the product id 49 | * @return the product with the given id 50 | */ 51 | Optional getProductById(int productId); 52 | 53 | /** 54 | * Gets the category with the given id. 55 | * 56 | * @param categoryId 57 | * the category id 58 | * @return the category with the given id 59 | */ 60 | Optional getCategoryById(int categoryId); 61 | 62 | /** 63 | * Gets all products which belongs to the given category. 64 | * 65 | * @param categoryId 66 | * the category id 67 | * @return all products belonging to the given category 68 | */ 69 | Stream getProducts(int categoryId); 70 | 71 | /** 72 | * Gets the singleton data service instance. 73 | * 74 | * @return the only data service instance 75 | */ 76 | static DataService get() { 77 | return MockDataService.get(); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /demo-static-menu-router/src/main/java/com/vaadin/flow/demo/staticmenu/community/blog/BlogList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.staticmenu.community.blog; 17 | 18 | import com.vaadin.flow.component.UI; 19 | import com.vaadin.flow.component.button.Button; 20 | import com.vaadin.flow.component.html.Div; 21 | import com.vaadin.flow.demo.staticmenu.MainLayout; 22 | import com.vaadin.flow.demo.staticmenu.community.blog.backend.BlogRecord; 23 | import com.vaadin.flow.demo.staticmenu.community.blog.backend.BlogsService; 24 | import com.vaadin.flow.i18n.LocaleChangeEvent; 25 | import com.vaadin.flow.i18n.LocaleChangeObserver; 26 | import com.vaadin.flow.router.PageTitle; 27 | import com.vaadin.flow.router.Route; 28 | import com.vaadin.flow.router.RouterLink; 29 | 30 | /** 31 | * The blog post view. 32 | * 33 | * @author Vaadin Ltd 34 | */ 35 | @Route(value = "blog", layout = MainLayout.class) 36 | @PageTitle("Blog Post") 37 | public class BlogList extends Div implements LocaleChangeObserver { 38 | 39 | private Button addBlogPost; 40 | 41 | /** 42 | * Constructor populating blog listing. 43 | */ 44 | public BlogList() { 45 | BlogsService.getInstance().getItems().forEach(this::addRecord); 46 | 47 | // TODO: Update after #2702 implemented 48 | UI ui = UI.getCurrent(); 49 | addBlogPost = new Button("Add Blog Post", buttonClickEvent -> ui 50 | .navigate(ui.getRouter().getUrl(BlogCreator.class))); 51 | add(addBlogPost); 52 | } 53 | 54 | private void addRecord(BlogRecord record) { 55 | RouterLink link = new RouterLink(record.getTitle(), BlogPost.class, 56 | record.getId()); 57 | add(new Div(link)); 58 | } 59 | 60 | @Override 61 | public void localeChange(LocaleChangeEvent event) { 62 | addBlogPost.setText(getTranslation("new.blog.post")); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /demo-google-signin/src/main/webapp/frontend/components/signin.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 38 | 39 | 76 | 77 | -------------------------------------------------------------------------------- /demo-contact-form/src/main/java/com/vaadin/flow/demo/contactform/ui/Contact.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | 17 | package com.vaadin.flow.demo.contactform.ui; 18 | 19 | import java.io.Serializable; 20 | import java.time.LocalDate; 21 | 22 | public class Contact implements Serializable { 23 | 24 | private String firstName = ""; 25 | private String lastName = ""; 26 | private String phone = ""; 27 | private String email = ""; 28 | private LocalDate birthDate; 29 | private boolean doNotCall; 30 | 31 | 32 | public boolean isDoNotCall() { 33 | return doNotCall; 34 | } 35 | 36 | public void setDoNotCall(boolean doNotCall) { 37 | this.doNotCall = doNotCall; 38 | } 39 | 40 | public String getFirstName() { 41 | return firstName; 42 | } 43 | 44 | public void setFirstName(String firstName) { 45 | this.firstName = firstName; 46 | } 47 | 48 | public String getLastName() { 49 | return lastName; 50 | } 51 | 52 | public void setLastName(String lastName) { 53 | this.lastName = lastName; 54 | } 55 | 56 | public String getPhone() { 57 | return phone; 58 | } 59 | 60 | public void setPhone(String phone) { 61 | this.phone = phone; 62 | } 63 | 64 | public String getEmail() { 65 | return email; 66 | } 67 | 68 | public void setEmail(String email) { 69 | this.email = email; 70 | } 71 | 72 | public LocalDate getBirthDate() { 73 | return birthDate; 74 | } 75 | 76 | public void setBirthDate(LocalDate birthDate) { 77 | this.birthDate = birthDate; 78 | } 79 | 80 | @Override 81 | public String toString() { 82 | return "Contact{ firstName=" + firstName 83 | + ", lastName=" + lastName + ", phone=" + phone + ", email=" 84 | + email + ", birthDate=" + birthDate + ",doNotCall=" + doNotCall 85 | + '}'; 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /demo-web-site/src/main/java/com/vaadin/flow/demo/website/SiteServiceInitListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.website; 17 | 18 | import org.jsoup.nodes.Document; 19 | import org.jsoup.nodes.Element; 20 | 21 | import com.vaadin.flow.server.BootstrapListener; 22 | import com.vaadin.flow.server.BootstrapPageResponse; 23 | import com.vaadin.flow.server.ServiceInitEvent; 24 | import com.vaadin.flow.server.VaadinServiceInitListener; 25 | 26 | /** 27 | * Custom service initialization listener which adds bootstrap listener to 28 | * modify the bootstrap application page. 29 | * 30 | * @since 31 | * @author Vaadin Ltd 32 | */ 33 | public class SiteServiceInitListener implements VaadinServiceInitListener { 34 | 35 | private static class SiteBootstrapListener implements BootstrapListener { 36 | 37 | @Override 38 | public void modifyBootstrapPage(BootstrapPageResponse response) { 39 | Document document = response.getDocument(); 40 | 41 | Element head = document.head(); 42 | 43 | head.appendChild(createMeta(document, "og:title", "The Rock")); 44 | head.appendChild(createMeta(document, "og:type", "video.movie")); 45 | head.appendChild(createMeta(document, "og:url", 46 | "http://www.imdb.com/title/tt0117500/")); 47 | head.appendChild(createMeta(document, "og:image", 48 | "http://ia.media-imdb.com/images/rock.jpg")); 49 | } 50 | 51 | private Element createMeta(Document document, String property, 52 | String content) { 53 | Element meta = document.createElement("meta"); 54 | meta.attr("property", property); 55 | meta.attr("content", content); 56 | return meta; 57 | } 58 | 59 | } 60 | 61 | @Override 62 | public void serviceInit(ServiceInitEvent event) { 63 | event.addBootstrapListener(new SiteBootstrapListener()); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /demo-dynamic-menu/src/main/java/com/vaadin/flow/demo/dynamicmenu/backend/MockDataService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2017 Vaadin Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package com.vaadin.flow.demo.dynamicmenu.backend; 17 | 18 | import java.util.List; 19 | import java.util.Optional; 20 | import java.util.stream.Stream; 21 | 22 | import com.vaadin.flow.demo.dynamicmenu.data.Category; 23 | import com.vaadin.flow.demo.dynamicmenu.data.Product; 24 | 25 | /** 26 | * A simple data model. 27 | */ 28 | public class MockDataService implements DataService { 29 | 30 | private static final MockDataService INSTANCE = new MockDataService(); 31 | 32 | private List products; 33 | private List categories; 34 | 35 | private MockDataService() { 36 | categories = MockDataGenerator.createCategories(); 37 | products = MockDataGenerator.createProducts(categories); 38 | } 39 | 40 | /** 41 | * Gets the singleton instance. 42 | * 43 | * @return the only instance 44 | */ 45 | public static synchronized MockDataService get() { 46 | return INSTANCE; 47 | } 48 | 49 | @Override 50 | public synchronized List getAllProducts() { 51 | return products; 52 | } 53 | 54 | @Override 55 | public synchronized List getAllCategories() { 56 | return categories; 57 | } 58 | 59 | @Override 60 | public Stream getProducts(int categoryId) { 61 | return getAllProducts().stream() 62 | .filter(p -> p.getCategory().getId() == categoryId); 63 | } 64 | 65 | @Override 66 | public synchronized Optional getCategoryById(int catId) { 67 | return getAllCategories().stream().filter(c -> c.getId() == catId) 68 | .findFirst(); 69 | } 70 | 71 | @Override 72 | public synchronized Optional getProductById(int productId) { 73 | return getAllProducts().stream().filter(p -> p.getId() == productId) 74 | .findFirst(); 75 | } 76 | } 77 | --------------------------------------------------------------------------------