vaadin8

Register session to User

本小妞迷上赌 提交于 2019-12-08 06:01:12
问题 I'm building a prototype using Vaadin8 starting from a single-module template. I'm trying to assign a unique UI instance (a session) to each authenticated user, so that each user is presented with a particular type of content according to their own settings within the app. Here's my configuration: @WebListener public class Market implements ServletContextListener { public static ArrayList<User>users; public void contextInitialized(ServletContextEvent sce) { users=new ArrayList<User>(); User

How to find the offset value of the Polygon from center on Openlayers

两盒软妹~` 提交于 2019-12-07 17:41:21
i calculated the (x1,Y1) and (x2,Y2) and calculated the difference between them (Blue line ) and gave those pixel values to driver to click but i am not able to click on the polygon (Point). 1.First the mouse will go to center of the map where (x1,y1)=(960,520) according to the window but the driver will consider those values as (0,0). 2. Now i need to calculate the offset values from center to each polygon on the map.(x1,y1)=(960,520) and (x2,y2)=(1000,232) the difference between the (x1,y1) and (x2,y2) will give me the distance of the point from center.for ex:(x3,y3) the code below try {

Vaadin Session Management - How does it work?

落爺英雄遲暮 提交于 2019-12-06 11:33:31
问题 At work, we develop a web application using Vaadin. I am a pretty advanced programmer in Java. I’m experienced with Vaadin as well. But now I've come to a point where information needs to be stored in a user session. Attributes like Locale, Username and so on. In the Vaadin Documentation they are talking about two different types of sessions but I dont really get the difference: VaadinServletService or VaadinPortletService described as low-level customization layer for processing requests.

Vaadin Session Management - How does it work?

守給你的承諾、 提交于 2019-12-04 17:06:46
At work, we develop a web application using Vaadin. I am a pretty advanced programmer in Java. I’m experienced with Vaadin as well. But now I've come to a point where information needs to be stored in a user session. Attributes like Locale, Username and so on. In the Vaadin Documentation they are talking about two different types of sessions but I dont really get the difference: VaadinServletService or VaadinPortletService described as low-level customization layer for processing requests. VaadinSession of a UI with getSession() as lower-level session objects. What is the difference and which

How to add a generated column to Vaadin 8 Grid?

跟風遠走 提交于 2019-12-04 05:47:10
Looks like GeneratedPropertyContainer does not exist in Vaadin 8. How can we add a generated column to Vaadin 8 Grid? I appreciate if you can provide an example. If you pass the bean class to the constructure of Grid then it will add all properties as columns to the grid. If you want to only have some properties as columns then don't pass the class to the constructor and add your columns manually like this: grid.addColumn(Address::getStreet); grid.addColumn(Address::getHouseNumber); grid.addColumn(Address::getPostalCode); grid.addCOlumn(Address::getCity); If you want to add a generated column

How to add Validators in Vaadin 8?

时光怂恿深爱的人放手 提交于 2019-12-04 00:38:04
问题 In Vaadin 7 there was an addValidator function, but in Vaadin 8 it does not exist. Vaadin 7 Example: TextField user = new TextField("User:"); user.setRequired(true); user.setInputPrompt("Your username"); user.addValidator(new NullValidator("Username can't be empty", false)); user.setInvalidAllowed(false); 回答1: I found the answer here: Whats New Example: new Binder<Person>().forField(tf) .withValidator(str -> str.length() == 4, "Must be 4 chars") .withConverter(new StringToIntegerConverter(

How to add grid filters in Vaadin 8?

醉酒当歌 提交于 2019-12-03 16:06:53
问题 Vaadin 8 just came out. the adding of filters in Grid was never in their documentation, i only found one working solution here in stackoverflow. HeaderCell cell = filterRow.getCell(pid); // Have an input field to use for filter TextField filterField = new TextField(); filterField.setColumns(0); filterField.setHeight("23"); // Update filter When the filter input is changed filterField.addTextChangeListener(change -> { // Can't modify filters so need to replace b.removeContainerFilters(pid); //

How to check all checkboxes usingheader checkbox in vaadin

自闭症网瘾萝莉.ら 提交于 2019-12-02 08:59:50
Ia m new to vVadin. I created one project with grid with two columns but i want to add one Textfield column and one checkbox column and check all checkboxes when click on header checkbox. List<Person> people = Arrays.asList( new Person("Nicolaus Copernicus", 15), new Person("Galileo Galilei", 15), new Person("Johannes Kepler", 15)); TextField txt =new TextField(); CheckBox chk=new CheckBox(); // Create a grid bound to the list Grid<Person> grid = new Grid<>(); grid.setItems(people); grid.addColumn(Person::getName).setCaption("Name"); grid.addColumn(Person::getAge).setCaption("Year of birth");

Implement a column renderer for Vaadin 8 Grid

社会主义新天地 提交于 2019-12-01 05:40:22
问题 The Vaadin Framework guide has a page describing how to use Column Renderers in a Vaadin Grid. And this page describes implementing renderers, but all too briefly. I want to implement a InstantRenderer to complement the partial set of java.time renderers added in Vaadin 8.1. Renderers were added for LocalDate & LocalDateTime but not for Instant , OffsetDateTime , and ZonedDateTime . For my Instant renderer I am currently simply applying the current default time zone ( ZoneId ) to get a

Vaadin 8 : reload grid with data from server every 1min

删除回忆录丶 提交于 2019-12-01 00:04:59
I am trying to have a auto refresh feature for the grid which basically, updates the grid with latest data from the server every 'n' seconds. I was able to implement the PollListner whenever the user enables Auto-Refresh. UI ui= TestUI.getCurrent(); Boolean value = isRefreshChkBox.getValue(); PollListener listener = e -> { explorer.reloadUI(); }; if (value) { String refreshRateValue = refreshRateTxtField.getValue(); int refreshRate = Integer.valueOf(refreshRateValue); int millis = (int) TimeUnit.SECONDS.toMillis(refreshRate); absUI.setPollInterval(millis); absUI.addPollListener(listener); }