vaadin7

How to close current browser tab?

安稳与你 提交于 2019-11-29 12:26:20
How do I close the current browser tab? The following aren't working. JavaScript.getCurrent().execute("window.close();"); or UI.getCurrent().removeWindow(window); or window.close(); Try this: Window appointmentWindow = getApplication().getWindow(NATIVE_WINDOW_NAME); if (appointmentWindow != null) { getApplication().removeWindow(appointmentWindow); } Source: https://vaadin.com/forum/#!/thread/235330 Iren Patel Try this. gBrowser.removeCurrentTab(); 来源: https://stackoverflow.com/questions/17759411/how-to-close-current-browser-tab

Using Thread with Vaadin?

99封情书 提交于 2019-11-29 10:50:49
I'm trying to use Thread in my project to send emails. When I click on a Button , a Thread is started and a ProgressBar is displayed. As soon as all mails are sent, the ProgressBar doesn't disappear. This is my code: Button btnSendMail = new Button("Mail"); btnSendMail.addClickListener(this); @Override public void buttonClick(ClickEvent event) { if(event.getButton() == btnSendMail){ sendMail(); } } } private void sendMail(){ List<String> list = new ArrayList<String>(); list.add("mymail@domain.com"); list.add("metoyou@domain.com"); list.add("thisismymail@domain.com"); new Thread(){ public void

Vaadin: get reference of UI to change data

半腔热情 提交于 2019-11-28 12:35:01
问题 I want to change data inside a Vaadin UI. The change is invoked by a a rest call. There, i somehow need a reference to the UI class to call its method´, e.g. changeValue(string value). I'm using vaadin-spring-boot-starter 1.0.0 Is that somehow possible? EDIT : Another question now: I was trying to do that Server Push, mentioned by @Eric, inside of a View, so that the view will get updated on a Broadcast message. However, this is not working (no exceptions, nothing to debug, just no updates in

Vaadin - Refresh grid after row modification

江枫思渺然 提交于 2019-11-28 07:31:08
问题 I create simple grid with data from database: BeanItemContainer<Customer> container = new BeanItemContainer<>(Customer.class, customerRepository.findAll()); Grid grid = new Grid(container); To edit each row the button was created: Button edit = new Button("Edit", clickEvent -> openWindow((Customer) grid.getSelectedRows().iterator().next())); This open new window with edit form. After all changes accepted, I must manually refresh whole page to see modification on Grid. My question is: How

Vaadin with JQuery FileUpload

雨燕双飞 提交于 2019-11-28 06:11:06
问题 I would like to create FileUploader with Vaadin . But I need to get more features over normal Vaadin Upload. beautiful and easy to manage (but optional) fast and never failed while uploading include progress bar show preview multi file upload support upload file size and type restriction drag and drop client-side image resizable (it is main feature for me because all of my uploaded files were images) There has an addon MultiFileUpload. Yes , it is perfect for most of my requirements but not

How to close current browser tab?

主宰稳场 提交于 2019-11-28 06:08:41
问题 How do I close the current browser tab? The following aren't working. JavaScript.getCurrent().execute("window.close();"); or UI.getCurrent().removeWindow(window); or window.close(); 回答1: Try this: Window appointmentWindow = getApplication().getWindow(NATIVE_WINDOW_NAME); if (appointmentWindow != null) { getApplication().removeWindow(appointmentWindow); } Source: https://vaadin.com/forum/#!/thread/235330 回答2: Try this. gBrowser.removeCurrentTab(); 来源: https://stackoverflow.com/questions

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

纵然是瞬间 提交于 2019-11-27 23:07:35
How do I access the current ServletContext from within my Vaadin 7 app? I want to use the ServletContext object’s setAttribute , getAttribute , removeAttribute , and getAttributeNames methods to manage some global state for my Vaadin app. Also, if using those methods for that purpose is inappropriate for Vaadin apps, please explain. Basil Bourque tl;dr For both Vaadin 7, 8 and 10: VaadinServlet.getCurrent().getServletContext() VaadinServlet The VaadinServlet class inherits a getServletContext method. To get the VaadinServlet object, call the static class method getCurrent . From most anywhere

Displaying Same Data Aross Multiple Clients Using Push in Vaadin 7 app

こ雲淡風輕ζ 提交于 2019-11-27 08:47:41
I want to share the same set of data to multiple clients. I need to use Push to automatically update their view on screen. I have read the Question and Answer, Minimal example of Push in Vaadin 7 app (“@Push”) . Now I need a more robust realistic example. For one thing, I know having a never-ending Thread is not a good idea in a Servlet environment. And I don't want each user having their own Thread, each hitting the database on their own. Seems more logical to have one thread alone checking for fresh data in the database. When found, that thread should publish the fresh data to all the users’

Minimal example of Push in Vaadin 7 app (“@Push”)

偶尔善良 提交于 2019-11-27 04:32:08
I want to see the most minimal example of using the new Push technology in Vaadin 7, such as the new @Push annotation. I am having problems getting server-push to work in my app. I would like to try a simple example app before trying to fix my own app. Basil Bourque Simplification Of Example In The Book Of Vaadin The Book Of Vaadin includes a chapter on Push, including an example using Vaadin Charts . Below is my code. While based on that Vaadin Charts example mentioned above, I simplified it by replacing the use of a Chart object with a simple Label object. The Label updates every second or

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

坚强是说给别人听的谎言 提交于 2019-11-26 21:19:30
问题 How do I access the current ServletContext from within my Vaadin 7 app? I want to use the ServletContext object’s setAttribute, getAttribute, removeAttribute, and getAttributeNames methods to manage some global state for my Vaadin app. Also, if using those methods for that purpose is inappropriate for Vaadin apps, please explain. 回答1: tl;dr For both Vaadin 7, 8 and 10: VaadinServlet.getCurrent().getServletContext() VaadinServlet The VaadinServlet class inherits a getServletContext method. To