org.balisunrise.vaadin.components.header.Header.java Source code

Java tutorial

Introduction

Here is the source code for org.balisunrise.vaadin.components.header.Header.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 org.balisunrise.vaadin.components.header;

import com.vaadin.ui.Alignment;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;

/**
 *
 * @author Glauco
 */
public class Header extends HorizontalLayout {

    private Label programName;
    private FastMenuBar fastMenuBar;
    private SearchInput searchInput;
    private ModuleButton moduleButton;
    private ModuleMenu moduleMenu;
    private UserBar userBar;

    public Header() {
        init();
    }

    private void init() {
        setStyleName("b-header");
        setHeight("41px");
        setWidth("100%");

        // parte da esquerda
        HorizontalLayout leftPart = new HorizontalLayout();
        leftPart.setSizeUndefined();
        leftPart.setHeight("100%");
        addComponent(leftPart);

        programName = new Label("Spilumba Cervejaria");
        programName.setStyleName("b-program-name");
        leftPart.addComponent(programName);

        fastMenuBar = new FastMenuBar();
        leftPart.addComponent(fastMenuBar);

        searchInput = new SearchInput();
        leftPart.addComponent(searchInput);

        moduleButton = new ModuleButton();
        leftPart.addComponent(moduleButton);

        // parte central do menu
        moduleMenu = new ModuleMenu();
        addComponent(moduleMenu);
        setComponentAlignment(moduleMenu, Alignment.MIDDLE_CENTER);

        // parte direita
        userBar = new UserBar();
        addComponent(userBar);
        setComponentAlignment(userBar, Alignment.TOP_RIGHT);
    }
}