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
public class CrudView extends VerticalLayout {
DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd");
CrudPresenter presenter = new CrudPresenter(this);
private Grid grid;
private BeanFieldGroup<President> fieldGroup = new BeanFieldGroup<President>(
President.class);
private TextField firstName;
private TextField lastName;
private ComboBox party;
private TextField tookOffice;
@Peppe
Peppe / CategoryField.java
Created December 10, 2014 07:02
List of Vaadin Checkboxes wrapped into a Field with CustomField
package org.vaadin.mockapp.samples.crud;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.vaadin.mockapp.samples.backend.data.Category;
@Peppe
Peppe / gist:ec2aec2f7e908f1b569773c38709e548
Created May 8, 2017 05:34
Spreadsheet dependency tree
--- maven-dependency-plugin:2.8:tree (default-cli) @ vaadin-spreadsheet ---
com.vaadin:vaadin-spreadsheet:jar:2.0-SNAPSHOT
+- com.vaadin:vaadin-server:jar:8.0.0:compile
| +- com.vaadin:vaadin-sass-compiler:jar:0.9.13:compile
| | +- org.w3c.css:sac:jar:1.3:compile
| | \- com.vaadin.external.flute:flute:jar:1.3.0.gg2:compile
| +- com.vaadin:vaadin-shared:jar:8.0.0:compile
| +- org.jsoup:jsoup:jar:1.8.3:compile
| \- com.googlecode.gentyref:gentyref:jar:1.2.0:compile
+- com.vaadin:vaadin-client:jar:8.0.0:compile
@Peppe
Peppe / LastPointChart.java
Created May 8, 2018 11:22
Vaadin Charts where only last data point has a label
package com.jensjansson;
import com.vaadin.addon.charts.Chart;
import com.vaadin.addon.charts.model.*;
public class LastPointChart extends Chart {
public LastPointChart() {
Configuration conf = getConfiguration();
setConfiguration(conf);
<template>
<vaadin-vertical-layout style="flex: 1">
<h2>Book {{greeting}}!</h2>
<HelloComp/>
<vaadin-horizontal-layout style="justify-content: space-between; width: 100%; padding-bottom: 16px">
<vaadin-text-field id="text" placeholder="Filter"></vaadin-text-field>
<vaadin-button theme="primary" @click="newProduct"><iron-icon icon="vaadin:plus" slot="prefix"></iron-icon>New product</vaadin-button>
</vaadin-horizontal-layout>
<!--<vaadin-grid :items="users" onActiveItemChanged={this.foo} active-item={this.state.activeItem}>-->
<vaadin-grid id="grid" :items.prop="users" v-html="gridHtml" v-on:active-item-changed="bookChanged" >
@Peppe
Peppe / ModifiedRichTextEditor.java
Created June 19, 2019 12:59
RichTextEditor with an extra button
package com.example.app.spring;
import com.vaadin.flow.component.ClientCallable;
import com.vaadin.flow.component.notification.Notification;
import com.vaadin.flow.component.richtexteditor.RichTextEditor;
public class ModifiedRichTextEditor extends RichTextEditor {
public ModifiedRichTextEditor() {
{
"name": "no-name",
"requires": true,
"lockfileVersion": 1,
"dependencies": {
"@babel/cli": {
"version": "7.6.4",
"resolved": "https://registry.npmjs.org/@babel/cli/-/cli-7.6.4.tgz",
"integrity": "sha512-tqrDyvPryBM6xjIyKKUwr3s8CzmmYidwgdswd7Uc/Cv0ogZcuS1TYQTLx/eWKP3UbJ6JxZAiYlBZabXm/rtRsQ==",
"dev": true,
@Peppe
Peppe / frontend.src.components.p-radio-button.js
Created January 28, 2020 11:38
Adding a custom version of Vaadin radio button
import { RadioButtonElement } from "@vaadin/vaadin-radio-button/src/vaadin-radio-button";
class PRadioButton extends RadioButtonElement {
connectedCallback() {
super.connectedCallback();
}
static get template() {
return RadioButtonElement.template;
}
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 {
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 ---