Code Monkey home page Code Monkey logo

beverage-starter-flow's Introduction

This example application has been deprecated

This project is not updated anymore, but is still visible as an old example for using Java and HTML in Vaadin 14. Please see our starting page for newer project examples.

Beverage Buddy App Starter for Vaadin Flow

โ˜•๐Ÿต๐Ÿถ๐Ÿผ๐Ÿบ๐Ÿธ๐Ÿน๐Ÿท

This is a Vaadin platform example application created with Java and HTML. It is used to demonstrate features of Vaadin platform.

The easiest way of using it is via https://vaadin.com/start - you can choose the vaadin version and the package naming you want. If you want to use it with the latest vaadin version you can use this direct link.

The Starter demonstrates the core Vaadin Flow concepts:

Prerequisites

The project can be imported into the IDE of your choice, with Java 8 or 11 installed, as a Maven project.

But additionally you need node.js installed in your System, and available in your PATH. See the Node.js page for the installation instructions.

Dependencies

Dependencies are managed by Vaadin platform and vaadin-maven-plugin.

Running the Project in Developer Mode

  1. Run mvn
  2. Wait for the application to start
  3. Open http://localhost:8080/ to view the application

Note that there are some files/folders generated in the project structure automatically. You can find some information about them here.

Production Mode

  1. Run mvn package -Pproduction to get the artifact.
  2. Deploy the target/beveragebuddy-2.0-SNAPSHOT.war.

If you want to run the production build using the Jetty plugin, use mvn jetty:run -Pproduction and navigate to the http://localhost:8080/.

Documentation

Brief introduction to the application parts can be found from the documentation folder. For Vaadin documentation for Java users, see Vaadin.com/docs.

Adding new templates

To add a new template or a style to the project create the JavaScript module in the ./frontend directory.

Then in the PolymerTemplate using the P3 element add the JsModule annotation e.g. @JsModule("./src/views/reviewslist/reviews-list.js")

Branching information

  • master the latest version of the starter, using the latest platform version
  • v10 the version for Vaadin Platform 10
  • v11 the version for Vaadin Platform 11
  • v12 the version for Vaadin Platform 12
  • v13 the version for Vaadin Platform 13

beverage-starter-flow's People

Contributors

ahie avatar alvarezguille avatar anasmi avatar artur- avatar caalador avatar diegosanzvi avatar gilberto-torrezan avatar haijian-vaadin avatar jojule avatar jouni avatar juhopiirainen avatar legioth avatar manolo avatar mehdi-vaadin avatar mikotin avatar mstahv avatar ollitietavainenvaadin avatar pekam avatar platosha avatar pleku avatar qtdzz avatar someonetoignore avatar tatulund avatar torok-peter avatar ujoni avatar vaadin-bot avatar zhesun88 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

beverage-starter-flow's Issues

Edit / Delete Categories

When listing categories, I want to be able to edit/delete them, because I don't need them anymore

The same dialog as in #10, but with a Delete button. The delete operation should ask for confirmation on the delete, similarly as in #6.

Either deleting or editing a category should show the feedback dialog, similarly as to in #7 .

Feedback Notification on Add/Edit/Delete

When adding/editing/deleting reviews, I want to see feedback on the operation, so that I know that it succeeded

A dialog notification which disappears either automatically, or by clicking it (to be confirmed).

Note: this could use paper-toast which is coming as an add-on dependency.

Improve entity handling and filtering in the backend services

  • rewrite the filtering in the backend services to use streams, like
