de.fatalix.lighty.web.component.LightyHeader.java Source code

Java tutorial

Introduction

Here is the source code for de.fatalix.lighty.web.component.LightyHeader.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.lighty.web.component;

import com.vaadin.server.ThemeResource;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Image;
import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;
import de.fatalix.lighty.web.LightyLabels;
import de.fatalix.lighty.web.LightyTheme;

/**
 *
 * @author Fatalix
 */
public class LightyHeader extends HorizontalLayout {

    public LightyHeader() {
        addStyleName(LightyTheme.HEADER_BACKGROUND);
        setWidth(100, Unit.PERCENTAGE);
        Image image = new Image(null, new ThemeResource("img/lighty-icon.png"));
        image.setWidth(64, Unit.PIXELS);
        image.setHeight(64, Unit.PIXELS);
        Label headerTitle = new Label("Lighty App");
        headerTitle.addStyleName(LightyLabels.TITLE_CAPTION);
        addComponents(image, headerTitle);
        setExpandRatio(headerTitle, 1.0f);
        setComponentAlignment(headerTitle, Alignment.MIDDLE_LEFT);
    }

}