Skip to content

Instantly share code, notes, and snippets.

View gabrielruiu's full-sized avatar

Gabriel Mihai Ruiu gabrielruiu

  • Karlsruhe, Germany
View GitHub Profile
/**
* Showcasing a custom FieldGroupGieldFactory that generates an UploadField(from https://vaadin.com/directory#addon/easyuploads)
* if the FieldGroup is trying to bind to a byte[] object property.
* The image instance is updated each time a new image is uploaded
*
* Ruiu Gabriel Mihai (gabriel.ruiu@mail.com)
*/
public class ImageReplacerFieldGroup extends FormLayout {
public ImageReplacerFieldGroup() {
@gabrielruiu
gabrielruiu / RestrictingUpload
Created April 3, 2014 19:05
Upload component (from Vaadin 7.1.13) that remembers the files it has uploaded and asks, in case a duplicate file is uploaded, if we wish to overwrite it.
import com.vaadin.ui.Upload;
import org.apache.commons.io.IOUtils;
import org.vaadin.dialogs.ConfirmDialog;
import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
public class RunApp {
private List<String> expiredCCList;
private List<String> stolenCCList;
public Main {
populateExpiredList();
populateStolenList();
package com.gabrielruiu.test;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.List;
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">