com.squadd.UI.OneParticipant.java Source code

Java tutorial

Introduction

Here is the source code for com.squadd.UI.OneParticipant.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.javaBeans.UserInfoBean;
import com.squadd.technical.Display;
import com.squadd.technical.ImageGetter;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Image;
import com.vaadin.ui.Label;
import com.vaadin.ui.Panel;

/**
 *
 * @author SharkNado
 */
public class OneParticipant extends HorizontalLayout {
    private Image image;
    private Label userName;

    public OneParticipant(UserInfoBean user) {
        image = new ImageGetter().get(user);
        userName = new Label(user.getName());
        buildLayout();
    }

    private void buildLayout() {
        image.setWidth(0.04 * Display.width + "px");
        image.setHeight(0.04 * Display.height + "px");

        userName.setWidth(0.2 * Display.width + "px");

        Panel forPic = new Panel();
        forPic.setContent(image);
        Panel userN = new Panel(userName);

        addComponents(forPic, userN);
    }

    public Image getImage() {
        return image;
    }

    public Label getUserName() {
        return userName;
    }

    public void setImage(Image image) {
        this.image = image;
    }

    public void setUserName(Label userName) {
        this.userName = userName;
    }

}