O'Reilly logo

Vaadin 7 UI Design By Example Beginner's Guide by Alejandro Duarte

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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()

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required