de.fatalix.timeline.web.VaadinWebProjectApp.java Source code

Java tutorial

Introduction

Here is the source code for de.fatalix.timeline.web.VaadinWebProjectApp.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 de.fatalix.timeline.web;

import com.vaadin.annotations.Theme;
import com.vaadin.annotations.Title;
import com.vaadin.annotations.Widgetset;
import com.vaadin.cdi.CDIUI;
import com.vaadin.cdi.CDIViewProvider;
import com.vaadin.navigator.Navigator;
import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.Panel;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
import javax.inject.Inject;

/**
 *
 * @author Fatalix
 */
@CDIUI
@Theme(value = "timeline-theme")
@Title("Timeline App")
@Widgetset("de.fatalix.timeline.web.AppWidgetSet")
public class VaadinWebProjectApp extends UI {

    @Inject
    private CDIViewProvider viewProvider;

    @Override
    protected void init(VaadinRequest request) {
        setSizeFull();
        VerticalLayout navigatorLayout = new VerticalLayout();
        navigatorLayout.setSizeFull();
        navigatorLayout.setSpacing(true);

        Panel contentPanel = new Panel(navigatorLayout);
        contentPanel.setSizeFull();

        Navigator navigator = new Navigator(VaadinWebProjectApp.this, contentPanel);
        navigator.addProvider(viewProvider);

        VerticalLayout rootLayout = new VerticalLayout();
        //rootLayout.addComponent(header);
        rootLayout.addComponent(contentPanel);
        rootLayout.setExpandRatio(contentPanel, 1.0f);
        rootLayout.setSizeFull();
        setContent(rootLayout);
    }

}