List of usage examples for com.vaadin.ui Button addListener
@Override
public Registration addListener(Component.Listener listener)
From source file:com.openhris.employee.salary.EmployeeSalaryInformation.java
private Window editDateEntryWindow(final String entryDate) { VerticalLayout vlayout = new VerticalLayout(); vlayout.setWidth("100%"); vlayout.setMargin(true);/* w w w .java 2s.c o m*/ vlayout.setSpacing(true); final Window window = new Window("EDIT DATE ENTRY", vlayout); window.setResizable(false); Button editBtn = new Button("EDIT DATE ENTRY?"); editBtn.setWidth("100%"); editBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { boolean result = si.editEmploymentDateEntry(getEmployeeId(), entryDate); if (result) { getWindow().showNotification("Update Entry Date.", Window.Notification.TYPE_TRAY_NOTIFICATION); (window.getParent()).removeWindow(window); } } }); window.addComponent(editBtn); return window; }
From source file:com.openhris.payroll.AdjustmentWindow.java
public AdjustmentWindow(int payrollId, double amountToBeReceive, double amountReceived, double adjustment) { this.payrollId = payrollId; this.amountToBeReceive = amountToBeReceive; this.amountReceived = amountReceived; this.adjustment = adjustment; setCaption("ADJUSTMENTS"); setWidth("400px"); TabSheet ts = new TabSheet(); ts.addStyleName("bar"); VerticalLayout vlayout = new VerticalLayout(); vlayout.setMargin(true);// ww w . j a v a 2 s .c om vlayout.setSpacing(true); vlayout.setCaption("Post Adjustments"); final TextField amount = new TextField("Amount: "); amount.setWidth("100%"); vlayout.addComponent(amount); final TextField remarks = new TextField("Remarks"); remarks.setWidth("100%"); vlayout.addComponent(remarks); Button saveAdjustments = new Button("POST ADJUSTMENTS"); saveAdjustments.setWidth("100%"); saveAdjustments.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (amount.getValue() == null || amount.getValue().toString().trim().isEmpty()) { getWindow().showNotification("Enter Amount for adjustment.", Window.Notification.TYPE_WARNING_MESSAGE); return; } else { if (!utilities.checkInputIfDouble(amount.getValue().toString().trim())) { getWindow().showNotification("Enter a numeric value for amount.", Window.Notification.TYPE_ERROR_MESSAGE); return; } } if (remarks.getValue() == null || remarks.getValue().toString().trim().isEmpty()) { getWindow().showNotification("Add remarks for adjustment.", Window.Notification.TYPE_ERROR_MESSAGE); return; } double amountForAdjustment = utilities.convertStringToDouble(amount.getValue().toString().trim()); String remarksForAdjustment = remarks.getValue().toString().trim().toLowerCase(); boolean result = payrollService.insertAdjustmentToPayroll(getPayrollId(), getAmountToBeReceive(), getAmountReceived(), amountForAdjustment, remarksForAdjustment); if (result) { adjustmentTable(); close(); getWindow().showNotification("Successfully added adjustment.", Window.Notification.TYPE_HUMANIZED_MESSAGE); } } }); vlayout.addComponent(saveAdjustments); ts.addComponent(vlayout); vlayout = new VerticalLayout(); vlayout.setMargin(true); vlayout.setSpacing(true); vlayout.setCaption("Adjustments Table"); Label label = new Label("Remarks: Click ID Column to delete Adjustment"); vlayout.addComponent(label); vlayout.addComponent(adjustmentTable()); Button closeBtn = new Button("CLOSE"); closeBtn.setWidth("100%"); closeBtn.addListener(closeBtnListener); vlayout.addComponent(closeBtn); ts.addComponent(vlayout); addComponent(ts); }
From source file:com.openhris.payroll.AdjustmentWindow.java
private Window removeAdjustment(final int adjustmentId, final double amountToBeReceive, final double amountReceived, final double adjustment, final int payrollId) { VerticalLayout vlayout = new VerticalLayout(); vlayout.setMargin(true);//from ww w. jav a2s.co m vlayout.setSpacing(true); final Window subWindow = new Window("REMOVE ADVANCES", vlayout); subWindow.setWidth("200px"); Button removeAdjBtn = new Button("REMOVE ADJUSTMENT?"); removeAdjBtn.setWidth("100%"); removeAdjBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { boolean result = payrollService.removeAdjustmentById(adjustmentId, amountToBeReceive, amountReceived, adjustment, payrollId); if (result) { (subWindow.getParent()).removeWindow(subWindow); adjustmentTable(); } } }); subWindow.addComponent(removeAdjBtn); return subWindow; }
From source file:com.openhris.payroll.contributions.AFLUI.java
public AFLUI(int branchId) { this.branchId = branchId; setSizeFull();/*from w w w. j a v a 2 s . c o m*/ setSpacing(true); setMargin(new MarginInfo(true, true, false, false)); HorizontalLayout h = new HorizontalLayout(); h.setWidth("100%"); h.setMargin(true); h.setSpacing(true); final PopupDateField payrollDateField = new HRISPopupDateField("Payroll Month and Year"); payrollDateField.setWidth("200px"); h.addComponent(payrollDateField); Button generateBtn = new Button("GENERATE AFL"); generateBtn.setWidth("200px"); generateBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { tradeId = cs.getTradeIdByBranchId(getBranchId()); corporateId = cs.getCorporateIdByTradeId(tradeId); afl.setContainerDataSource(new AFLContainer(corporateId, util.parsingDate(util.convertDateFormat(payrollDateField.getValue().toString())))); } }); h.addComponent(generateBtn); h.setComponentAlignment(generateBtn, Alignment.BOTTOM_LEFT); Button exportTableToExcel = new Button("EXPORT TO EXCEL"); exportTableToExcel.setWidth("200px"); exportTableToExcel.addListener(new Button.ClickListener() { private static final long serialVersionUID = -73954695086117200L; private ExcelExport excelExport; @Override public void buttonClick(Button.ClickEvent event) { excelExport = new ExcelExport(afl, "AFL Remitance"); excelExport.excludeCollapsedColumns(); excelExport.setReportTitle(cs.getCorporateById(corporateId).toUpperCase() + " AFL Remitances"); excelExport.setExportFileName( cs.getCorporateById(corporateId).replace(",", " ").toUpperCase() + "-AFL-Remitance-" + util.convertDateFormat(payrollDateField.getValue().toString()) + ".xls"); excelExport.export(); } }); h.addComponent(exportTableToExcel); h.setComponentAlignment(exportTableToExcel, Alignment.BOTTOM_LEFT); h.setExpandRatio(exportTableToExcel, 2); addComponent(h); addComponent(afl); setExpandRatio(afl, 2); }
From source file:com.openhris.payroll.contributions.BankDebitMemoUI.java
public BankDebitMemoUI(int branchId) { this.branchId = branchId; setSizeFull();//from ww w . j a va 2s. co m setSpacing(true); setMargin(new MarginInfo(true, true, false, false)); HorizontalLayout h = new HorizontalLayout(); h.setWidth("100%"); h.setMargin(true); h.setSpacing(true); final PopupDateField payrollDateField = new HRISPopupDateField("Payroll Month and Year"); payrollDateField.setWidth("200px"); h.addComponent(payrollDateField); Button generateBtn = new Button("GENERATE BANK DEBIT MEMO"); generateBtn.setWidth("200px"); generateBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { tradeId = cs.getTradeIdByBranchId(getBranchId()); corporateId = cs.getCorporateIdByTradeId(tradeId); Date date = util.parsingDate(util.convertDateFormat(payrollDateField.getValue().toString())); Calendar c = Calendar.getInstance(); c.setTime(date); debitMemoTable.setContainerDataSource( new BankDebitMemoContainer(corporateId, util.convertDateFormat(date.toString()))); } }); h.addComponent(generateBtn); h.setComponentAlignment(generateBtn, Alignment.BOTTOM_LEFT); Button exportTableToExcel = new Button("EXPORT TO EXCEL"); exportTableToExcel.setWidth("200px"); exportTableToExcel.addListener(new Button.ClickListener() { private static final long serialVersionUID = -73954695086117200L; private ExcelExport excelExport; @Override public void buttonClick(Button.ClickEvent event) { excelExport = new ExcelExport(debitMemoTable, "BANK DEBIT MEMO"); excelExport.excludeCollapsedColumns(); excelExport.setReportTitle(cs.getCorporateById(corporateId).toUpperCase() + " Bank Debit Memo"); excelExport.setExportFileName( cs.getCorporateById(corporateId).replace(",", " ").toUpperCase() + "-Bank-Debit-Memo-" + util.convertDateFormat(payrollDateField.getValue().toString()) + ".xls"); excelExport.export(); } }); h.addComponent(exportTableToExcel); h.setComponentAlignment(exportTableToExcel, Alignment.BOTTOM_LEFT); h.setExpandRatio(exportTableToExcel, 2); addComponent(h); addComponent(debitMemoTable); setExpandRatio(debitMemoTable, 2); }
From source file:com.openhris.payroll.contributions.HdmfUI.java
public HdmfUI(int branchId) { this.branchId = branchId; setSizeFull();//from w w w.j a v a 2 s .com setSpacing(true); setMargin(new MarginInfo(true, true, false, false)); HorizontalLayout h = new HorizontalLayout(); h.setWidth("100%"); h.setMargin(true); h.setSpacing(true); final PopupDateField payrollDateField = new HRISPopupDateField("Payroll Month and Year"); payrollDateField.setWidth("200px"); h.addComponent(payrollDateField); Button generateBtn = new Button("GENERATE HDMF SHARE"); generateBtn.setWidth("200px"); generateBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { tradeId = cs.getTradeIdByBranchId(getBranchId()); corporateId = cs.getCorporateIdByTradeId(tradeId); Date date = util.parsingDate(util.convertDateFormat(payrollDateField.getValue().toString())); Calendar c = Calendar.getInstance(); c.setTime(date); hdmfTable.setContainerDataSource( new HdmfDataContainer(corporateId, (1 + c.get(Calendar.MONTH)), c.get(Calendar.YEAR))); } }); h.addComponent(generateBtn); h.setComponentAlignment(generateBtn, Alignment.BOTTOM_LEFT); Button exportTableToExcel = new Button("EXPORT TO EXCEL"); exportTableToExcel.setWidth("200px"); exportTableToExcel.addListener(new Button.ClickListener() { private static final long serialVersionUID = -73954695086117200L; private ExcelExport excelExport; @Override public void buttonClick(Button.ClickEvent event) { excelExport = new ExcelExport(hdmfTable, "HDMF Remitance"); excelExport.excludeCollapsedColumns(); excelExport.setReportTitle(cs.getCorporateById(corporateId).toUpperCase() + " HDMF Remitances"); excelExport.setExportFileName( cs.getCorporateById(corporateId).replace(",", " ").toUpperCase() + "-HDMF-Remitance-" + util.convertDateFormat(payrollDateField.getValue().toString()) + ".xls"); excelExport.export(); } }); h.addComponent(exportTableToExcel); h.setComponentAlignment(exportTableToExcel, Alignment.BOTTOM_LEFT); h.setExpandRatio(exportTableToExcel, 2); addComponent(h); addComponent(hdmfTable); setExpandRatio(hdmfTable, 2); }
From source file:com.openhris.payroll.contributions.PhicUI.java
public PhicUI(int branchId) { this.branchId = branchId; setSizeFull();/*ww w. ja v a 2 s . c o m*/ setSpacing(true); setMargin(new MarginInfo(true, true, false, false)); HorizontalLayout h = new HorizontalLayout(); h.setWidth("100%"); h.setMargin(true); h.setSpacing(true); final PopupDateField payrollDateField = new HRISPopupDateField("Payroll Month and Year"); payrollDateField.setWidth("200px"); h.addComponent(payrollDateField); Button generateBtn = new Button("GENERATE PHIC SHARE"); generateBtn.setWidth("200px"); generateBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { tradeId = cs.getTradeIdByBranchId(getBranchId()); corporateId = cs.getCorporateIdByTradeId(tradeId); Date date = util.parsingDate(util.convertDateFormat(payrollDateField.getValue().toString())); Calendar c = Calendar.getInstance(); c.setTime(date); phicTable.setContainerDataSource( new PhicDataContainer(corporateId, (1 + c.get(Calendar.MONTH)), c.get(Calendar.YEAR))); } }); h.addComponent(generateBtn); h.setComponentAlignment(generateBtn, Alignment.BOTTOM_LEFT); Button exportTableToExcel = new Button("EXPORT TO EXCEL"); exportTableToExcel.setWidth("200px"); exportTableToExcel.addListener(new Button.ClickListener() { private static final long serialVersionUID = -73954695086117200L; private ExcelExport excelExport; @Override public void buttonClick(Button.ClickEvent event) { excelExport = new ExcelExport(phicTable, "PHIC Remitance"); excelExport.excludeCollapsedColumns(); excelExport.setReportTitle(cs.getCorporateById(corporateId).toUpperCase() + " PHIC Remitances"); excelExport.setExportFileName( cs.getCorporateById(corporateId).replace(",", " ").toUpperCase() + "-PHIC-Remitance-" + util.convertDateFormat(payrollDateField.getValue().toString()) + ".xls"); excelExport.export(); } }); h.addComponent(exportTableToExcel); h.setComponentAlignment(exportTableToExcel, Alignment.BOTTOM_LEFT); h.setExpandRatio(exportTableToExcel, 2); addComponent(h); addComponent(phicTable); setExpandRatio(phicTable, 2); }
From source file:com.openhris.payroll.contributions.SssUI.java
public SssUI(int branchId) { this.branchId = branchId; setSizeFull();/* w ww .j av a 2 s.c o m*/ setSpacing(true); setMargin(new MarginInfo(true, true, false, false)); HorizontalLayout h = new HorizontalLayout(); h.setWidth("100%"); h.setMargin(true); h.setSpacing(true); final PopupDateField payrollDateField = new HRISPopupDateField("Payroll Month and Year"); payrollDateField.setWidth("200px"); h.addComponent(payrollDateField); Button generateBtn = new Button("GENERATE SSS SHARE"); generateBtn.setWidth("200px"); generateBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { tradeId = cs.getTradeIdByBranchId(getBranchId()); corporateId = cs.getCorporateIdByTradeId(tradeId); Date date = util.parsingDate(util.convertDateFormat(payrollDateField.getValue().toString())); Calendar c = Calendar.getInstance(); c.setTime(date); sssTable.setContainerDataSource( new SssDataContainer(corporateId, (1 + c.get(Calendar.MONTH)), c.get(Calendar.YEAR))); } }); h.addComponent(generateBtn); h.setComponentAlignment(generateBtn, Alignment.BOTTOM_LEFT); Button exportTableToExcel = new Button("EXPORT TO EXCEL"); exportTableToExcel.setWidth("200px"); exportTableToExcel.addListener(new Button.ClickListener() { private static final long serialVersionUID = -73954695086117200L; private ExcelExport excelExport; @Override public void buttonClick(Button.ClickEvent event) { excelExport = new ExcelExport(sssTable, "SSS Remitance"); excelExport.excludeCollapsedColumns(); excelExport.setReportTitle(cs.getCorporateById(corporateId).toUpperCase() + " SSS Remitances"); excelExport.setExportFileName( cs.getCorporateById(corporateId).replace(",", " ").toUpperCase() + "-SSS-Remitance-" + util.convertDateFormat(payrollDateField.getValue().toString()) + ".xls"); excelExport.export(); } }); h.addComponent(exportTableToExcel); h.setComponentAlignment(exportTableToExcel, Alignment.BOTTOM_LEFT); h.setExpandRatio(exportTableToExcel, 2); addComponent(h); addComponent(sssTable); setExpandRatio(sssTable, 2); }
From source file:com.openhris.payroll.contributions.TaxUI.java
public TaxUI(int branchId) { this.branchId = branchId; setSizeFull();//from ww w. j a v a2 s .c o m setSpacing(true); setMargin(new MarginInfo(true, true, false, false)); HorizontalLayout h = new HorizontalLayout(); h.setWidth("100%"); h.setMargin(true); h.setSpacing(true); final PopupDateField payrollDateField = new HRISPopupDateField("Payroll Month and Year"); payrollDateField.setWidth("200px"); h.addComponent(payrollDateField); Button generateBtn = new Button("GENERATE WITHHOLDING TAX"); generateBtn.setWidth("200px"); generateBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { tradeId = cs.getTradeIdByBranchId(getBranchId()); corporateId = cs.getCorporateIdByTradeId(tradeId); Date date = util.parsingDate(util.convertDateFormat(payrollDateField.getValue().toString())); Calendar c = Calendar.getInstance(); c.setTime(date); taxTable.setContainerDataSource(new TaxDataContainer(corporateId, util.parsingDate(util.convertDateFormat(payrollDateField.getValue().toString())))); } }); h.addComponent(generateBtn); h.setComponentAlignment(generateBtn, Alignment.BOTTOM_LEFT); Button exportTableToExcel = new Button("EXPORT TO EXCEL"); exportTableToExcel.setWidth("200px"); exportTableToExcel.addListener(new Button.ClickListener() { private static final long serialVersionUID = -73954695086117200L; private ExcelExport excelExport; @Override public void buttonClick(Button.ClickEvent event) { excelExport = new ExcelExport(taxTable, "TAX Remitance"); excelExport.excludeCollapsedColumns(); excelExport.setReportTitle(cs.getCorporateById(corporateId).toUpperCase() + " TAX Remitances"); excelExport.setExportFileName( cs.getCorporateById(corporateId).replace(",", " ").toUpperCase() + "-TAX-Remitance-" + util.convertDateFormat(payrollDateField.getValue().toString()) + ".xls"); excelExport.export(); } }); h.addComponent(exportTableToExcel); h.setComponentAlignment(exportTableToExcel, Alignment.BOTTOM_LEFT); h.setExpandRatio(exportTableToExcel, 2); addComponent(h); addComponent(taxTable); setExpandRatio(taxTable, 2); }
From source file:com.openhris.payroll.PayrollAdvancesLedgerUI.java
public PayrollAdvancesLedgerUI(int branchId) { this.branchId = branchId; setSpacing(false);/*from w w w. ja v a2 s. c o m*/ setMargin(false); setWidth("100%"); setHeight("100%"); setImmediate(true); final VerticalSplitPanel vsplit = new VerticalSplitPanel(); vsplit.setImmediate(true); vsplit.setMargin(false); vsplit.setSizeFull(); vsplit.setLocked(true); vsplit.setSplitPosition(90, Sizeable.UNITS_PIXELS); GridLayout glayout = new GridLayout(2, 1); glayout.setWidth("60%"); glayout.setMargin(true); glayout.setSpacing(true); employeeComboBox(getBranchId()); glayout.addComponent(employee, 0, 0); Button button = new Button(); button.setWidth("100%"); button.setCaption("Generate Ledger"); button.setEnabled(UserAccessControl.isPayroll()); button.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { System.out.println("employeeId: " + employee.getValue()); } }); glayout.addComponent(button, 1, 0); glayout.setComponentAlignment(button, Alignment.BOTTOM_LEFT); vsplit.setFirstComponent(glayout); addComponent(vsplit); setExpandRatio(vsplit, 1.0f); }