From 1c940958aaede02d100a9c1bc287b3f6ccccd675 Mon Sep 17 00:00:00 2001 From: Martin Lopez Date: Fri, 3 Apr 2026 12:13:50 -0300 Subject: [PATCH] feat: bootstrap Easy Form Add-on from AddonStarter24 Replace the template starter with the Easy Form Add-on project structure. Add SPECIFICATIONS.md with detailed component design. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/commits.yml | 8 + .github/workflows/maven.yml | 30 + .gitignore | 5 + .vaadin/copilot/vaadin-copilot.properties | 6 + LICENSE | 7 +- README.md | 151 ++- SPECIFICATIONS.md | 370 +++++++ assembly/MANIFEST.MF | 6 - assembly/assembly.xml | 45 - drivers.xml | 40 - pom.xml | 974 +++++++++--------- .../{EasyForm.java => EasyFormAddon.java} | 10 +- .../frontend/styles/static_addon_styles | 2 +- .../META-INF/resources/static_addon_resources | 2 +- .../flowingcode/vaadin/addons/DemoLayout.java | 8 +- .../vaadin/addons/easyform/DemoView.java | 10 +- .../vaadin/addons/easyform/EasyFormDemo.java | 8 +- ...ateDemoView.java => EasyFormDemoView.java} | 20 +- .../addons/easyform/it/AbstractViewTest.java | 8 +- .../vaadin/addons/easyform/it/ViewIT.java | 8 +- .../addons/easyform/test/LayoutTest.java | 38 - .../easyform/test/SerializationTest.java | 12 +- 22 files changed, 1048 insertions(+), 720 deletions(-) create mode 100644 .github/workflows/commits.yml create mode 100644 .github/workflows/maven.yml create mode 100644 .vaadin/copilot/vaadin-copilot.properties create mode 100644 SPECIFICATIONS.md delete mode 100644 assembly/MANIFEST.MF delete mode 100644 assembly/assembly.xml delete mode 100644 drivers.xml rename src/main/java/com/flowingcode/vaadin/addons/easyform/{EasyForm.java => EasyFormAddon.java} (90%) rename src/test/java/com/flowingcode/vaadin/addons/easyform/{TemplateDemoView.java => EasyFormDemoView.java} (59%) delete mode 100644 src/test/java/com/flowingcode/vaadin/addons/easyform/test/LayoutTest.java diff --git a/.github/workflows/commits.yml b/.github/workflows/commits.yml new file mode 100644 index 0000000..d096e00 --- /dev/null +++ b/.github/workflows/commits.yml @@ -0,0 +1,8 @@ +name: Check Commits + +on: + pull_request: + +jobs: + check-commits: + uses: FlowingCode/GithubActions/.github/workflows/check-commits.yml@main diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml new file mode 100644 index 0000000..95c3fe2 --- /dev/null +++ b/.github/workflows/maven.yml @@ -0,0 +1,30 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Java CI with Maven + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + + build-vaadin24: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up JDK + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + - name: Build (Vaadin 24) + run: mvn -B package --file pom.xml \ No newline at end of file diff --git a/.gitignore b/.gitignore index c0fd923..8a30ffa 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,8 @@ drivers tsconfig.json .idea types.d.ts +/frontend/generated +/frontend/index.html +vite.generated.ts +vite.config.ts +/src/main/dev-bundle \ No newline at end of file diff --git a/.vaadin/copilot/vaadin-copilot.properties b/.vaadin/copilot/vaadin-copilot.properties new file mode 100644 index 0000000..0e8b963 --- /dev/null +++ b/.vaadin/copilot/vaadin-copilot.properties @@ -0,0 +1,6 @@ +#Vaadin Copilot Integration Runtime Properties +#Tue Jan 06 09:29:34 ART 2026 +endpoint=http\://127.0.0.1\:50537/vaadin/copilot-3789fb28-3a13-4614-8e14-1bb9afeea771 +ide=eclipse +supportedActions=write,writeBase64,delete,undo,redo,refresh,showInIde,getModulePaths,compileFiles,restartApplication,getVaadinRoutes,getVaadinVersion,getVaadinComponents,getVaadinEntities,getVaadinSecurity,reloadMavenModule,heartbeat +version=1.0.0 diff --git a/LICENSE b/LICENSE index 3607cc5..5756052 100644 --- a/LICENSE +++ b/LICENSE @@ -1,9 +1,4 @@ -All parts, except the contents of the documentation module, are licenced -under Apache License v2.0. See the license text below. - -The documentation is licensed under Creative Commons CC-BY-ND 2.0 -(http://creativecommons.org/licenses/by-nd/2.0/legalcode). - +All parts are licensed under Apache License v2.0. See the license text below. ----------------------------------------------------------------------------- diff --git a/README.md b/README.md index 103fbd0..44391d5 100644 --- a/README.md +++ b/README.md @@ -1,57 +1,94 @@ -[![Published on Vaadin Directory](https://img.shields.io/badge/Vaadin%20Directory-published-00b4f0.svg)](https://vaadin.com/directory/component/easy-form-addon) -[![Stars on vaadin.com/directory](https://img.shields.io/vaadin-directory/star/app-layout-addon.svg)](https://vaadin.com/directory/component/easy-form-addon) -[![Build Status](https://jenkins.flowingcode.com/job/easy-form-addon/badge/icon)](https://jenkins.flowingcode.com/job/easy-form-addon) - -# Easy Form Add-on - -This Addon allows to create forms automatically by retrieving metadata from an associated bean and then automatically creating suitable fields. - -## Features - -* Automatic Form creation and binder configuration - -## Online demo - -[Online demo here](http://addonsv14.flowingcode.com/easyform) - -## Download release - -[Available in Vaadin Directory](https://vaadin.com/directory/component/easy-form-addon) - -## Building and running demo - -- git clone repository -- mvn clean install jetty:run - -To see the demo, navigate to http://localhost:8080/ - -## Release notes - -See [here](https://github.com/FlowingCode/EasyFormAddon/releases) - -## Issue tracking - -The issues for this add-on are tracked on its github.com page. All bug reports and feature requests are appreciated. - -## Contributions - -Contributions are welcome, but there are no guarantees that they are accepted as such. Process for contributing is the following: - -- Fork this project -- Create an issue to this project about the contribution (bug or feature) if there is no such issue about it already. Try to keep the scope minimal. -- Develop and test the fix or functionality carefully. Only include minimum amount of code needed to fix the issue. -- Refer to the fixed issue in commit -- Send a pull request for the original project -- Comment on the original issue that you have implemented a fix for it - -## License & Author - -Add-on is distributed under Apache License 2.0. For license terms, see LICENSE.txt. - -Easy Form Addon is written by Flowing Code S.A. - -# Developer Guide - -## Getting started - -Add your code samples in this section \ No newline at end of file +[![Published on Vaadin Directory](https://img.shields.io/badge/Vaadin%20Directory-published-00b4f0.svg)](https://vaadin.com/directory/component/easy-form-addon) +[![Stars on vaadin.com/directory](https://img.shields.io/vaadin-directory/star/app-layout-addon.svg)](https://vaadin.com/directory/component/easy-form-addon) +[![Build Status](https://jenkins.flowingcode.com/job/easy-form-addon/badge/icon)](https://jenkins.flowingcode.com/job/easy-form-addon) +[![Maven Central](https://img.shields.io/maven-central/v/com.flowingcode.vaadin.addons/easy-form-addon)](https://mvnrepository.com/artifact/com.flowingcode.vaadin.addons/easy-form-addon) + +# Easy Form Add-on + +This is a template project for building new Vaadin 24 add-ons + +## Features + +* List the features of your add-on in here + +## Online demo + +[Online demo here](http://addonsv24.flowingcode.com/easy-form) + +## Download release + +[Available in Vaadin Directory](https://vaadin.com/directory/component/easy-form-addon) + +### Maven install + +Add the following dependencies in your pom.xml file: + +```xml + + com.flowingcode.vaadin.addons + easy-form-addon + X.Y.Z + +``` + + +```xml + + vaadin-addons + https://maven.vaadin.com/vaadin-addons + +``` + +For SNAPSHOT versions see [here](https://maven.flowingcode.com/snapshots/). + +## Building and running demo + +- git clone repository +- mvn clean install jetty:run + +To see the demo, navigate to http://localhost:8080/ + +## Release notes + +See [here](https://github.com/FlowingCode/EasyFormAddon/releases) + +## Issue tracking + +The issues for this add-on are tracked on its github.com page. All bug reports and feature requests are appreciated. + +## Contributions + +Contributions are welcome, but there are no guarantees that they are accepted as such. + +As first step, please refer to our [Development Conventions](https://github.com/FlowingCode/DevelopmentConventions) page to find information about Conventional Commits & Code Style requirements. + +Then, follow these steps for creating a contribution: + +- Fork this project. +- Create an issue to this project about the contribution (bug or feature) if there is no such issue about it already. Try to keep the scope minimal. +- Develop and test the fix or functionality carefully. Only include minimum amount of code needed to fix the issue. +- For commit message, use [Conventional Commits](https://github.com/FlowingCode/DevelopmentConventions/blob/main/conventional-commits.md) to describe your change. +- Send a pull request for the original project. +- Comment on the original issue that you have implemented a fix for it. + +## License & Author + +This add-on is distributed under Apache License 2.0. For license terms, see LICENSE.txt. + +EASY_FORM_ADDON is written by Flowing Code S.A. + +# Developer Guide + +## Getting started + +Add your code samples in this section + +## Special configuration when using Spring + +By default, Vaadin Flow only includes ```com/vaadin/flow/component``` to be always scanned for UI components and views. For this reason, the add-on might need to be whitelisted in order to display correctly. + +To do so, just add ```com.flowingcode``` to the ```vaadin.whitelisted-packages``` property in ```src/main/resources/application.properties```, like: + +```vaadin.whitelisted-packages = com.vaadin,org.vaadin,dev.hilla,com.flowingcode``` + +More information on Spring whitelisted configuration [here](https://vaadin.com/docs/latest/integrations/spring/configuration/#configure-the-scanning-of-packages). diff --git a/SPECIFICATIONS.md b/SPECIFICATIONS.md new file mode 100644 index 0000000..03b064c --- /dev/null +++ b/SPECIFICATIONS.md @@ -0,0 +1,370 @@ +# Easy Form Add-on — Specification + +## 1. Overview + +The Easy Form Add-on is a Vaadin Flow component that automatically generates a fully functional form from a Java POJO (Plain Old Java Object) definition. It uses reflection and Bean Validation (JSR-380) annotations to create form fields, configure validations, and manage data binding — all with minimal boilerplate code. + +The add-on provides a clean, fluent Java API for controlling field visibility, editability, layout, button configuration, and action handling. + +## 2. Core Concepts + +### 2.1 Automatic Field Discovery + +Given a POJO class `T`, `EasyForm` introspects its properties (via getter/setter conventions) and creates appropriate Vaadin form fields for each one. + +### 2.2 Type-to-Component Mapping + +Each Java type maps to a default Vaadin component: + +| Java Type | Vaadin Component | Notes | +|-----------|-----------------|-------| +| `String` | `TextField` | | +| `String` (multiline) | `TextArea` | Activated via annotation or API | +| `Integer`, `int` | `IntegerField` | | +| `Long`, `long` | `NumberField` | | +| `Double`, `double`, `Float`, `float` | `NumberField` | | +| `BigDecimal` | `BigDecimalField` | | +| `Boolean`, `boolean` | `Checkbox` | | +| `LocalDate` | `DatePicker` | | +| `LocalDateTime` | `DateTimePicker` | | +| `LocalTime` | `TimePicker` | | +| `Enum` | `ComboBox` | Populated with enum constants | +| `Set>` | `CheckboxGroup` | Multi-select for enum sets | + +Custom type mappings can be registered globally or per-form instance. + +### 2.3 Data Binding + +`EasyForm` internally manages a Vaadin `Binder` that binds each generated field to the corresponding POJO property. The binder supports: + +- Automatic two-way binding (read from / write to the POJO) +- Bean Validation integration (`@NotNull`, `@Size`, `@Email`, `@Min`, `@Max`, `@Pattern`, etc.) +- Manual validation rules added via the API + +### 2.4 Field States + +Each field can be in one of three states: + +| State | Visible | Editable | Included in Binding | +|-------|---------|----------|---------------------| +| **Visible** (default) | Yes | Yes | Yes | +| **Read-only** | Yes | No | Yes (read only) | +| **Hidden** | No | No | No | + +## 3. API Design + +### 3.1 Construction + +```java +// Basic: all discovered properties are shown as editable fields +EasyForm form = new EasyForm<>(Person.class); + +// With an existing bean instance (pre-populates fields) +Person person = personService.findById(id); +EasyForm form = new EasyForm<>(Person.class); +form.setBean(person); +``` + +### 3.2 Field Configuration — Fluent API + +```java +EasyForm form = new EasyForm<>(Person.class); + +// Configure individual fields +form.getField("firstName") + .withLabel("First Name") + .withPlaceholder("Enter first name") + .asRequired("First name is required"); + +form.getField("email") + .withLabel("Email Address") + .withValidator(new EmailValidator("Invalid email")); + +// Make a field read-only +form.getField("id").readOnly(); + +// Hide a field +form.getField("internalCode").hidden(); + +// Set field order (only listed fields are shown, in this order) +form.setFieldOrder("firstName", "lastName", "email", "birthDate", "address"); + +// Hide multiple fields at once +form.hideFields("id", "createdAt", "updatedAt"); + +// Make multiple fields read-only +form.readOnlyFields("createdBy", "version"); + +// Use a custom component for a specific field +form.getField("notes").withComponent(new TextArea()); + +// Use a custom component factory for a type +form.setComponentFactory(Address.class, () -> new AddressFormField()); +``` + +### 3.3 Field Wrapper — `EasyFormField` + +The `getField(String propertyName)` method returns an `EasyFormField` wrapper that provides a fluent interface for configuring individual fields: + +```java +public class EasyFormField { + // Visibility and state + EasyFormField visible(); + EasyFormField readOnly(); + EasyFormField hidden(); + + // Labels and placeholders + EasyFormField withLabel(String label); + EasyFormField withPlaceholder(String placeholder); + EasyFormField withHelperText(String helperText); + + // Validation + EasyFormField asRequired(String errorMessage); + EasyFormField withValidator(Validator validator); + + // Custom component + EasyFormField withComponent(HasValue component); + + // Column span in form layout + EasyFormField withColSpan(int colSpan); + + // Access the underlying Vaadin component + HasValue getComponent(); +} +``` + +### 3.4 Button Configuration + +By default, the form displays **Save** and **Cancel** buttons in a horizontal toolbar below the fields. + +```java +// Default buttons with actions +form.setSaveAction(person -> personService.save(person)); +form.setCancelAction(() -> navigateBack()); + +// Add a Remove button +form.addButton("Remove", VaadinIcon.TRASH, ButtonVariant.LUMO_ERROR, () -> { + personService.delete(form.getBean()); +}); + +// Add a custom button +form.addButton("Send Email", VaadinIcon.ENVELOPE, () -> { + emailService.send(form.getBean()); +}); + +// Remove the default Cancel button +form.removeCancelButton(); + +// Customize the Save button label +form.setSaveButtonText("Submit"); + +// Configure button visibility +form.setSaveButtonVisible(boolean visible); +form.setCancelButtonVisible(boolean visible); + +// Completely replace the button bar +form.setButtonBarFactory(binder -> { + HorizontalLayout bar = new HorizontalLayout(); + // ... custom button layout + return bar; +}); +``` + +### 3.5 Save Action and Validation Flow + +When the Save button is clicked: + +1. All field validators are executed. +2. Bean-level validators (cross-field) are executed. +3. If all validations pass, the binder writes the values to the bean. +4. The registered save action is invoked with the populated bean. +5. If validation fails, error messages are displayed on the relevant fields. + +```java +// Save with result handling +form.setSaveAction(person -> { + try { + personService.save(person); + Notification.show("Saved successfully"); + } catch (Exception e) { + Notification.show("Error: " + e.getMessage(), 3000, Position.MIDDLE); + } +}); + +// Cross-field validation +form.addBeanValidator((person, context) -> { + if (person.getEndDate() != null && person.getEndDate().isBefore(person.getStartDate())) { + return ValidationResult.error("End date must be after start date"); + } + return ValidationResult.ok(); +}); +``` + +### 3.6 Form Layout Configuration + +```java +// Set the number of columns in the FormLayout +form.setResponsiveSteps( + new ResponsiveStep("0", 1), + new ResponsiveStep("600px", 2), + new ResponsiveStep("900px", 3) +); + +// Make a field span multiple columns +form.getField("address").withColSpan(2); +``` + +### 3.7 Events + +```java +// Listen for value changes on a specific field +form.getField("country").addValueChangeListener(event -> { + // Update available cities based on selected country + form.getField("city").withItems(getCities(event.getValue())); +}); + +// Listen for form-level changes +form.addValueChangeListener(event -> { + // Any field changed +}); + +// Before-save hook (can cancel save) +form.addBeforeSaveListener(event -> { + if (!confirmAction()) { + event.cancel(); + } +}); + +// After-save hook +form.addAfterSaveListener(event -> { + Notification.show("Saved: " + event.getBean()); +}); +``` + +### 3.8 Read and Write + +```java +// Set a bean to populate the form (edit mode) +form.setBean(existingPerson); + +// Read values without binding (display mode) +form.readBean(existingPerson); + +// Manually get the current bean with form values written to it +Optional result = form.getValidBean(); // validates first + +// Reset form to initial state +form.reset(); + +// Clear all fields +form.clear(); +``` + +## 4. Default Label Generation + +When no explicit label is provided, labels are auto-generated from property names using camelCase-to-title-case conversion: + +| Property Name | Generated Label | +|--------------|----------------| +| `firstName` | `First Name` | +| `lastName` | `Last Name` | +| `dateOfBirth` | `Date Of Birth` | +| `email` | `Email` | +| `isActive` | `Is Active` | + +## 5. Bean Validation Support + +The form automatically picks up JSR-380 (Bean Validation) annotations from the POJO: + +```java +public class Person { + @NotNull(message = "Name is required") + @Size(min = 2, max = 100, message = "Name must be between 2 and 100 characters") + private String firstName; + + @Email(message = "Must be a valid email address") + private String email; + + @Min(value = 0, message = "Age must be positive") + @Max(value = 150, message = "Age must be less than 150") + private Integer age; + + @NotNull + @Past(message = "Birth date must be in the past") + private LocalDate birthDate; +} +``` + +These annotations are automatically applied as validators on the corresponding form fields. + +## 6. Nested POJO Support + +For properties that are themselves POJOs (e.g., `Address`), the form can: + +- **Flatten** nested properties into the form (default for known types) +- **Use a custom component** registered for that type +- **Ignore** them (hidden by default if no mapping exists) + +```java +// Register a component factory for Address type +form.setComponentFactory(Address.class, () -> new AddressFormField()); + +// Or flatten Address properties into the main form with a prefix +form.flattenNestedBean("address", Address.class); +// This creates fields: address.street, address.city, address.postalCode, etc. +``` + +## 7. Serialization + +`EasyForm` must be fully serializable for Vaadin session persistence. All internal state, including field configurations, validators, and component references, must be serializable. + +## 8. Accessibility + +- All generated fields must have proper labels (either explicit or auto-generated). +- Required fields must be marked with the appropriate ARIA attributes. +- Error messages must be associated with their corresponding fields. +- The form must be navigable via keyboard (tab order follows field order). + +## 9. Usage Example — Complete + +```java +// Minimal usage +EasyForm simpleForm = new EasyForm<>(Person.class); +simpleForm.setSaveAction(person -> personService.save(person)); +add(simpleForm); + +// Customized usage +EasyForm form = new EasyForm<>(Person.class); + +// Configure fields +form.setFieldOrder("firstName", "lastName", "email", "birthDate", "age", "subscriber"); +form.hideFields("id", "createdAt", "updatedAt"); +form.getField("email").withLabel("Email Address").asRequired("Email is required"); +form.getField("birthDate").withLabel("Date of Birth"); + +// Configure buttons +form.setSaveButtonText("Create Person"); +form.setSaveAction(person -> { + personService.save(person); + Notification.show("Person created"); +}); +form.setCancelAction(() -> UI.getCurrent().navigate(PersonListView.class)); + +// Pre-populate for editing +form.setBean(existingPerson); + +add(form); +``` + +## 10. Dependencies + +- Vaadin Flow (24.x) +- Bean Validation API (Jakarta Validation) +- Lombok (per Flowing Code convention for new add-ons) + +## 11. Non-Goals (Out of Scope) + +- Server-side data persistence (that is the consumer's responsibility) +- Built-in navigation or routing +- Complex multi-page wizard forms (single form per instance) +- File upload fields (can be added via custom component factory) diff --git a/assembly/MANIFEST.MF b/assembly/MANIFEST.MF deleted file mode 100644 index de1bed8..0000000 --- a/assembly/MANIFEST.MF +++ /dev/null @@ -1,6 +0,0 @@ -Manifest-Version: 1.0 -Vaadin-Package-Version: 1 -Vaadin-Addon: ${project.build.finalName}.${project.packaging} -Implementation-Vendor: ${organization.name} -Implementation-Title: ${project.name} -Implementation-Version: ${project.version} diff --git a/assembly/assembly.xml b/assembly/assembly.xml deleted file mode 100644 index d10f5f6..0000000 --- a/assembly/assembly.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - flowing-addon - - - zip - - - - false - - - - . - - LICENSE - README.md - - - - target - - - *.jar - *.pdf - - - *-demo.jar - - - - - - - - assembly/MANIFEST.MF - META-INF - true - - - \ No newline at end of file diff --git a/drivers.xml b/drivers.xml deleted file mode 100644 index 358dd8d..0000000 --- a/drivers.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - https://chromedriver.storage.googleapis.com/80.0.3987.106/chromedriver_win32.zip - - 40aeb7b0b3a3ea23a139a764b56e172f2fdb90a4 - sha1 - - - - - - - - - https://chromedriver.storage.googleapis.com/80.0.3987.106/chromedriver_linux64.zip - - 0e8848ebca11706768fd748dd0282672acad35ac - sha1 - - - - - - - - - - https://chromedriver.storage.googleapis.com/80.0.3987.106/chromedriver_mac64.zip - - 3b58b8039f363de3b13a8bea7d4646105fbbd177 - sha1 - - - - - \ No newline at end of file diff --git a/pom.xml b/pom.xml index c477d1d..d5aa5f2 100644 --- a/pom.xml +++ b/pom.xml @@ -1,486 +1,488 @@ - - - 4.0.0 - - org.vaadin.addons.flowingcode - easy-form-addon - 1.0.0-SNAPSHOT - Easy Form Add-on - Easy Form Add-on for Vaadin Flow - - - 14.7.8 - 1.8 - 1.8 - UTF-8 - UTF-8 - ${project.basedir}/drivers - 9.4.36.v20210114 - - - - Flowing Code - https://www.flowingcode.com - - - 2021 - - - Apache 2 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - - - - https://github.com/FlowingCode/AddonStarter14 - scm:git:git://github.com/FlowingCode/AddonStarter14.git - scm:git:ssh://git@github.com:/FlowingCode/AddonStarter14.git - master - - - - - - com.vaadin - vaadin-bom - pom - import - ${vaadin.version} - - - com.flowingcode.vaadin.addons.demo - commons-demo - 3.2.0 - - - - - - - central - https://repo.maven.apache.org/maven2 - - false - - - - Vaadin Directory - https://maven.vaadin.com/vaadin-addons - - - - Vaadin prereleases - https://maven.vaadin.com/vaadin-prereleases - - - - vaadin-snapshots - https://oss.sonatype.org/content/repositories/vaadin-snapshots/ - - - - flowing-releases - https://maven.flowingcode.com/releases - - - - - - central - https://repo.maven.apache.org/maven2 - - false - - - - - Vaadin prereleases - https://maven.vaadin.com/vaadin-prereleases - - - vaadin-snapshots - https://oss.sonatype.org/content/repositories/vaadin-snapshots/ - false - - - - - - com.vaadin - vaadin-core - - - org.slf4j - slf4j-simple - test - - - com.vaadin - vaadin-testbench - test - - - com.flowingcode.vaadin.addons.demo - commons-demo - test - - - org.hamcrest - hamcrest-library - 1.3 - test - - - javax.servlet - javax.servlet-api - 3.1.0 - jar - test - - - io.github.bonigarcia - webdrivermanager - 3.8.1 - test - - - - - jetty:run - - - - org.apache.maven.plugins - maven-release-plugin - 2.5.3 - - - org.apache.maven.plugins - maven-deploy-plugin - 2.8.2 - - - org.apache.maven.plugins - maven-surefire-plugin - 2.22.1 - - false - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - 3.1.2 - - - true - - false - true - - - 1 - - - - - - org.codehaus.mojo - license-maven-plugin - 1.14 - - apache_v2 - false - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.22.1 - - false - - - - com.vaadin - vaadin-maven-plugin - ${vaadin.version} - - - - prepare-frontend - - - - - - org.eclipse.jetty - jetty-maven-plugin - ${jetty.version} - - 3 - - true - - - src/test/resources/META-INF/resources - src/main/resources/META-INF/resources - - - - jar - - - - - - - - - directory - - - - org.apache.maven.plugins - maven-assembly-plugin - 3.1.0 - - false - - assembly/assembly.xml - - - - - - single - - install - - - - - org.apache.maven.plugins - maven-source-plugin - 3.0.1 - - - attach-sources - verify - - jar-no-fork - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.0.1 - - - attach-javadocs - verify - - jar - - - - - true - -Xdoclint:none - - - - org.apache.maven.plugins - maven-jar-plugin - 3.1.2 - - - - META-INF/VAADIN/config/flow-build-info.json - - - - - - - - - - production - - true - - - - com.vaadin - flow-server-production-mode - - - - - - - com.vaadin - vaadin-maven-plugin - - - - build-frontend - - - - - - - - - - integration-tests - - - - org.eclipse.jetty - jetty-maven-plugin - ${jetty.version} - - 0 - - jar - - ${project.artifactId} - 8081 - - - - start-jetty - pre-integration-test - - start - - - - stop-jetty - post-integration-test - - stop - - - - - - - com.lazerycode.selenium - driver-binary-downloader-maven-plugin - - 1.0.17 - - - true - - - ${drivers.dir}/driver - - - ${drivers.dir}/driver_zips - - - ${project.basedir}/drivers.xml - - - - - - selenium - - - - - - - org.apache.maven.plugins - maven-failsafe-plugin - 2.22.2 - - - - integration-test - verify - - - - - false - true - - - - ${webdriver.chrome.driver} - - - - - - maven-resources-plugin - 3.1.0 - - - - copy-test-to-classes - process-test-classes - - copy-resources - - - ${project.build.outputDirectory} - - - ${project.build.testOutputDirectory} - - - - - - - - - - - demo-jar - - - - org.apache.maven.plugins - maven-jar-plugin - - - - test-jar - - - demo - - **/test/* - **/integration/* - **/DemoView.class - **/DemoLayout.class - - - - - - - - - - - + + + 4.0.0 + + com.flowingcode.vaadin.addons + easy-form-addon + 1.0.0-SNAPSHOT + Easy Form Add-on + Easy Form Add-on for Vaadin Flow + https://www.flowingcode.com/en/open-source/ + + + 24.1.2 + 4.10.0 + 17 + 17 + UTF-8 + UTF-8 + ${project.basedir}/drivers + 11.0.12 + 3.8.0 + true + + + + Flowing Code + https://www.flowingcode.com + + + 2026 + + + Apache 2 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + https://github.com/FlowingCode/EasyFormAddon + scm:git:git://github.com/FlowingCode/EasyFormAddon.git + scm:git:ssh://git@github.com:/FlowingCode/EasyFormAddon.git + master + + + + + ossrh + https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + + + flowingcode + Flowing Code + https://www.flowingcode.com + + + + + + + com.vaadin + vaadin-bom + pom + import + ${vaadin.version} + + + com.flowingcode.vaadin.addons.demo + commons-demo + ${flowingcode.commons.demo.version} + + + + + + + central + https://repo.maven.apache.org/maven2 + + false + + + + Vaadin Directory + https://maven.vaadin.com/vaadin-addons + + + + Vaadin prereleases + https://maven.vaadin.com/vaadin-prereleases + + + + vaadin-snapshots + https://oss.sonatype.org/content/repositories/vaadin-snapshots/ + + + + + + central + https://repo.maven.apache.org/maven2 + + false + + + + + Vaadin prereleases + https://maven.vaadin.com/vaadin-prereleases + + + vaadin-snapshots + https://oss.sonatype.org/content/repositories/vaadin-snapshots/ + false + + + + + + com.vaadin + vaadin-core + true + + + org.slf4j + slf4j-simple + test + + + com.vaadin + vaadin-testbench + test + + + com.flowingcode.vaadin.addons.demo + commons-demo + test + + + org.hamcrest + hamcrest-library + 1.3 + test + + + javax.servlet + javax.servlet-api + 3.1.0 + jar + test + + + io.github.bonigarcia + webdrivermanager + 5.1.1 + test + + + + + jetty:run + + + + org.apache.maven.plugins + maven-release-plugin + 3.0.1 + + @{project.version} + + + + org.apache.maven.plugins + maven-deploy-plugin + 2.8.2 + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.1 + + false + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.1.2 + + + true + + false + true + + + 1 + + + + + + org.codehaus.mojo + license-maven-plugin + 1.14 + + apache_v2 + false + + + + org.apache.maven.plugins + maven-surefire-plugin + + false + + + + com.vaadin + vaadin-maven-plugin + ${vaadin.version} + + + + prepare-frontend + + + + + + org.eclipse.jetty + jetty-maven-plugin + ${jetty.version} + + 3 + + true + + + src/test/resources/META-INF/resources + src/main/resources/META-INF/resources + + + + jar + + + + + + + + + directory + + + + org.apache.maven.plugins + maven-source-plugin + 3.0.1 + + + attach-sources + package + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.0.1 + + + attach-javadocs + package + + jar + + + + + true + none + -Xdoclint:none + + + + org.apache.maven.plugins + maven-jar-plugin + 3.1.2 + + + + META-INF/VAADIN/config/flow-build-info.json + + + + + + + + + + production + + true + + + + com.vaadin + flow-server-production-mode + + + + + + + com.vaadin + vaadin-maven-plugin + + + + build-frontend + + + + + + + + + + integration-tests + + + + org.eclipse.jetty + jetty-maven-plugin + ${jetty.version} + + 0 + + jar + + ${project.artifactId} + 8081 + + + + start-jetty + pre-integration-test + + start + + + + stop-jetty + post-integration-test + + stop + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + 2.22.2 + + + + integration-test + verify + + + + + false + true + + + + ${webdriver.chrome.driver} + + + + + + maven-resources-plugin + 3.1.0 + + + + copy-test-to-classes + process-test-classes + + copy-resources + + + ${project.build.outputDirectory} + + + ${project.build.testOutputDirectory} + + + + + + + + + + + + gpg + + + env.gpg.passphrase + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.1.0 + + + sign-artifacts + verify + + sign + + + ${env.gpg.passphrase} + + + + + + + + + + demo-jar + + + + org.apache.maven.plugins + maven-jar-plugin + + + + test-jar + + + demo + + **/test/* + **/it/* + **/DemoView.class + **/DemoLayout.class + + + + + + + + + + + + diff --git a/src/main/java/com/flowingcode/vaadin/addons/easyform/EasyForm.java b/src/main/java/com/flowingcode/vaadin/addons/easyform/EasyFormAddon.java similarity index 90% rename from src/main/java/com/flowingcode/vaadin/addons/easyform/EasyForm.java rename to src/main/java/com/flowingcode/vaadin/addons/easyform/EasyFormAddon.java index 24ad1fb..78ebe24 100644 --- a/src/main/java/com/flowingcode/vaadin/addons/easyform/EasyForm.java +++ b/src/main/java/com/flowingcode/vaadin/addons/easyform/EasyFormAddon.java @@ -1,15 +1,15 @@ /*- * #%L - * Template Add-on + * Easy Form Add-on * %% - * Copyright (C) 2021 Flowing Code + * Copyright (C) 2023 Flowing Code * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -29,4 +29,4 @@ @NpmPackage(value = "@polymer/paper-input", version = "3.2.1") @JsModule("@polymer/paper-input/paper-input.js") @Tag("paper-input") -public class EasyForm extends Div {} +public class EasyFormAddon extends Div {} diff --git a/src/main/resources/META-INF/frontend/styles/static_addon_styles b/src/main/resources/META-INF/frontend/styles/static_addon_styles index 41fbf5e..c2a6ed1 100644 --- a/src/main/resources/META-INF/frontend/styles/static_addon_styles +++ b/src/main/resources/META-INF/frontend/styles/static_addon_styles @@ -1 +1 @@ -Place addon shareable styles in this folder \ No newline at end of file +Place add-on shareable styles in this folder \ No newline at end of file diff --git a/src/main/resources/META-INF/resources/static_addon_resources b/src/main/resources/META-INF/resources/static_addon_resources index 5afb98e..70832cc 100644 --- a/src/main/resources/META-INF/resources/static_addon_resources +++ b/src/main/resources/META-INF/resources/static_addon_resources @@ -1 +1 @@ -Place static addon resources in this folder \ No newline at end of file +Place static add-on resources in this folder \ No newline at end of file diff --git a/src/test/java/com/flowingcode/vaadin/addons/DemoLayout.java b/src/test/java/com/flowingcode/vaadin/addons/DemoLayout.java index 24f9fc0..8f80b19 100644 --- a/src/test/java/com/flowingcode/vaadin/addons/DemoLayout.java +++ b/src/test/java/com/flowingcode/vaadin/addons/DemoLayout.java @@ -1,15 +1,15 @@ /*- * #%L - * Template Add-on + * Easy Form Add-on * %% - * Copyright (C) 2021 Flowing Code + * Copyright (C) 2023 Flowing Code * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/src/test/java/com/flowingcode/vaadin/addons/easyform/DemoView.java b/src/test/java/com/flowingcode/vaadin/addons/easyform/DemoView.java index 291b913..74702e0 100644 --- a/src/test/java/com/flowingcode/vaadin/addons/easyform/DemoView.java +++ b/src/test/java/com/flowingcode/vaadin/addons/easyform/DemoView.java @@ -1,15 +1,15 @@ /*- * #%L - * Template Add-on + * Easy Form Add-on * %% - * Copyright (C) 2021 Flowing Code + * Copyright (C) 2023 Flowing Code * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -31,6 +31,6 @@ public class DemoView extends VerticalLayout implements BeforeEnterObserver { @Override public void beforeEnter(BeforeEnterEvent event) { - event.forwardTo(TemplateDemoView.class); + event.forwardTo(EasyFormDemoView.class); } } diff --git a/src/test/java/com/flowingcode/vaadin/addons/easyform/EasyFormDemo.java b/src/test/java/com/flowingcode/vaadin/addons/easyform/EasyFormDemo.java index 353b542..8508a09 100644 --- a/src/test/java/com/flowingcode/vaadin/addons/easyform/EasyFormDemo.java +++ b/src/test/java/com/flowingcode/vaadin/addons/easyform/EasyFormDemo.java @@ -1,11 +1,17 @@ package com.flowingcode.vaadin.addons.easyform; +import com.flowingcode.vaadin.addons.demo.DemoSource; import com.vaadin.flow.component.html.Div; +import com.vaadin.flow.router.PageTitle; +import com.vaadin.flow.router.Route; +@DemoSource +@PageTitle("Easy Form Add-on Demo") @SuppressWarnings("serial") +@Route(value = "demo", layout = EasyFormDemoView.class) public class EasyFormDemo extends Div { public EasyFormDemo() { - add(new EasyForm()); + add(new EasyFormAddon()); } } diff --git a/src/test/java/com/flowingcode/vaadin/addons/easyform/TemplateDemoView.java b/src/test/java/com/flowingcode/vaadin/addons/easyform/EasyFormDemoView.java similarity index 59% rename from src/test/java/com/flowingcode/vaadin/addons/easyform/TemplateDemoView.java rename to src/test/java/com/flowingcode/vaadin/addons/easyform/EasyFormDemoView.java index ea3821d..f6986c7 100644 --- a/src/test/java/com/flowingcode/vaadin/addons/easyform/TemplateDemoView.java +++ b/src/test/java/com/flowingcode/vaadin/addons/easyform/EasyFormDemoView.java @@ -1,8 +1,8 @@ /*- * #%L - * Template Add-on + * Easy Form Add-on * %% - * Copyright (C) 2021 Flowing Code + * Copyright (C) 2023 Flowing Code * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,19 +22,17 @@ import com.flowingcode.vaadin.addons.DemoLayout; import com.flowingcode.vaadin.addons.GithubLink; import com.flowingcode.vaadin.addons.demo.TabbedDemo; +import com.vaadin.flow.router.ParentLayout; import com.vaadin.flow.router.Route; @SuppressWarnings("serial") -@Route(value = "template", layout = DemoLayout.class) -@GithubLink("https://github.com/FlowingCode/AddonsStarter14") -public class TemplateDemoView extends TabbedDemo { +@ParentLayout(DemoLayout.class) +@Route("easy-form") +@GithubLink("https://github.com/FlowingCode/EasyFormAddon") +public class EasyFormDemoView extends TabbedDemo { - private static final String TEMPLATE_ADDON_DEMO = "Template Addon Demo"; - private static final String TEMPLATE_ADDON_SOURCE = - "https://github.com/FlowingCode/AddonStarter14/blob/master/src/test/java/com/flowingcode/vaadin/addons/template/TemplateDemo.java"; - - public TemplateDemoView() { - addDemo(new EasyFormDemo(), TEMPLATE_ADDON_DEMO, TEMPLATE_ADDON_SOURCE); + public EasyFormDemoView() { + addDemo(EasyFormDemo.class); setSizeFull(); } } diff --git a/src/test/java/com/flowingcode/vaadin/addons/easyform/it/AbstractViewTest.java b/src/test/java/com/flowingcode/vaadin/addons/easyform/it/AbstractViewTest.java index 4d9437e..cd6e8be 100644 --- a/src/test/java/com/flowingcode/vaadin/addons/easyform/it/AbstractViewTest.java +++ b/src/test/java/com/flowingcode/vaadin/addons/easyform/it/AbstractViewTest.java @@ -1,15 +1,15 @@ /*- * #%L - * Template Add-on + * Easy Form Add-on * %% - * Copyright (C) 2021 Flowing Code + * Copyright (C) 2023 Flowing Code * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/src/test/java/com/flowingcode/vaadin/addons/easyform/it/ViewIT.java b/src/test/java/com/flowingcode/vaadin/addons/easyform/it/ViewIT.java index 0dce83a..d81bd7a 100644 --- a/src/test/java/com/flowingcode/vaadin/addons/easyform/it/ViewIT.java +++ b/src/test/java/com/flowingcode/vaadin/addons/easyform/it/ViewIT.java @@ -1,15 +1,15 @@ /*- * #%L - * Template Add-on + * Easy Form Add-on * %% - * Copyright (C) 2021 Flowing Code + * Copyright (C) 2023 Flowing Code * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/src/test/java/com/flowingcode/vaadin/addons/easyform/test/LayoutTest.java b/src/test/java/com/flowingcode/vaadin/addons/easyform/test/LayoutTest.java deleted file mode 100644 index b4b0256..0000000 --- a/src/test/java/com/flowingcode/vaadin/addons/easyform/test/LayoutTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * #%L - * App Layout Addon - * %% - * Copyright (C) 2018 - 2020 Flowing Code - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ -package com.flowingcode.vaadin.addons.easyform.test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import com.flowingcode.vaadin.addons.DemoLayout; -import com.flowingcode.vaadin.addons.easyform.TemplateDemoView; -import com.vaadin.flow.router.Route; -import org.junit.Test; - -public class LayoutTest { - - @Test - public void testDemoLayout() { - Route route = TemplateDemoView.class.getAnnotation(Route.class); - assertEquals("com.flowingcode.vaadin.addons.DemoLayout", DemoLayout.class.getName()); - assertEquals(DemoLayout.class, route.layout()); - assertNotEquals("", route.value()); - } -} diff --git a/src/test/java/com/flowingcode/vaadin/addons/easyform/test/SerializationTest.java b/src/test/java/com/flowingcode/vaadin/addons/easyform/test/SerializationTest.java index b8283c9..b342a90 100644 --- a/src/test/java/com/flowingcode/vaadin/addons/easyform/test/SerializationTest.java +++ b/src/test/java/com/flowingcode/vaadin/addons/easyform/test/SerializationTest.java @@ -1,15 +1,15 @@ /*- * #%L - * Template Add-on + * Easy Form Add-on * %% - * Copyright (C) 2021 Flowing Code + * Copyright (C) 2023 Flowing Code * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,12 +19,12 @@ */ package com.flowingcode.vaadin.addons.easyform.test; +import com.flowingcode.vaadin.addons.easyform.EasyFormAddon; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; -import com.flowingcode.vaadin.addons.easyform.EasyForm; import org.junit.Assert; import org.junit.Test; @@ -44,7 +44,7 @@ private void testSerializationOf(Object obj) throws IOException, ClassNotFoundEx @Test public void testSerialization() throws ClassNotFoundException, IOException { try { - testSerializationOf(new EasyForm()); + testSerializationOf(new EasyFormAddon()); } catch (Exception e) { Assert.fail("Problem while testing serialization: " + e.getMessage()); }