vaadin

Simple example of filtering items in a grid in Vaadin Flow 14

时间秒杀一切 提交于 2020-03-02 07:09:16
问题 I want to suppress the display of some items in a Grid widget in Vaadin Flow 14. For example, if the user enters a year in a IntegerField widget, I want the grid to show only items with an associated date before that year. Items with a date on or after that date should disappear. If the user changes the year number, the filtering should be re-applied with fewer or more items displayed appropriately in the grid. I have seen filters on Grid discussed but cannot wrap my head around the various

Engage “Lumo compact mode” in Vaadin 13 and later, for smaller size layouts

瘦欲@ 提交于 2020-03-01 10:04:32
问题 The release notes for Vaadin 13 includes an item for Lumo compact mode. The mention there is brief, lacking details. To quote: The compact theme/preset defines values for the sizing and spacing properties to reduce the visual space required by components to better fit a large amount of content on the screen. It’s a Lumo-only feature and can be enabled by importing the preset file to the application. How do I turn on this compact mode in my Vaadin 14 web app? 回答1: Add two annotations:

Engage “Lumo compact mode” in Vaadin 13 and later, for smaller size layouts

南笙酒味 提交于 2020-03-01 10:04:22
问题 The release notes for Vaadin 13 includes an item for Lumo compact mode. The mention there is brief, lacking details. To quote: The compact theme/preset defines values for the sizing and spacing properties to reduce the visual space required by components to better fit a large amount of content on the screen. It’s a Lumo-only feature and can be enabled by importing the preset file to the application. How do I turn on this compact mode in my Vaadin 14 web app? 回答1: Add two annotations:

Set width of “Dialog” widget to a percentage of the page in Vaadin 14

佐手、 提交于 2020-02-25 22:35:29
问题 In Vaadin 14, the Dialog widget opens properly when specifying width and height by px (CSS virtual "pixels"). Dialog dialog = new Dialog(); dialog.setCloseOnEsc( true ); dialog.setCloseOnOutsideClick( true ); dialog.add( new Label( "whatever" ) ); dialog.setWidth( "500px" ); // 🡸 width dialog.setHeight( "700px" ); // 🡸 height Unfortunately, changing that 500px to 80% : dialog.setWidth( "80%" ); // 🡸 width as percentage (%) dialog.setHeight( "700px" ); // 🡸 height I expect the dialog to now

Get the IP address of the user’s web browser via Java on the server-side in a Vaadin 14 app

爱⌒轻易说出口 提交于 2020-02-25 02:27:07
问题 In Vaadin Flow, such as version 14.1, how can I get the IP address of the user’s web browser through a Java call on the server-side? Like the Question, Get user’s IP address, and other client-side info in Vaadin 7 web app, but for Vaadin Flow instead of Vaadin 7 & 8. 回答1: WebBrowser::getAddress In Vaadin Flow, use the class WebBrowser::getAddress to get the user's IP address. To get a WebBrowser object, ask the current VaadinSession object. String ipAddress = VaadinSession.getCurrent()

{Java} Vaadin 14 - Detect user leave (closes tab, f5, etc)

扶醉桌前 提交于 2020-02-24 12:14:23
问题 I'm currently using Vaadin Flow version 14 (https://github.com/vaadin/platform/releases/tag/14.0.0) I run Java version 1.8.0_231, 64 bit. I simply want to be able to detect (in java!) whenever a user does either of these actions: Closes the current browser tab (or their browser) Clicks F5 on their keyboard, or pressed the Refresh button in their browser Clicks a link (or anything else), which redirects them away from my website I've tried lots of different things to detect this. The only

{Java} Vaadin 14 - Detect user leave (closes tab, f5, etc)

烈酒焚心 提交于 2020-02-24 12:14:07
问题 I'm currently using Vaadin Flow version 14 (https://github.com/vaadin/platform/releases/tag/14.0.0) I run Java version 1.8.0_231, 64 bit. I simply want to be able to detect (in java!) whenever a user does either of these actions: Closes the current browser tab (or their browser) Clicks F5 on their keyboard, or pressed the Refresh button in their browser Clicks a link (or anything else), which redirects them away from my website I've tried lots of different things to detect this. The only

Vaadin Grid : How to use bean with LocalTime field in line-based editor?

前提是你 提交于 2020-02-24 10:09:06
问题 When I try to use a line-based editor (setEditorEnabled(true), Buffered Mode), I get an error: Caused by: com.vaadin.data.util.converter.Converter$ConversionException: Unable to convert value of type java.time.LocalTime to presentation type class java.lang.String. No converter is set and the types are not compatible. at com.vaadin.data.util.converter.ConverterUtil.convertFromModel(ConverterUtil.java:116) ~[vaadin-server-7.6.8.jar:7.6.8] Grid initialization: BeanItemContainer<MealTo> container

Vaadin Grid : How to use bean with LocalTime field in line-based editor?

流过昼夜 提交于 2020-02-24 10:04:08
问题 When I try to use a line-based editor (setEditorEnabled(true), Buffered Mode), I get an error: Caused by: com.vaadin.data.util.converter.Converter$ConversionException: Unable to convert value of type java.time.LocalTime to presentation type class java.lang.String. No converter is set and the types are not compatible. at com.vaadin.data.util.converter.ConverterUtil.convertFromModel(ConverterUtil.java:116) ~[vaadin-server-7.6.8.jar:7.6.8] Grid initialization: BeanItemContainer<MealTo> container

Vaadin onbeforeunload event

左心房为你撑大大i 提交于 2020-02-24 05:53:26
问题 Is there any Out Of the Box Vaadin 10 (and higher) event similar to window.onbeforeunload in JavaScript? I've tried to use onDetach() or beforeLeave(), but it only works inside UI, and when user reloads the page or closes the page it's not working. 回答1: You can use the approach described in https://vaadin.com/forum/thread/17523194/unsaved-changes-detect-page-exit-or-reload that was already suggested in a comment. At the same time, I'd urge you to be really careful with beforeunload events