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.hris.payroll; import com.hris.payroll.alphalist.AlphaListMainUI; import com.hris.payroll.thirteenthmonth.ThirteenthMonth; import com.hris.common.CommonUtil; import com.hris.payroll.reports.ReportUI; import com.vaadin.ui.TabSheet; import com.vaadin.ui.VerticalLayout; /** * * @author jetdario */ public class PayrollUI extends VerticalLayout { PayrollLedgerUI ledger; ThirteenthMonth tm; AlphaListMainUI al; ReportUI reportUI; private Object branch; private int branchId; public PayrollUI() { setSizeFull(); init(); getPayrollTab(); } public PayrollUI(Object branch) { this.branch = branch; setSizeFull(); init(); getPayrollTab(); } private void init() { if (getBranch() == null) { branchId = 0; } else { String[] str = branch.toString().split("#"); branchId = CommonUtil.convertStringToInteger(str[0]); } ledger = new PayrollLedgerUI(branchId); tm = new ThirteenthMonth(branchId); al = new AlphaListMainUI(branchId); reportUI = new ReportUI(branchId); } private void getPayrollTab() { TabSheet tab = new TabSheet(); tab.setSizeFull(); VerticalLayout v = new VerticalLayout(); v.setSizeFull(); v.addComponent(ledger); tab.addTab(v, "Payroll Ledger"); v = new VerticalLayout(); v.setSizeFull(); tab.addTab(v, "Payroll Register"); v = new VerticalLayout(); v.setSizeFull(); v.addComponent(tm); tab.addTab(v, "13th Month"); v = new VerticalLayout(); v.setSizeFull(); v.addComponent(al); tab.addTab(v, "Alpha List"); v = new VerticalLayout(); v.setSizeFull(); v.addComponent(reportUI); tab.addTab(v, "Reports"); addComponent(tab); } Object getBranch() { return branch; } int getBranchId() { return branchId; } }