com.squadd.UI.MenuLayout.java Source code

Java tutorial

Introduction

Here is the source code for com.squadd.UI.MenuLayout.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.squadd.UI;

import com.squadd.technical.Display;
import com.vaadin.server.Resource;
import com.vaadin.server.ThemeResource;
import com.vaadin.ui.Button;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.VerticalLayout;
import java.awt.Dimension;
import java.awt.Toolkit;

/**
 *
 * @author SharkNado
 */
public class MenuLayout extends HorizontalLayout {
    private Panel groupsPanel;
    private Panel messagesPanel;
    private Panel mainPagePanel;

    public MenuLayout() {
        groupsPanel = new Panel("My Groups");
        messagesPanel = new Panel("Messages");
        mainPagePanel = new Panel("Main Page");

        configureLayout();
    }

    private void configureLayout() {
        //AWT toolkit doesn't want to work so there are hardcoded screen variables
        HorizontalLayout zLa = new HorizontalLayout();
        VerticalLayout panels = new VerticalLayout(mainPagePanel, groupsPanel, messagesPanel);
        panels.setWidth(0.1 * Display.width + "px");
        zLa.setWidth(0.1 * Display.width + "px");
        zLa.setHeight(0.2 * Display.height + "px");

        this.setMargin(false);
        this.setSpacing(false);
        addComponents(zLa, panels);
    }

    public Panel getGroupsPanel() {
        return groupsPanel;
    }

    public Panel getMessagesPanel() {
        return messagesPanel;
    }

    public Panel getMainPagePanel() {
        return mainPagePanel;
    }

    public void setGroupsPanel(Panel groupsPanel) {
        this.groupsPanel = groupsPanel;
    }

    public void setMessagesPanel(Panel messagesPanel) {
        this.messagesPanel = messagesPanel;
    }

    public void setMainPagePanel(Panel mainPagePanel) {
        this.mainPagePanel = mainPagePanel;
    }
}