List of usage examples for com.vaadin.server VaadinService getCurrent
public static VaadinService getCurrent()
From source file:uk.q3c.util.ResourceUtils.java
License:Apache License
public static File resourcePath(String file) { File baseDir;/*w ww .java 2s . co m*/ if (VaadinService.getCurrent() != null) { baseDir = applicationBaseDirectory(); } baseDir = new File("src/main/resources"); File resourceFile = new File(baseDir, file); return resourceFile; }
From source file:views.StandaloneTSVImport.java
License:Open Source License
private Component createTSVDownloadComponent(DesignType type, String info) { VerticalLayout v = new VerticalLayout(); v.setSpacing(true);/* w w w .j av a 2s.c o m*/ Label l = new Label(info); l.setWidth("300px"); v.addComponent(l); Button button = new Button("Download Example"); v.addComponent(button); String basepath = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath(); FileDownloader tsvDL = new FileDownloader( new FileResource(new File(basepath + "/WEB-INF/files/" + type.getFileName()))); tsvDL.extend(button); return v; }