com.squadd.views.GroupInfo.java Source code

Java tutorial

Introduction

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

import com.squadd.UI.GroupChatLayout;
import com.squadd.UI.GroupMainInfoLayout;
import com.squadd.UI.GroupParticipantsLayout;
import com.squadd.UI.MainInformationAboutGroup;
import com.squadd.javaBeans.Group;
import com.squadd.javaBeans.GroupType;
import com.squadd.javaBeans.Place;
import com.squadd.managers.DBManager;
import com.squadd.technical.Display;
import com.vaadin.spring.annotation.SpringView;
import com.vaadin.spring.annotation.UIScope;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Layout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.VerticalLayout;
import javax.annotation.PostConstruct;

/**
 *
 * @author SharkNado
 */
@SpringView(name = GroupInfo.NAME)
@UIScope()
public class GroupInfo extends MainPageView {
    public static final String NAME = "GroupInfo";

    private GroupChatLayout groupChat;
    private MainInformationAboutGroup groupInfoLayout;
    private GroupParticipantsLayout groupParticipants;

    @Override
    protected Panel fillContentPanel(Layout layout) {
        Panel result = new Panel();
        result.setContent(configureMainPageLayout());
        return result;
    }

    @PostConstruct
    private Layout configureMainPageLayout() {
        DBManager db = new DBManager();
        group = db.getGroupById(group.getGroupId());

        HorizontalLayout horIn = new HorizontalLayout();
        groupInfoLayout = new MainInformationAboutGroup(group);
        groupInfoLayout.setWidth(0.69 * Display.width + "px");
        horIn.addComponent(groupInfoLayout);

        groupParticipants = new GroupParticipantsLayout(group);
        groupParticipants.setWidth(0.69 * Display.width + "px");

        HorizontalLayout hor = new HorizontalLayout();
        groupChat = new GroupChatLayout(group);
        groupChat.setSizeUndefined();
        hor.setWidth(0.69 * Display.width + "px");
        hor.addComponent(groupChat);

        HorizontalLayout whiteSp = new HorizontalLayout();
        HorizontalLayout whiteSp1 = new HorizontalLayout();
        VerticalLayout whole = new VerticalLayout();
        whole.setMargin(true);
        whole.addComponents(horIn, whiteSp, groupParticipants, whiteSp1, hor);
        return whole;
    }

    @Override
    public void fillFromView() {
        contact.setFromView(GroupInfo.NAME);
    }
}