com.wintindustries.pfserver.interfaces.view.dashboard.MainView.java Source code

Java tutorial

Introduction

Here is the source code for com.wintindustries.pfserver.interfaces.view.dashboard.MainView.java

Source

package com.wintindustries.pfserver.interfaces.view.dashboard;

/*
 * 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.
 */

/**
 *
 * @author Admin
 */
//import com.vaadin.demo.dashboard.DashboardNavigator;
import com.vaadin.data.Property;
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Component;
import com.wintindustries.pfserver.interfaces.view.dashboard.DashboardMenu;
import com.vaadin.ui.ComponentContainer;
import com.vaadin.ui.CssLayout;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.NativeSelect;
import com.wintindustries.pfserver.interfaces.container.components.PFUpload.PFDDragAndDropUpload;

/*
 * Dashboard MainView is a simple HorizontalLayout that wraps the menu on the
 * left and creates a simple container for the navigator on the right.
 */
@SuppressWarnings("serial")
public class MainView extends HorizontalLayout implements View {

    PFDDragAndDropUpload contentAreaWrapper;
    DashboardMenu dashboard;
    MenuBar menuBar;

    public MainView() {
        setSizeFull();
        addStyleName("mainview");
        addMenu();

        //  addComponent(new DashboardMenu());

        contentAreaWrapper = new PFDDragAndDropUpload();
        contentAreaWrapper.addStyleName("view-content");
        contentAreaWrapper.setSizeFull();
        addComponent(contentAreaWrapper);
        setExpandRatio(contentAreaWrapper, 1.0f);
        //contentArea.addComponent(new ContentWindowManager());
        addMenuBar();
        //  this.addComponent(createThemeSelect());
    }

    private Component createThemeSelect() {
        final NativeSelect ns = new NativeSelect();
        ns.setNullSelectionAllowed(false);
        ns.setId("themeSelect");
        ns.addContainerProperty("caption", String.class, "");
        ns.setItemCaptionPropertyId("caption");

        // ns.setValue("tests-valo");

        return ns;
    }

    public void addMenuBar() {
        menuBar = new MenuBar();
        menuBar.setVisible(false);
        this.addComponent(menuBar);
        this.setComponentAlignment(menuBar, Alignment.TOP_RIGHT);
    }

    public void addMenu() {
        dashboard = new DashboardMenu();

        this.addComponent(dashboard);
        dashboard.setVisible(false);

    }

    public void showLoginUI() {
        dashboard.reloadFolderUI();
        dashboard.setVisible(true);
        menuBar.reloadInterface();
        menuBar.setVisible(true);
        dashboard.buildMenu();
    }

    public void showLoginOutUI() {
        dashboard.setVisible(false);
        menuBar.setVisible(false);
    }

    @Override
    public void enter(ViewChangeListener.ViewChangeEvent event) {
        //    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    public ComponentContainer getContentContainer() {
        return contentAreaWrapper.getContentArea();
    }
}