Java tutorial
/* * 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.save.employee.request; import com.vaadin.server.FontAwesome; import com.vaadin.shared.ui.MarginInfo; import com.vaadin.ui.Alignment; import com.vaadin.ui.Button; import com.vaadin.ui.UI; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.Window; import com.vaadin.ui.themes.ValoTheme; /** * * @author jetdario */ public class RLUI extends VerticalLayout { private int employeeId; public RLUI(int employeeId) { this.employeeId = employeeId; setWidth("90%"); setHeight("100%"); setMargin(new MarginInfo(true, false, false, false)); RLDataGridProperties dataGrid = new RLDataGridProperties(getEmployeeId()); Button rlForm = new Button("Request/Liquidation FORM"); rlForm.setIcon(FontAwesome.OPENID); rlForm.addStyleName(ValoTheme.BUTTON_SMALL); rlForm.addStyleName(ValoTheme.BUTTON_LINK); rlForm.addClickListener((Button.ClickEvent event) -> { Window sub = new RequestFormWindow(getEmployeeId(), 0, false, dataGrid); if (sub.getParent() == null) { UI.getCurrent().addWindow(sub); } sub.addCloseListener((Window.CloseEvent e) -> { dataGrid.getContainerDataSource().removeAllItems(); dataGrid.setContainerDataSource(new RLDataContainer(getEmployeeId())); }); }); addComponent(rlForm); setComponentAlignment(rlForm, Alignment.MIDDLE_RIGHT); addComponent(dataGrid); setExpandRatio(dataGrid, 2); } int getEmployeeId() { return employeeId; } }