Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.vaadintest;
- import java.io.File;
- import com.sun.org.apache.xerces.internal.impl.xs.identity.Selector;
- import com.vaadin.Application;
- import com.vaadin.data.Property;
- import com.vaadin.data.Property.ValueChangeEvent;
- import com.vaadin.data.util.FilesystemContainer;
- import com.vaadin.data.util.TextFileProperty;
- import com.vaadin.ui.*;
- public class VaadintestApplication extends Application {
- FilesystemContainer docs = new FilesystemContainer(new File("/home/juw/docs"));
- Select selector = new Select(null, docs);
- Label viewer = new Label("Select a doc", Label.CONTENT_RAW);
- @Override
- public void init() {
- Window mainWindow = new Window("Vaadintest Application");
- mainWindow.addComponent(selector);
- mainWindow.addComponent(viewer);
- setMainWindow(mainWindow);
- selector.setImmediate(true);
- selector.setSizeFull();
- selector.addListener(new Property.ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- // TODO Auto-generated method stub
- System.out.println("stuff have changed");
- viewer.setPropertyDataSource(new TextFileProperty((File)selector.getValue()));
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement