{{email}}
18 |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 PolymerTemplatetrue 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<option> element.
26 | */
27 | @Tag(Tag.OPTION)
28 | public class Option extends HtmlComponent implements HasText {
29 |
30 | private static final PropertyDescriptor| First Name | 9 |Last Name | 10 ||
|---|---|---|
| [[item.firstName]] | 16 |[[item.lastName]] | 17 |[[item.email]] | 18 |
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 extends Component> navigationTarget) {
46 | Optional
26 |
27 | <select> element.
26 | *
27 | * @see Option
28 | */
29 | @Tag(Tag.SELECT)
30 | public class Select extends AbstractSinglePropertyField