Skip to content

Instantly share code, notes, and snippets.

View johannest's full-sized avatar

Johannes Tuikkala johannest

View GitHub Profile
package com.viavansi.vaadinsample.lib.utils;
import com.vaadin.data.util.BeanContainer;
import com.vaadin.data.util.converter.Converter;
import com.vaadin.ui.AbstractSelect;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
public Component getColumnRangeChart() throws ParseException {
Chart chart = new Chart(ChartType.COLUMNRANGE);
Configuration conf = chart.getConfiguration();
conf.getChart().setInverted(true);
YAxis yAxis = conf.getyAxis();
yAxis.setTitle(new Title("Time"));
yAxis.setType(AxisType.DATETIME);
conf.getTooltip().setFormatter("return '<b>' + this.x + '</b> started at <b>' + Highcharts.dateFormat('%H:%M', this.point.low) + '</b> and ended at <b>' + Highcharts.dateFormat('%H:%M', this.point.high) + '</b>';");
//one possibility could be, using some kind of callback, e.g:
void onChange(GridEditorChangeEvent e) {
if (validationFailedOrSomething()) {
e.discardChange();
}
}
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
@johannest
johannest / MyVaadinApplication.java
Created September 4, 2015 08:27
JPA-tree-example
package org.vaadin.jpatest;
import javax.persistence.EntityManager;
import org.vaadin.jpatest.domain.AbstractEntity;
import org.vaadin.jpatest.domain.Car;
import org.vaadin.jpatest.domain.Person;
import org.vaadin.jpatest.domain.Vehicle;
import com.vaadin.addon.jpacontainer.JPAContainer;
@Before
public void setUp() throws Exception {
WebDriver driver = new LoadTestDriver.LoadTestDriverBuilder().
withIpAddress(LoadTestDriver.getLocalIpAddress()).
withNumberOfConcurrentUsers(1).
withRampUpTimeInSeconds(1).
withProxyPort(9999).
withPath("/Users/jotatu/Desktop/gatling").
withStaticResourcesIngnoring().
build();
import java.io._
import java.util
import javax.servlet.annotation.WebServlet
import com.vaadin.annotations.{Push, Theme, VaadinServletConfiguration}
import com.vaadin.server.StreamResource.StreamSource
import com.vaadin.server.{FileDownloader, StreamResource, VaadinRequest, VaadinServlet}
import com.vaadin.ui.Button.ClickEvent
import com.vaadin.ui.{Label, UI, TabSheet, Upload}
package org.test;
import java.util.Arrays;
import javax.servlet.annotation.WebServlet;
import com.vaadin.annotations.Theme;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.data.provider.ListDataProvider;
import com.vaadin.server.VaadinRequest;
// Example view code
final Button makeReport = new Button("Generate report", new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
try {
MyPdfSource pdfSource = new MyPdfSource("test.pdf", new ByteArrayOutputStream());
testServiceBean.doReport(pdfSource.getOutputStream());
import scala.concurrent.duration._
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._
class BevBuddy extends Simulation {
val baseUrl: String = System.getProperty("gatling.baseUrl", "http://localhost:8080/bevbuddy-1.0-SNAPSHOT")