Time for action – a file browser

Follow these steps and see how easy it is to create a basic file browser with Vaadin:

  1. Launch your IDE and create a new Vaadin project named treetable. Come on! Do it! Invest five minutes (maybe less) in this exercise.
  2. Let's start with this empty layout:
    public class TreetableUI extends UI {
    
      protected void init(VaadinRequest request) {
        final VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        setContent(layout);
      }
    
    }
  3. We are implementing a file browser, so we need the root directory to be shown:
    public class TreetableUI extends UI {
    
      protected void init(VaadinRequest request) {
    
        // ...
    
        File folder = VaadinService.getCurrent().getBaseDirectory();
      }
    
    }

    Note

    VaadinService.getCurrent().getBaseDirectory()

Get Vaadin 7 UI Design By Example Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.