com.cerebro.provevaadin.FirstTime.java Source code

Java tutorial

Introduction

Here is the source code for com.cerebro.provevaadin.FirstTime.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 com.cerebro.provevaadin;

import com.cerebro.provevaadin.database.Configurazione;
import com.cerebro.provevaadin.smtp.ConfigurazioneSMTP;
import com.vaadin.ui.Button;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.UI;
import org.apache.shiro.SecurityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author matteo
 */
class FirstTime extends HorizontalLayout {

    //    Logger logger = LoggerFactory.getLogger(FirstTime.class);

    public FirstTime() {

        this.setMargin(true);

        TabSheet tabsheet = new TabSheet();
        this.addComponent(tabsheet);
        tabsheet.addTab(new Configurazione(), "Database MySQL");
        tabsheet.addTab(new ConfigurazioneSMTP(), "Server SMTP");

        Button logout = new Button("Esci");
        this.addComponent(logout);
        logout.addClickListener((Button.ClickEvent e) -> {
            //            logger.info("Esco dall'applicazione");
            //            logger.info("Pulsante: " + e.toString());
            SecurityUtils.getSubject().logout();
            UI.getCurrent().getSession().close();
            UI.getCurrent().getPage().setLocation("");
        });
        this.addComponent(logout);

    }

}