dhbw.clippinggorilla.userinterface.windows.PDFWindow.java Source code

Java tutorial

Introduction

Here is the source code for dhbw.clippinggorilla.userinterface.windows.PDFWindow.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package dhbw.clippinggorilla.userinterface.windows;

import com.vaadin.event.ShortcutAction;
import com.vaadin.server.FileResource;
import com.vaadin.ui.BrowserFrame;
import com.vaadin.ui.Window;
import java.nio.file.Path;

/**
 * This is a Window to Display PDF Documents
 * @author frank
 */
public class PDFWindow {

    public static Window get(Path pdfFile) {
        Window window = new Window();
        window.setModal(true);
        window.setResizable(false);
        window.setWidth("90%");
        window.setHeight("90%");
        window.addCloseShortcut(ShortcutAction.KeyCode.ENTER, null);
        BrowserFrame e = new BrowserFrame(pdfFile.getFileName().toString(), new FileResource(pdfFile.toFile()));
        e.setSizeFull();
        window.setContent(e);
        return window;
    }

}