Skip to content

Instantly share code, notes, and snippets.

View mstahv's full-sized avatar

Matti Tahvonen mstahv

View GitHub Profile
@mstahv
mstahv / MyUI.java
Last active October 1, 2015 18:34
Example to make text war in a Vaadin Table
package org.bluemix.mavenproject7;
import javax.servlet.annotation.WebServlet;
import com.vaadin.annotations.Theme;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.annotations.Widgetset;
import com.vaadin.data.Property;
import com.vaadin.data.util.BeanItemContainer;
import com.vaadin.server.VaadinRequest;
@mstahv
mstahv / MyUI.java
Created October 2, 2015 14:31
An example how to use ContextMenu add-on together with V-Leaflet
package org.bluemix.challenge;
import javax.servlet.annotation.WebServlet;
import com.vaadin.annotations.Theme;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.annotations.Widgetset;
import com.vaadin.server.Page;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
@mstahv
mstahv / settings.xml
Created November 4, 2015 13:08
An example of liferay profile
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
<id>liferay</id>
<properties>
<liferayinstall>/Users/mattitahvonenitmill/Applications/liferay-portal-6.2-ce-ga4</liferayinstall>
<plugin.type>portlet</plugin.type>
@mstahv
mstahv / MyUI.java
Created March 21, 2016 10:03
Example how to add lang attribute to Vaadin app
package org.test;
import javax.servlet.annotation.WebServlet;
import com.vaadin.annotations.Theme;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.server.BootstrapFragmentResponse;
import com.vaadin.server.BootstrapListener;
import com.vaadin.server.BootstrapPageResponse;
import com.vaadin.server.VaadinRequest;
@mstahv
mstahv / MyUI.java
Created March 22, 2016 07:45
Yet another example to add lang attribute to html tag, this time with Viritin add-on
package org.test;
import javax.servlet.annotation.WebServlet;
import com.vaadin.annotations.Theme;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
import com.vaadin.ui.Label;
import com.vaadin.ui.UI;
@mstahv
mstahv / Google2APi.java
Last active November 4, 2018 17:34
Google OAuth2.0 for scribe-java
package org.scribe.builder.api;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.scribe.exceptions.OAuthException;
import org.scribe.extractors.AccessTokenExtractor;
import org.scribe.model.OAuthConfig;
import org.scribe.model.OAuthConstants;
import org.scribe.model.OAuthRequest;
package com.example.demo;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Order;
import com.vaadin.flow.data.provider.Query;
import com.vaadin.flow.data.provider.SortDirection;
public class SpringDataVaadinUtil {
@mstahv
mstahv / Example.java
Created January 26, 2023 16:52
Abusing Vaadin ComboBox lazy data binding for filtering other components using ComboBox
ArrayList<String> values = new ArrayList<>();
values.add("foo");
values.add("bar");
ComboBox<String> stringComboBox = new ComboBox<>();
stringComboBox.setItemsWithFilterConverter((CallbackDataProvider.FetchCallback<String, String>) query -> {
if(query.getFilter().isPresent()) {
String filter = query.getFilter().get();
System.out.println("Do something else with filter: " + filter);
return values.stream()
@mstahv
mstahv / PushBased.java
Last active June 2, 2023 09:36
Prototype of session timeout warning dialog
package org.vaadin.vaadin.sb.example.views;
import com.vaadin.flow.component.AttachEvent;
import com.vaadin.flow.component.DetachEvent;
import com.vaadin.flow.component.UI;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.html.Paragraph;
import com.vaadin.flow.component.html.Span;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.router.Route;