vaadin

Make an OptionGroup (radio buttons) from an enum in Vaadin 7?

柔情痞子 提交于 2019-12-11 00:11:54
问题 I have a Java enum with a getter for the desired display text. How can I use this to populate an OptionGroup in Vaadin 7? 回答1: Here are three ways to do this in Vaadin 7: A class I built, EnumBackedOptionGroup . A subclass of OptionGroup in Vaadin 7. Roll-your-own the short sweet way. Roll-your-own the more flexible way. Subclass of OptionGroup Here is the source code of a new subclass of OptionGroup I wrote. package com.basilbourque; import com.vaadin.ui.OptionGroup; import java.util.Arrays;

Hashtable getting null for existing key

安稳与你 提交于 2019-12-11 00:07:15
问题 I have a very strange error in this code from Vaadin's ContainerHierarchicalWrapper: for (Object object : children.keySet()) { LinkedList<Object> object2 = children.get(object); } The debugger shows this state: How is that even possible? How can object2 be null ? This is my actual code which causes the NPE (class EstablishRelationWindow ): childrenContainer = new BeanItemContainer<>(PlaylistDTO.class); childrenContainerHierarchy = new ContainerHierarchicalWrapper(childrenContainer);

Get sibling of Vaadin Tree Item?

痴心易碎 提交于 2019-12-10 23:14:31
问题 I need to get the siblings of a particular Item in a Vaadin Tree. I can do this: Object itemId = event.getItemId(); Object parentId = tree.getParent( itemId ); Collection siblings = tree.getChildren( parentId ); BUT there is a problem when the itemId is one of the roots, for instance: item1 childen1.1 children1.2 item2 item3 When I want siblings of item1 . Any help? 回答1: When an item has no parent (aka tree.getParent(itemId) == null ) then it's a root, so its siblings are the other root items

Changing application locale makes changes to all users (Vaadin)

六眼飞鱼酱① 提交于 2019-12-10 23:06:19
问题 In my application I set up the locale when the user get into the system to localize the components. Recently I was giving a demo and noticed that the language was switching from English to Dutch without apparent reason. It turned out that the demo server (hosted in a German server) was being accessed at the same time by another person that set it to Dutch and was affecting my English demo and viceversa. I gave it a try on my machine with different browsers, using Chrome normal and incognito

Vaadin Upload File Path from Testing using Selenium

落爺英雄遲暮 提交于 2019-12-10 22:40:56
问题 Any reason why this wont set the file path for the Vaadin Upload Component in selenium. The file path remains unset and when the click happens it trys to upload null. The file does exist in my local directory. $(UploadElement.class).first().findElement(By.className("gwt-FileUpload")).sendKeys("/tmp/test.xlsx"); $(UploadElement.class).first().findElement(By.className("v-button")).click(); 回答1: This got it working getDriver().findElement(By.xpath("//input[@type='file']")).sendKeys("/tmp/test

How to close a vaadin session but keep http session when browser closed?

风格不统一 提交于 2019-12-10 20:03:38
问题 I'm developing a vaadin 7 application with user authentication and authorization using jaas with a realm defined in the application server (glassfish). I have this requirements: A user can stay logged in for some time, so that he doesn't need to enter his password every time. I do this by setting the session timeout of the http session. The vaadin session can lock some resources and while locked, no other session can use this resource. All locked resources are released when the vaadin session

Validation icon not shown in Table fields

痞子三分冷 提交于 2019-12-10 19:49:07
问题 When I enter edit mode of my Table, I want the data validation exclamation mark icon (!) to be shown as soon as the user goes out of bounds of any of the validation constraints. First, a couple of notes: I'm using Vaadin 7, so the Bean Validation addon sadly won't work. The data validation works as intended. Now, I have a perfectly working table for which I am using a BeanItemContainer to keep my Person beans inside. The code for the table and the TableFieldFactory looks something like this:

How do I use CSS to style my form components?

拜拜、爱过 提交于 2019-12-10 19:32:35
问题 How does Vaadin use CSS that was written purely for HTML elements (e.g. styling and layout of body, h1, etc elements) and use that exact CSS style in Vaadin? Does one need to make changes on the CSS to map to corresponding Vaadin elements, or can one use that CSS as is? 回答1: You can use the CSS as is, but you'll (naturally) have to tell Vaadin which CSS classes to use by calling myComponent.setStyleName("myStyleClass"); or myComponent.addStyleName("myStyleClass"); The difference between the

REST request blocked when executed in an `@SpringBootTest` but not when I run the application?

自古美人都是妖i 提交于 2019-12-10 18:39:45
问题 I have a Spring Boot application with a Jersey REST api at /rest : @Component @ApplicationPath("/rest") public class RestApplication extends ResourceConfig { public RestApplication(){ packages("ch.cypherk.myapp.service.rest"); } } this here is the controller that should allow a user to log in: @Service @Path("/login") class LoginRestController @Inject constructor( private val authenticationService: MyAuthenticationProvider ) { @Operation(summary = "Login user, use cookie JSESSIONID in

How to implement MVP using Vaadin CDI and Navigator?

十年热恋 提交于 2019-12-10 18:35:00
问题 I would like to implement the MVP pattern in my web application using Vaadin. I am using the Vaadin Navigator and the CDIViewProvider, something like so: //MyUI.java public class MyUI extends UI { @Inject CDIViewProvider viewProvider; Navigator navigator; @Override protected void init(VaadinRequest vaadinRequest) { //UI setup navigator = new Navigator(this, someContainer); navigator.addProvider(viewProvider); getNavigator().navigateTo("myView"); } } //MyViewImpl.java @CDIView("myView") public