vaadin

Need locking when call VaadinSession getAttribute in Vaadin 7

痞子三分冷 提交于 2019-12-07 15:54:03
问题 I know that it is necessary when call setAttribute (link), but what about getAttirbute? Is this correct? public Object getMyAttribute() { return VaadinSession.getCurrent().getAttribute("myAttribute"); } Or need locking? public Object getMyAttribute() { try { VaadinSession.getCurrent().getLockInstance().lock(); return VaadinSession.getCurrent().getAttribute("myAttribute"); } finally { VaadinSession.getCurrent().getLockInstance().unlock(); } } 回答1: Adding to the answer by Patton. While I'm not

Restricting file types upload component

╄→гoц情女王★ 提交于 2019-12-07 13:33:24
问题 I'm using the upload component of vaadin(7.1.9), now my trouble is that I'm not able to restrict what kind of files that can be sent with the upload component to the server, but I haven't found any API for that purpose. The only way is that of discarding file of wrong types after the upload. public OutputStream receiveUpload(String filename, String mimeType) { if(!checkIfAValidType(filename)){ upload.interruptUpload(); } return out; } Is this a correct way? 回答1: No, its not the correct way.

Right-align column contents in Vaadin Grid?

独自空忆成欢 提交于 2019-12-07 12:33:46
问题 In the new Vaadin Grid widget (alternative to venerable Table), how does one right-align numbers or other content in a column? 回答1: The simplest way I can think of is to define your own CSS classes and style generator, pretty much similar to what I'd had done when working with tables. @Theme("mytheme") @Widgetset("com.matritza.MyAppWidgetset") public class MyUI extends UI { @WebServlet(urlPatterns = "/*", name = "MyUIServlet", asyncSupported = true) @VaadinServletConfiguration(ui = MyUI.class

How to integrate “old spring mvc controllers with jsp” and “vaadin7 ui” together

…衆ロ難τιáo~ 提交于 2019-12-07 10:25:16
问题 I am trying to integrate vaadin with my spring mvc application. I have a some url with jsp files that spring mvc controller use them For example : mysite.com/spring/ mysite.com/spring/examples mysite.com/spring/examples/1.jsp I want to add vaadin in this path: mysite.com/vaadin/MainUI here is my web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app id="WebApp_ID" version="3.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=

How to add static resources to vaadin

家住魔仙堡 提交于 2019-12-07 07:50:42
I am running a vaadin application and have some css files that reference images using "url()" syntax. The images however are not available and on the server side you get the error: rejecting published file request for file that has not been published I have tried putting them nearly everywhere (WEB-INF, WEB-INF/classes, VAADIN, VAADIN/themes/.., etc) but they remain unaccessible. How can I add static images to my vaadin application so they can be accessed by css? UPDATE Note that the images need to be accessible by css in the form of: .myCssClass { background: url(path/to/image.png); } You

Vaadin combobox

怎甘沉沦 提交于 2019-12-07 07:41:46
问题 I want to create Vaadin drop down with 2 separators in it. I couldn't find a way to implement that, can anyone help me to solve this issue? This is the way I want to display my drop down: Option 1 Option 2 ------------; select 1 select 2 -----------; group 1 How can I do that? 回答1: There is no built-in way to add separators to selects. The only way I can think of is to add an item with the desired separator as its caption. For example if you use the default caption (item id) select.addItem("-

How to use HTML template with Vaadin?

谁说我不能喝 提交于 2019-12-07 04:56:14
问题 I am new to Vaadin. I have created template for my web application in HTML and JS. How to use the developed template with Vaadin as am not sure if I will be able to develop same template using Vaadin only? 回答1: It may be possible to re-use some of the layout of the template using the CustomLayout layout component in Vaadin. You can also render the contents of a template into a Label component, and display the label in the application. See http://demo.vaadin.com/sampler#LabelRich for a small

(转)Vaadin 使用 Maven

僤鯓⒐⒋嵵緔 提交于 2019-12-07 03:39:18
Introduction - Scope and Purpose # This article will show you how to use Maven2 to manage your dependencies, build your Vaadin web application, and build your custom widgetset. It is assumed that the reader is already familiar with Maven2, and that Maven2 is already installed and properly configured on the system. For specific information about Maven2, please refer to the official web site . This page first introduces how to create a new Vaadin project with Maven2 archetypes and how to use it. Then, steps for modifying existing Maven2 projects to use Vaadin (version 6.2 or later) are given.

How to add search icon in Vaadin ComboBox?

落花浮王杯 提交于 2019-12-07 03:24:05
问题 I have a ComboBox that allows selection of the given items, and an icon that accepts the selection: the functionality is all fine. I'm looking for the effect to get the search icon into the comboBox. like in Vaadin Icons: How is this done? I tried comboBox.setIcon(new ThemeResource("search.png")); it didn't do any change. backend developer here - not good on front-end tools. //========================================== EDIT: one thing i can think of is to make the border of ComboBox disappear

Vaadin + Spring Boot errors: “Cannot enhance @Configuration” and “More than one Servlet Mapping defined”

只愿长相守 提交于 2019-12-07 01:52:38
问题 I'm new to Spring and Vaadin. I'm trying to go through tutorial for views navigation. I'd like to enable @Push in future to update views periodically with data fetched from DB. The project is very, very simple. I use no configuration class nor any XML - only Java annotations. Could anyone help me to fix the example code? Because I'm getting following warnings and I'm not sure what can be done with it and what will be the result of ignoring them. First one is: onClassPostProcessor : Cannot