List<Category> categoriesSelected = categories.stream()
        .filter(c -> c.toString().toLowerCase().contains(stringCategoryFilterLoCase)
        .collect(Collectors.toList());
  • obsolete the sorting by e.g. using a LinkedHashMap instead of HashMap to store the entities. Note: We may want to sort them by most recent first?

ReviewForm doesn't handle invalid date values properly

If I set the date to a nonsense value like "a/b/xx" in the ReviewForm then click Save, I get no validation error but an internal error after the dialog closed, when the value is attempted to be converted into a LocalDate.

I think that proper validation should prevent this.

Routing and Navigation

When opening the app, I want to have navigation on top, so I can easily navigate between the views

There should be header with two buttons, that switch the active view, and the corresponding button is highlighted.

On the left, the name of the App is shown.

It is fine to not use the icons for the first step.

Category List View

When tasting, I want to categorize the reviews, so that I can more easily try out different types of food

This is a list of categories with the number of reviews for each category. The edit button does not have to work yet.

Write documentation on ReviewsList

Write up what is in the view and how it works:

  • template based
    • link to template documentation (in github/vaadin/flow)
  • what concepts used, if any
  • whatever is necessary to understand from the view

Deleting Reviews

When tasting, I want to be able to delete a review, because I accidentally added it twice

There should be delete button in the edit review dialog from #5, and clicking it opens a confirmation dialog, see the screenshot (it has the wrong text visible so please note that).

Switch to using V10 platform dependency

When the 10.0.0-alpha2 is out, it should be taken into use here instead of flow dependencies.

The platform dependency contains WebJars, then we can remove the bower stuff at the same time.

Editing Reviews

When tasting, I want to be able to edit a review, because I changed my mind on the score.

See screenshot. Same dialog as in #4, the delete button can be left out for now.

Move front-end dependencies to src/main/webapp

This is big step that composes of multiple actions:

  • changing front-end content folder from /src/main/frontend/bower_components/ to /src/main/webapp/bower_components/
    • remember to update .gitignore to ignore these
  • update pom.xml
    • update frontend properties with descriptions on what do their refer to
      • <frontend.working.directory>src/main/webapp</frontend.working.directory>
      • <vaadin.frontend.path>VAADIN/static/frontend</vaadin.frontend.path>
    • update paths for maven-war-plugin and maven-clean-plugin if necessary
      • check for inclusions and exclusions

Category form breaks if Category view is opened first

During refactoring the dialogs, when I extracted the CategoryForm code into its own class, all of a sudden the dialogs appeared directly on the view at startup, and couldnโ€™t be opened/closed anymore:
image.png

Tried everything, consulted with @pekam - nothing helped. Comparison to ReviewForm did not reveal any difference in the way the forms are created and opened.

After a couple of hours of agony I discovered that this happens only when I open the /categories URL directly, without seeing the Reviews view first! If I switch to the Reviews view and back, the problem disappears and the dialog starts to behave in a perfectly decent manner.

Even though this shouldn't occur in the normal flow of events (as the root URL is mapped to the Reviews view), it would still be worth fixing.

Adding New Category

When tasting, I want to be able to add a new category, so that I can add reviews of that type

After #9 add a button that opens a dialog (see screenshot) that can be used to add a new category.

After adding category should show the feedback notification, similarly as to in #7.

Static Backend with Data

When opening the app, I want to have some static data available, so that I don't have to create everything with the UI so see all the features

Static in-memory POJO data accessed via service layer, similarly to
https://github.com/vaadin/addressbook/blob/master/src/main/java/com/vaadin/tutorial/addressbook/backend/ContactService.java

  • Reviews
    • score
    • name
    • date tasted
  • Categories

Service layer calls for first iteration:

List<Review> findReviews()
List<Review> findReviewsByString(String filterText)
List<Category> findCategories()
List<Category> findCategories(String filterText)
Review saveReview(Review review)
boolean deleteReview(ID/Review review)
Category saveCategory(Category category)
boolean deleteCategory(Category category)

Add documentation regarding front-end content

This should cover following topics/files with brief explanation and a link to corresponding place in Flow documentation in github/vaadin/flow

  • bower.json and /bower_components
  • package.json
  • polymer.json & index.html

Adding a new Review

When tasting, I want to be able to enter a new review, so that I can track my tasting experiences.

See screenshot. The name is required (size > 2), the score is from 0-5, and the date picker should have the current date preselect. The default category is undefined.

Filtering Reviews List

When looking at my reviews, I want to easily filter them, so that I can find out if I have already reviewed something

There is a search field on top of the list of reviews, and that should do a full text search on the reviews.

Write documentation on ReviewForm

Write up what is in the view and how it works:

  • binder used
    • link to documentation on binder (in github/vaadin/flow)
  • what other concepts used, if any

Factor static data out of the services

Currently the static data used to generate reviews is inside the service classes. This tangles them up quite badly into a mutual dependency. Refactor code to extract static data into a separate class inside the same package.

Write documentation on integrating a Web Component

Write a bit about the PaperToast component included in the project:

  • What are the necessary parts for it and why
    • dependency bower.json
  • link to flow documentation on
    • integrating a web component
    • anything other required

Write a proper Readme

Please fix the current read me as it is totally out of date. You should mention:

  • what is the user looking at
  • what is in there
  • how to get started (git clone & mvn run)

Handle undefined and unknown categories properly

Currently ReviewService.saveReview() can't handle the case when a new Review is added which contains a new Category (that is, the category itself has not yet been persisted into CategoryService, thus it has no id). If this happens, the new category won't be persisted, so it won't show up in the Category view either and is not editable/deletable.

This can not currently happen via the UI, still it would be good to handle the use case properly.

Should also handle the "undefined" pseudo-category properly:

  • currently an NPE occurs when opening the Add Review dialog, due to the category of the new review object being null
  • overall, should we have a dedicated "dummy" Category object to represent this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.