Skip to content

Instantly share code, notes, and snippets.

View Peppe's full-sized avatar
🚂
Choo choo!

Jens Jansson Peppe

🚂
Choo choo!
  • Smartly.io
  • Turku, Finland
View GitHub Profile
@Peppe
Peppe / GoogleLogin.java
Last active May 25, 2021 14:26
Google Sign in integration to Vaadin
/*
* Java component counterpart for the frontend file, src/main/java/com/example/application/views/helloworld/GoogleLogin.java
* It accepts the user token from client side login. You should validate the token on the server side to recieve the details.
* See https://developers.google.com/identity/sign-in/web/backend-auth
*/
package com.example.application.views.helloworld;
import com.vaadin.flow.component.ClientCallable;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.dependency.JsModule;
@Peppe
Peppe / ChatView.java
Created March 11, 2021 13:58
Chat app built with Vaadin 20.
package com.example.application.views.chat;
import com.example.application.views.main.MainView;
import com.vaadin.collaborationengine.CollaborationAvatarGroup;
import com.vaadin.collaborationengine.CollaborationMessageInput;
import com.vaadin.collaborationengine.CollaborationMessageList;
import com.vaadin.collaborationengine.UserInfo;
import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.button.Button;
@Peppe
Peppe / SplitButtonBar.java
Created September 3, 2020 13:47
How do I split a button bar into left and right groups in Vaadin 14
package com.example.splitbuttonbar;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.button.ButtonVariant;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.component.html.H4;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.router.Route;
import com.vaadin.recipes.recipe.Metadata;
import com.vaadin.recipes.recipe.Recipe;
/Library/Java/JavaVirtualMachines/amazon-corretto-11.jdk/Contents/Home/bin/java -javaagent:/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar=50215:/Applications/IntelliJ IDEA CE.app/Contents/bin -Dfile.encoding=UTF-8 -classpath /Users/peppe/Downloads/collaboration-crm/target/classes:/Users/peppe/.m2/repository/com/vaadin/vaadin/14.1.27/vaadin-14.1.27.jar:/Users/peppe/.m2/repository/com/vaadin/vaadin-core/14.1.27/vaadin-core-14.1.27.jar:/Users/peppe/.m2/repository/com/vaadin/flow-push/2.1.9/flow-push-2.1.9.jar:/Users/peppe/.m2/repository/com/vaadin/external/atmosphere/atmosphere-runtime/2.4.30.slf4jvaadin1/atmosphere-runtime-2.4.30.slf4jvaadin1.jar:/Users/peppe/.m2/repository/com/vaadin/flow-client/2.1.9/flow-client-2.1.9.jar:/Users/peppe/.m2/repository/com/vaadin/flow-html-components/2.1.9/flow-html-components-2.1.9.jar:/Users/peppe/.m2/repository/com/vaadin/flow-dnd/2.1.9/flow-dnd-2.1.9.jar:/Users/peppe/.m2/repository/org/webjars/npm/vaadin__vaadin-mobile-drag-drop/1.0.0/vaadin__vaadin-mobile-drag-
@Peppe
Peppe / ExampleView.java
Created April 21, 2020 19:36
Example on how to make an video player using the native HTML <video> in Vaadin 14.
package com.vaadin.example.views;
import com.vaadin.example.components.Video;
import com.vaadin.flow.component.html.H1;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.router.Route;
@Route("example")
public class ExampleView extends VerticalLayout {
"C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.1.3\jbr\bin\java.exe" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:53847,suspend=y,server=n -javaagent:C:\Users\jensj\.IdeaIC2019.2\system\captureAgent\debugger-agent.jar -Dfile.encoding=UTF-8 -classpath "C:\Users\jensj\Documents\Dev\Vaadin\skeleton-starter-flow-spring\target\classes;C:\Users\jensj\.m2\repository\com\vaadin\flow-server\3.1-SNAPSHOT\flow-server-3.1-20200406.084407-74.jar;C:\Users\jensj\.m2\repository\com\vaadin\flow-push\3.1-SNAPSHOT\flow-push-3.1-20200407.080656-78.jar;C:\Users\jensj\.m2\repository\com\vaadin\external\atmosphere\atmosphere-runtime\2.4.30.slf4jvaadin1\atmosphere-runtime-2.4.30.slf4jvaadin1.jar;C:\Users\jensj\.m2\repository\org\slf4j\slf4j-api\1.7.28\slf4j-api-1.7.28.jar;C:\Users\jensj\.m2\repository\com\vaadin\external\gwt\gwt-elemental\2.8.2.vaadin2\gwt-elemental-2.8.2.vaadin2.jar;C:\Users\jensj\.m2\repository\commons-fileupload\commons-fileupload\1.3.3\commons-fileupload-1.3.3.jar;C:\Users\jensj\.m2\rep

Installing in IntelliJ IDEA

Installing Vaadin Designer

Vaadin Designer is compatible with both Community and Ultimate Editions.

  1. Open IntelliJ IDEA.

[[designer.intellij.installing]]
= Installing in IntelliJ IDEA
== Installing Vaadin Designer
Vaadin Designer is compatible with both Community and Ultimate Editions.
. Open IntelliJ IDEA.
PS C:\Users\jensj\Downloads\example-project (1)> mvn spring-boot:run
[INFO] Scanning for projects...
[INFO]
[INFO] --------------< com.example.application:example-project >---------------
[INFO] Building Example Project 2.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] >>> spring-boot-maven-plugin:2.2.0.RELEASE:run (default-cli) > test-compile @ example-project >>>
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ example-project ---
import {html, PolymerElement} from '@polymer/polymer/polymer-element.js';
import '@vaadin/vaadin-form-layout/src/vaadin-form-layout.js';
import '@vaadin/vaadin-form-layout/src/vaadin-form-item.js';
import '@vaadin/vaadin-ordered-layout/src/vaadin-horizontal-layout.js';
import '@vaadin/vaadin-ordered-layout/src/vaadin-vertical-layout.js';
import '@polymer/iron-icon/iron-icon.js';
import '@vaadin/vaadin-button/src/vaadin-button.js';
import '@vaadin/vaadin-text-field/src/vaadin-text-field.js';
class LoginView extends PolymerElement {