Vaadin Flow: How to use Select from Java - vaadin

the Vaadin documentation states that it has support for a compontent called Select using Java.
How do you access it?
I cant find any corresponding class.
Not even its install section mentions it.

You should add the following dependency to your pom.xml:
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-select-flow</artifactId>
<version>1.0.0</version>
</dependency>

Related

Vaadin 23.2.5 and flow-server

Vaadin recently updated to Vaadin 23.2.5 but I can't find the corresponding flow-server dependency of the same version:
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>flow-server</artifactId>
<version>23.2.5</version>
</dependency>
So my question is - is this a good idea to use new Vaadin 23.2.5 with flow-server 23.2.4 dependency? I need this dependency for one of my backend module for com.vaadin.flow.shared.Registration; and com.vaadin.flow.component.UIDetachedException
Use the Vaadin BOM in your Dependency Management to always get matching and tested combination of artefacts provided by Vaadin - for example flow-server or components.
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-bom</artifactId>
<version>VERSION</version>
<type>pom</type>
</dependency>

New Vaadin app when run says my app is using components which are part of a Vaadin subscription

I downloaded a Java-based starter app for Vaadin 14.0.11 from the Start a new project with Vaadin page.
When I run my app, and use a browser to connect to http://localhost:8080/ I get this message displayed as a pink overlay above my app content (the "Download" H1 title):
This application is using components which are part of a Vaadin subscription.
Click here to get a trial or validate your subscription
Screenshot:
I am confused. I thought Vaadin Flow is an open-source project available free-of-cost? I do not want a subscription at this time.
tl;dr
In your project POM, change this:
<artifactId>vaadin</artifactId>
…to this, adding -core:
<artifactId>vaadin-core</artifactId>
Yes, open-source & free-of-cost
Yes, Vaadin is indeed an open-source project. Yes, you can build web apps free-of-cost.
A panoply of high-quality widgets are bundled for you to use free-of-cost. This bundled collection of components may be all you need to build your web app. Browse this catalog of bundled widgets where the items without the yellow "Commercial" label are free-of-cost.
In addition, there are hundreds of add-ons available, many free-of-cost, listed on the Vaadin Directory site.
Casting a wider net, you can likely adapt most any Web Components based widget from third parties to work within Vaadin, if you so desire. Many such widgets are available free-of-cost. For more info, see the Creating Components section of the Vaadin manual.
Commercial products available, but not required
The Vaadin Ltd company sells some additional products with special functionality, as well as selling consulting and training services. Those commercial products are clearly labeled in the catalog mentioned above. For example, Vaadin comes bundled with free-of-cost widgets for single-line & multi-line text entry, while they sell commercially a rich text editor. This is called open core business model. With this business model Vaadin Ltd can sustain development and maintenance of the free open source offering. So it is win-win both for those who use free and commercial offering.
To avoid the commercial products
You can very easily configure your new Vaadin project to avoid any possible use of the commercial widgets. As your only take-away from this page, just remember the word "core". Search your project’s POM for that word core. You will find a comment saying:
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<!-- Replace artifactId with vaadin-core to use only free components -->
<artifactId>vaadin</artifactId>
…
➥ Simply change that value on the artifactId element from vaadin to vaadin-core.
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<!-- Replace artifactId with vaadin-core to use only free components -->
<artifactId>vaadin-core</artifactId>
…
I suggest doing a Maven clean and install. When you run your project, you should no longer see that pink message.
If you ever wish to try the commercial widgets, change that element back, removing the -core part, and follow the terms of their licensing.

Get Vaadin Version in flow

In Vaadin 8, I was able to retrieve version information with
com.vaadin.shared.Version.getFullVersion()
In Vaadin Flow I cannot find a way to get the current version, at least not the one that I expected. I have found this one
com.vaadin.flow.server.Version.getFullVersion()
but the return value is 1.2.2 and not the expected 12.0.0. I guess it is the server version or something..
How do I get the used version of vaadin framework correctly in vaadin flow?
One possible approach to get the Vaadin version is to use
VaadinCoreShrinkWrap.class.getAnnotation(NpmPackage.class).version()
Not optimal, but it should work.
This approach works starting from Vaadin 14. It will cause errors with older versions.
Starting from 10, a Vaadin version doesn't have any content of its own, not even a version number marker. It's only a set of dependency versions that have been tested to work well together.
com.vaadin.flow.server.Version.getFullVersion() gives the version of the Vaadin Flow dependency. This is in most cases a more relevant version number to look at for technical purposes.
Vaadin 10 and Vaadin 11 used Flow 1.0.x, whereas Vaadin 12 uses version 1.2.x. Vaadin 13 will most likely use Flow version 1.3.x or 2.0.x, depending on how big changes will be included by then.
If you want to show Vaadin version and not Flow version I see one option to make it happen but it requires more code and some maven configuration.
You should
Create a properties file including the line vaadin.version=${vaadin.version}
Make sure the file is included in resources that maven-resources-plugin filter with something like the following in you build config:
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/config.properties</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<excludes>
<exclude>**/config.properties</exclude>
</excludes>
</resource>
</resources>
Read properties file and get value for version property
Properties properties = new Properties();
properties.load(MainView.class.getResourceAsStream("config.properties"));
properties.get("vaadin.version");

Is it possible to use Neo4j as a library?

I'm working on a Java game project that would benefit a lot from the graph traversal algorithms and query languages included in Neo4j. Unfortunately, querying a server takes too much time and I would like to know if it's possible to use Neo4J as a library, with queries happening in-memory?
You can embed Neo4j in Java applications. Take a look in the docs. If you are working in a Maven project, you can add Neo4j as a Maven dependency:
<project>
...
<dependencies>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j</artifactId>
<version>3.3.2</version>
</dependency>
...
</dependencies>
...
</project>
Also, there is an ImpermanentDataBase developed for unit test purposes.

How to execute Maven plugins dynamically?

I am using maven-remote-resources-plugin, which retrieves the remote resources (such as css file) from another project to a specific directory in the current project. Since I am developing the css files, I would really like to see the changes in runtime with a simple reload-page click on the browser, instead of recompiling and rebuilding the maven project.
My first thought is to remove the build tags wrapping around the plugins, which didn't work.
<build>
<plugins>
<plugin>
<artifactId>maven-remote-resources-plugin</artifactId>
How can I achieve this? First post -- thanks very much to all so-ers!

Resources