vaadin-flow

Where to put data or config files loaded by my Java code when web app launches in a Vaadin 14 web app driven by Maven

爷,独闯天下 提交于 2020-02-15 10:07:24
问题 In a Vaadin 14 web app project created by the "Plain Java Servlet" flavor of the Vaadin Starter page, there are numerous folders automatically created by the Maven POM file process. Where is the place to put a data file or configuration file that I will load and parse when my web app launches? Under what folder do I put my files? Should I create further nested folders? And by what file path name do I find and load such a text (XML, JSON, CSV, etc.) file? 回答1: Location of file You put them in

Where to put data or config files loaded by my Java code when web app launches in a Vaadin 14 web app driven by Maven

大憨熊 提交于 2020-02-15 10:03:12
问题 In a Vaadin 14 web app project created by the "Plain Java Servlet" flavor of the Vaadin Starter page, there are numerous folders automatically created by the Maven POM file process. Where is the place to put a data file or configuration file that I will load and parse when my web app launches? Under what folder do I put my files? Should I create further nested folders? And by what file path name do I find and load such a text (XML, JSON, CSV, etc.) file? 回答1: Location of file You put them in

How to correctly specify dialog size in vaadin-flow

為{幸葍}努か 提交于 2020-01-25 10:06:08
问题 Trying to open a dialog from a grid renderer which contain a button. The problem is that the dialog isn't respecting the specified size. I've tried setting the width and height of the dialog but it doesn't affect the DOM element only its childs (which doesn't look as expected) @Override public VerticalLayout createComponent(P item) { // this simply create a VerticalLayout VerticalLayout layout = super.createComponent(item); HorizontalLayout subLayout = new HorizontalLayout(); subLayout

How to access `ServletContext` from within a Vaadin 14 app?

白昼怎懂夜的黑 提交于 2020-01-16 13:05:26
问题 I am asking the same as the Question, How to access ServletContext from within a Vaadin 7 app?, but for Vaadin 14. In Vaadin 7, Vaadin provided the simple and handy call: ServletContext servletContext = VaadinServlet.getCurrent().getServletContext(); That particular call is no longer there on VaadinServlet in Vaadin 14. ➥ Is there an equivalent somewhere else in the Vaadin API? My end goal is to use the key-value "attribute" collection to keep references to my app-wide objects. 回答1: Methods

How to access `ServletContext` from within a Vaadin 14 app?

放肆的年华 提交于 2020-01-16 13:05:23
问题 I am asking the same as the Question, How to access ServletContext from within a Vaadin 7 app?, but for Vaadin 14. In Vaadin 7, Vaadin provided the simple and handy call: ServletContext servletContext = VaadinServlet.getCurrent().getServletContext(); That particular call is no longer there on VaadinServlet in Vaadin 14. ➥ Is there an equivalent somewhere else in the Vaadin API? My end goal is to use the key-value "attribute" collection to keep references to my app-wide objects. 回答1: Methods

Where should I place my Vaadin 10+ static files?

旧城冷巷雨未停 提交于 2020-01-11 19:55:14
问题 In Vaadin 10-14, where should I place my static files, such as CSS, JavaScript, and Polymer templates? How about static files such as images? Also, how do I import these files in Vaadin? Is there a difference between Vaadin 14 with npm and Vaadin 10-13 with bower? 回答1: All paths are relative to the project root, e.g. where the pom.xml file is located in a Maven project. JavaScript imported using @JsModule uses strict mode. Among other things, this means that global variables must be defined

How can I see details to grid in Vaadin flow?

穿精又带淫゛_ 提交于 2020-01-06 08:00:29
问题 In my Vaadin flow project, I have a grid and I set some items but it shows like grid data items I want a decent format that a user can see specific details not like. Any idea or is there any component in vaadin to make this pretty? 回答1: There are two options to do that: provide a better ValueProvider than the .toString() , that is used in your property right now. E.g. grid.addColumn(person -> Integer.toString(person.getYearOfBirth())) .setHeader("Year of birth"); TemplateRenderer : You can

Uploading contents of a text file to a string in memory using the “Upload” widget in Vaadin 14

与世无争的帅哥 提交于 2020-01-06 02:46:05
问题 I know Vaadin 14 offers the Upload component for the user to either pick a file(s) to upload or to drag-and-drop file(s). But I am not sure how to use it. I want the contents of a plain text file on the web browser’s machine to load into memory as a String or CharSequence on the server machine. While the description page for that component has some examples, I could use a complete yet minimal example of loading plain text. 回答1: Here is an example view in Vaadin 14.1.0.alpha3. I am not an

After importing a Maven project into IntelliJ 2019.3, the bundled classes are not on class path

自作多情 提交于 2020-01-05 08:29:08
问题 After importing a newly created Vaadin 14.0.x project, and using the Import Project feature to create a Maven-driven project in IntelliJ 2019.3 EAP, I get a message saying "Cannot resolving symbol". The error message offers me a button to "Add library … to classpath". But the necessary libraries are already loaded by Maven as dependencies. So this makes no sense. I retried the import 3 times. On each effort I opened another project to run the File > Invalidate Caches / Restart menu item. This

Vaadin checkbox is not correctly rendered

谁都会走 提交于 2020-01-03 03:36:33
问题 Using Vaadin 14.0.13 without compatibility mode. I use a view to create a Dialog with dynamic content: @Route("") public class MainView extends VerticalLayout { public MainView(DialogContentProvider contentProvider) { this.add(new Button("Click me!", event -> new Dialog(contentProvider.create()).open())); } } The contentProvider is an interface public interface DialogContentProvider { Component create(); } with this implementation: public class CheckBoxContentProvider implements