Skip to content

Instantly share code, notes, and snippets.

View Legioth's full-sized avatar

Leif Åstrand Legioth

View GitHub Profile
@Legioth
Legioth / BackendListDataProvider.java
Created June 23, 2020 19:47
ListDataProvider that uses backend sorting definitions instead of comparators from the component
import java.beans.IntrospectionException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Stream;
@Legioth
Legioth / JsRenderer.java
Last active August 28, 2020 15:57
JavaScript Renderer for Flow
package org.vaadin.leif;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import org.slf4j.LoggerFactory;
import com.vaadin.flow.data.provider.CompositeDataGenerator;
import com.vaadin.flow.data.provider.DataGenerator;
@Legioth
Legioth / examples.js
Created February 12, 2020 11:50
Stateful LitElement directive
import { html } from 'lit-element';
import { statefulDirective, StatefulLitElement } from './statefulDirective.js';
const simple = statefulDirective((param) => (part) => {
console.log("Activate simple", param, part);
part.setValue(param);
return () => console.log("Remove simple", param, part);
});
const withUpdate = statefulDirective((param) => (part) => {