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 / 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;
}
{
"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 / 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() {
<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 / 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);
@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 / 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;
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;