Skip to content

manolo/vaadin-showcase

Repository files navigation

Vaadin ShowCase

This showcase demonstrates all Vaadin Flow views that can be directly configured at start.vaadin.com and downloaded with your skeleton starter project.

It provides practical examples of common UI patterns and features available in Vaadin, helping developers understand how to implement these views in their own applications.

In addition there are a bunch of custom views intended to demo specific Vaadin features or UI patterns:

MasterDetailResponsiveView Demonstrates a responsive master-detail UI pattern for editing and viewing entities (SamplePerson), supporting navigation, editing, and refresh persistence.

GridEditFilterRestView Shows an editable grid with filtering capabilities, using REST data sources. It uses a custom DataProvider able to read from API services, and allows inline editing and filtering of data records.

GridwithFiltersRestView Demos a grid component with REST-based data and filter controls, enabling users to filter and view data interactively.

CrudView Demonstrates the Vaadin Crud component for full Create, Read, Update, Delete operations on entities, including form layouts and validation. It simplifies crud views versus the regular usage of master-detail pattern. In addition it demonstrates how to use i18n in some components including datapickers

GridEditPaginatedFilterView Combines editable grid, filtering, and pagination features, using a paginated grid for large datasets with inline editing and filter controls.

GridEditPaginatedView Demos an editable paginated grid, focusing on editing and navigating large datasets efficiently.

AddonsView Showcases various Vaadin and third-party add-ons, including text field formatters (phone, credit card, date, IBAN), toggle buttons, and input masks.

Wizard Views The wizard views (CheckoutStep1View, CheckoutStep2View, CheckoutStep3View, CheckoutStep4View) together demonstrate a step-by-step form flow, where each class represents a distinct step in a multi-part checkout process. This approach showcases how to split complex forms into manageable steps, improving user experience and maintainability in Vaadin applications.


Running the application

The project is a standard Maven project. To run it from the command line, type mvnw (Windows), or ./mvnw (Mac & Linux), then open http://localhost:8080 in your browser.

You can also import the project to your IDE of choice as you would with any Maven project. Read more on how to import Vaadin projects to different IDEs (Eclipse, IntelliJ IDEA, NetBeans, and VS Code).

Deploying to Production

To create a production build, call mvnw clean package -Pproduction (Windows), or ./mvnw clean package -Pproduction (Mac & Linux). This will build a JAR file with all the dependencies and front-end resources, ready to be deployed. The file can be found in the target folder after the build completes.

Once the JAR file is built, you can run it using java -jar target/show-case-1.0-SNAPSHOT.jar

Project structure

  • MainLayout.java in src/main/java contains the navigation setup (i.e., the side/top bar and the main menu). This setup uses App Layout.
  • views package in src/main/java contains the server-side Java views of your application.
  • views folder in src/main/frontend contains the client-side JavaScript views of your application.
  • themes folder in src/main/frontend contains the custom CSS styles.

Useful links

Deploying using Docker

To build the Dockerized version of the project, run

mvn clean package -Pproduction
docker build . -t show-case:latest

Once the Docker image is correctly built, you can test it locally using

docker run -p 8080:8080 show-case:latest

Deploying using Kubernetes

We assume here that you have the Kubernetes cluster from Docker Desktop running (can be enabled in the settings).

First build the Docker image for your application. You then need to make the Docker image available to you cluster. With Docker Desktop Kubernetes, this happens automatically. With Minikube, you can run eval $(minikube docker-env) and then build the image to make it available. For other clusters, you need to publish to a Docker repository or check the documentation for the cluster.

The included kubernetes.yaml sets up a deployment with 2 pods (server instances) and a load balancer service. You can deploy the application on a Kubernetes cluster using

kubectl apply -f kubernetes.yaml

If everything works, you can access your application by opening http://localhost:8000/. If you have something else running on port 8000, you need to change the load balancer port in kubernetes.yaml.

Tip: If you want to understand which pod your requests go to, you can add the value of VaadinServletRequest.getCurrent().getLocalAddr() somewhere in your UI.

Troubleshooting

If something is not working, you can try one of the following commands to see what is deployed and their status.

kubectl get pods
kubectl get services
kubectl get deployments

If the pods say Container image "show-case:latest" is not present with pull policy of Never then you have not built your application using Docker or there is a mismatch in the name. Use docker images ls to see which images are available.

If you need even more information, you can run

kubectl cluster-info dump

that will probably give you too much information but might reveal the cause of a problem.

If you want to remove your whole deployment and start over, run

kubectl delete -f kubernetes.yaml

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages