Skip to content
This repository has been archived by the owner on Oct 8, 2020. It is now read-only.

vaadin/vaadin-custom-field-flow

Repository files navigation

⚠️ This repository is deprecated

Vaadin CustomField for Flow

Vaadin CustomField for Flow is a UI component add-on for Vaadin. It is a field whose UI content can be constructed by the user, enabling the creation of e.g. form fields by composing Vaadin components. Customization of both the visual presentation and the logic of the field is possible.

License & Author

Apache License 2.0

Vaadin CustomField is written by Vaadin Ltd.

Installing

Add CustomField to your project

<dependencies>
  <dependency>
    <groupId>com.vaadin</groupId>
    <artifactId>vaadin-custom-field-flow</artifactId>
    <version>${vaadin.customfield.version}</version>
  </dependency>
</dependencies>

Using Vaadin CustomField

Screenshot of vaadin-custom-field

Basic use

    public class SingleElementWrapping extends CustomField<String> {
        private final TextField wrappedField = new TextField();

        SingleElementWrapping() {
            setLabel("Name");
            add(wrappedField);
        }

        @Override
        protected String generateModelValue() {
            return wrappedField.getValue();
        }

        @Override
        protected void setPresentationValue(String newPresentationValue) {
            wrappedField.setValue(newPresentationValue);
        }
    }

Setting up for development

Clone the project in GitHub (or fork it if you plan on contributing)

git clone git@github.com:vaadin/vaadin-custom-field-flow.git

To build and install the project into the local repository run

mvn install -DskipITs

in the root directory. -DskipITs will skip the integration tests, which require a TestBench license. If you want to run all tests as part of the build, run

mvn install

To compile and run demos locally execute

mvn compile
mvn -pl vaadin-custom-field-flow-demo -Pwar jetty:run