vaadin

Get user’s IP address, and other client-side info in Vaadin 7 web app

馋奶兔 提交于 2020-02-23 09:42:28
问题 In Vaadin 7, how does one get the IP address of the user’s computer/device? Can I get other information about the client? 回答1: Vaadin WebBrowser The WebBrowser class in Vaadin 7 provides an easy way to access information about the client’s computing environment. Access a WebBrowser object via the current Page object. WebBrowser webBrowser = Page.getCurrent().getWebBrowser(); IP Address The getAddress method provides the apparent IP address of the client computer/device. String ipAddress =

How use dCharts Widget in a Vaadin project?

∥☆過路亽.° 提交于 2020-02-23 07:12:48
问题 I was looking for a 'free alternative to Vaadin Charts and found DCharts Widget, but I can not find guides or complete documentation to' use. Does anyone know how to import and use this widget? The guides to get started? Vaadin: 7.4 Apache Tomcat V8 JDK 1.8 回答1: To use dCharts i have execute this step: Download .jar or copy dependency for maven/ivy from: https://vaadin.com/directory#!addon/dcharts-widget Follow the instructions in this official page based on your installation method. (I have

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

Couldn't capture double click event using vaadin 7

て烟熏妆下的殇ゞ 提交于 2020-02-04 04:51:25
问题 I'm learning Vaadin framework. I'm trying to capture double click event for the item click listener. But it's not working as expected. Please refer the code below, grid.addItemClickListener(e -> { if(e.isDoubleClick()) { System.out.println("Double click"); } else { System.out.println("Single click"); } }); When I do double click on the grid item, it is only considered a single click. 回答1: As mentioned in Doubleclick listener on Vaadin Grid the problem is the setEditorEnabled(true) as this

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

Does detach() method call after attach() method?

微笑、不失礼 提交于 2020-01-25 03:49:39
问题 I have a simple UI class public class HelloWorldUI extends UI { @Override protected void init(VaadinRequest request) { System.out.println("Initialized !"); final VerticalLayout layout = new VerticalLayout(); layout.addComponent(new Label("Hello World !")); setContent(layout); } @Override public void detach() { System.out.println("Detach !"); super.detach(); } @Override public void attach() { System.out.println("Attach !"); super.attach(); } } When first time my UI was loaded , I see outputs

Multithreading refresh UI in Vaadin

混江龙づ霸主 提交于 2020-01-25 01:24:08
问题 I'm trying to implement a multithreading refresh UI in my Vaadin app. Part of this UI is a dChart based on container. To build dChart Im iterating through container and count elements by one of their properties, like this: Collection<?> itemIDS = container.getItemIds(); for (Object itemID : itemIDS) { Property property = container.getContainerProperty(itemID, "status"); String status = (String) property.getValue(); if (countMap.containsKey(status)) { countMap.put(status, countMap.get(status)

How to Print in Vaadin

巧了我就是萌 提交于 2020-01-24 22:00:32
问题 I have a VerticalLayout filled with components in Vaadin. PLease i will to print this layout exactly as it is to an A4 paper. Any Idea how to do this, Code Sample will be great. 回答1: Straight out of the Vaadin doc… Printing the Browser Window Vaadin does not have special support for launching the printing in browser, but you can easily use the JavaScript print() method that opens the print window of the browser. Button print = new Button("Print This Page"); print.addClickListener(new Button

How to play video in vaadin?

帅比萌擦擦* 提交于 2020-01-23 10:01:28
问题 I used both video component Video video = new Video(); and embedded Embedded embed = new Embedded("my video", new ExternalResource("yyy/xxx.mp4")); embed.setMimeType("application/x-shockwave-flash"); This plays quite well in iphone which uses safari browser, but in my pc am using mozilla firefox browser its not playing. It shows an like error in mime type. 回答1: Can you check this code from vaadin sampler : Embedded e = new Embedded(null, new ExternalResource( "http://www.youtube.com/v