List of usage examples for com.vaadin.ui Button setWidth
@Override public void setWidth(String width)
From source file:com.openhris.employee.EmployeePersonalInformation.java
private Window updatePersonalInformationConfirmation(final PersonalInformation pi) { VerticalLayout vlayout = new VerticalLayout(); vlayout.setSpacing(true);/*from w ww . j a va 2 s. c om*/ vlayout.setMargin(true); final Window window = new Window("UPDATE WINDOW", vlayout); window.setWidth("350px"); final TextArea remarks = new TextArea("Remarks"); remarks.setWidth("100%"); remarks.setRows(3); window.addComponent(remarks); Button removeBtn = new Button("UPDATE EMPLOYEE?"); removeBtn.setWidth("100%"); removeBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (remarks.getValue() == null || remarks.getValue().toString().trim().isEmpty()) { getWindow().showNotification("Add remarks!", Window.Notification.TYPE_ERROR_MESSAGE); return; } boolean result = piService.updatePersonalInformation(pi, remarks.getValue().toString().trim()); if (result) { getWindow().showNotification("Information Updated", Window.Notification.TYPE_TRAY_NOTIFICATION); (window.getParent()).removeWindow(window); } else { getWindow().showNotification("SQL Error", Window.Notification.TYPE_ERROR_MESSAGE); } } }); window.addComponent(removeBtn); return window; }
From source file:com.openhris.employee.EmployeeSummaryUI.java
public EmployeeSummaryUI(int branchId) { this.branchId = branchId; setSizeFull();/* w w w. ja v a 2 s. c om*/ setSpacing(true); setMargin(new MarginInfo(true, true, false, false)); HorizontalLayout h = new HorizontalLayout(); h.setWidth("100%"); h.setMargin(true); h.setSpacing(true); final ComboBox employeeStatus = new ComboBox("Status: "); employeeStatus.setWidth("150px"); employeeStatus.setNullSelectionAllowed(false); employeeStatus.addItem("employed"); employeeStatus.addItem("resigned"); h.addComponent(employeeStatus); Button generateBtn = new Button("GENERATE EMPLOYEE SUMMARY"); generateBtn.setWidth("250px"); generateBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (employeeStatus.getValue() == null) { getWindow().showNotification("Employee Status!", Window.Notification.TYPE_WARNING_MESSAGE); return; } tradeId = cs.getTradeIdByBranchId(getBranchId()); corporateId = cs.getCorporateIdByTradeId(tradeId); summary.setContainerDataSource( new EmployeeSummaryDataContainer(corporateId, employeeStatus.getValue().toString())); } }); h.addComponent(generateBtn); h.setComponentAlignment(generateBtn, Alignment.BOTTOM_LEFT); Button exportTableToExcel = new Button("EXPORT TO EXCEL"); exportTableToExcel.setWidth("250px"); exportTableToExcel.addListener(new Button.ClickListener() { private static final long serialVersionUID = -73954695086117200L; private ExcelExport excelExport; @Override public void buttonClick(Button.ClickEvent event) { excelExport = new ExcelExport(summary, "EMPLOYEE SUMMARY"); excelExport.excludeCollapsedColumns(); excelExport.setReportTitle(cs.getCorporateById(corporateId).toUpperCase() + " Employee Summary"); excelExport.setExportFileName(cs.getCorporateById(corporateId).replace(",", " ").toUpperCase() + "-Employee-Summary-" + ".xls"); excelExport.export(); } }); h.addComponent(exportTableToExcel); h.setComponentAlignment(exportTableToExcel, Alignment.BOTTOM_LEFT); h.setExpandRatio(exportTableToExcel, 3); addComponent(h); addComponent(summary); setExpandRatio(summary, 2); }
From source file:com.openhris.employee.NewEmployeeWindow.java
public NewEmployeeWindow(String employeeId) { this.employeeId = employeeId; setCaption("New Employee"); setWidth("535px"); errorLabel.setVisible(false);//w w w . jav a 2 s .c o m GridLayout grid = new GridLayout(3, 9); grid.setSpacing(true); grid.setSizeFull(); final TextField firstname = new HRISTextField("Firstname:"); grid.addComponent(firstname, 0, 0); final TextField middlename = new HRISTextField("Middlename:"); grid.addComponent(middlename, 1, 0); final TextField lastname = new HRISTextField("Lastname:"); grid.addComponent(lastname, 2, 0); corporation = dropDown.populateCorporateComboBox(new ComboBox()); grid.addComponent(corporation, 0, 1, 1, 1); final PopupDateField entryDate = new HRISPopupDateField("Entry Date:"); grid.addComponent(entryDate, 2, 1); trade = new ComboBox("Trade: "); trade.setWidth("100%"); corporation.addListener(corporateListener); grid.addComponent(trade, 0, 2, 1, 2); final ComboBox dependent = dropDown.populateTotalDependent("Employee's Dependent"); grid.addComponent(dependent, 2, 2); branch = new ComboBox("Branch: "); branch.setWidth("100%"); trade.addListener(tradeListener); branch.addListener(branchListener); grid.addComponent(branch, 0, 3, 1, 3); final TextField department = new HRISTextField("Department: "); grid.addComponent(department, 2, 3); final TextField position = new HRISTextField("Position: "); grid.addComponent(position, 0, 4); final TextField sssNo = new HRISTextField("SSS #:"); grid.addComponent(sssNo, 1, 4); final TextField hdmfNo = new HRISTextField("HDMF #: "); grid.addComponent(hdmfNo, 2, 4); final ComboBox employmentStatus = dropDown.populateEmploymentStatus("Employment Status: "); grid.addComponent(employmentStatus, 0, 5); final TextField tinNo = new HRISTextField("Tin #:"); grid.addComponent(tinNo, 1, 5); final TextField peicNo = new HRISTextField("Philhealth #"); grid.addComponent(peicNo, 2, 5); final TextField employmentWage = new HRISTextField("Employment Wage: "); employmentWage.setValue("0.0"); employmentWage.addListener(checkEntryIfDoubleListener); grid.addComponent(employmentWage, 0, 6); final ComboBox employmentWageStatus = dropDown.populateEmploymentWageStatus("Employment Wage Status: "); grid.addComponent(employmentWageStatus, 1, 6); final ComboBox employmentWageEntry = dropDown.populateEmploymentWageEntry("Employment Wage Entry: "); grid.addComponent(employmentWageEntry, 2, 6); Button saveButton = new Button("SAVE NEW EMPLOYEE"); saveButton.setWidth("100%"); saveButton.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { boolean resultQueryInsert, result1, result2, checkId; boolean checkResultForDuplicate; result1 = utilities.checkInputIfDouble(employmentWage.getValue().toString().trim()); if (corporation.getValue() == null) { getWindow().showNotification("Select Corporation!", Window.Notification.TYPE_ERROR_MESSAGE); return; } if (trade.getValue() == null) { getWindow().showNotification("Select Trade!", Window.Notification.TYPE_ERROR_MESSAGE); return; } if (branch.getValue() == null) { getWindow().showNotification("Select Branch!", Window.Notification.TYPE_ERROR_MESSAGE); return; } if (dependent.getValue() == null) { getWindow().showNotification("Select # of dependent!", Window.Notification.TYPE_ERROR_MESSAGE); return; } if (employmentStatus.getValue() == null) { getWindow().showNotification("Select Employment Status!", Window.Notification.TYPE_ERROR_MESSAGE); return; } if (employmentWageStatus.getValue() == null) { getWindow().showNotification("Select Employment Wage Status!", Window.Notification.TYPE_ERROR_MESSAGE); return; } if (employmentWageEntry.getValue() == null) { getWindow().showNotification("Select Employment Wage Entry!", Window.Notification.TYPE_ERROR_MESSAGE); return; } if (department.getValue() == null) { getWindow().showNotification("Select Department!", Window.Notification.TYPE_ERROR_MESSAGE); return; } if (result1 == false) { getWindow().showNotification("Invalid Input for EmploymentWage/EmploymentAllowanceEntry", Window.Notification.TYPE_ERROR_MESSAGE); return; } checkResultForDuplicate = employeeService.checkForDuplicateEmployee( firstname.getValue().toString().trim().toLowerCase(), middlename.getValue().toString().trim().toLowerCase(), lastname.getValue().toString().trim().toLowerCase()); if (checkResultForDuplicate) { try { errorLabel.setVisible(true); } catch (Exception e) { e.printStackTrace(System.out); } return; } int corporate_id = companyService.getCorporateId(corporation.getValue().toString()); int trade_id = companyService.getTradeId(trade.getValue().toString(), getCorporateId()); int branch_id = companyService.getBranchId(getTradeId(), branch.getValue().toString()); PostEmploymentInformationBean pe = new PostEmploymentInformationBean(); pe.setFirstname(firstname.getValue().toString().trim()); pe.setMiddlename(middlename.getValue().toString().trim()); pe.setLastname(lastname.getValue().toString().trim()); pe.setCompany(corporation.getValue().toString()); pe.setTrade(trade.getValue().toString()); pe.setBranch(branch.getValue().toString()); pe.setBranchId(branch_id); pe.setDepartment(department.getValue().toString().trim()); pe.setTotalDependent(dependent.getItem(dependent.getValue()).toString()); pe.setPosition(position.getValue().toString().trim()); pe.setEntryDate( utilities.parsingDate(utilities.convertDateFormat(entryDate.getValue().toString()))); pe.setSssNo(sssNo.getValue().toString().trim()); pe.setTinNo(tinNo.getValue().toString().trim()); pe.setPhicNo(peicNo.getValue().toString().trim()); pe.setHdmfNo(hdmfNo.getValue().toString().trim()); pe.setEmploymentStatus(employmentStatus.getItem(employmentStatus.getValue()).toString()); pe.setEmploymentWageStatus( employmentWageStatus.getItem(employmentWageStatus.getValue()).toString()); pe.setEmploymentWageEntry(employmentWageEntry.getItem(employmentWageEntry.getValue()).toString()); pe.setEmploymentWage(utilities.convertStringToDouble(employmentWage.getValue().toString().trim())); resultQueryInsert = employeeService.insertNewEmployee(pe); if (resultQueryInsert == true) { close(); } else { getWindow().showNotification("SQL ERROR!"); } } }); grid.addComponent(saveButton, 1, 7, 2, 7); grid.addComponent(errorLabel, 1, 8, 2, 8); addComponent(grid); }
From source file:com.openhris.employee.others.OtherInformation.java
Component component() { GridLayout glayout = new GridLayout(2, 13); glayout.setSpacing(true);//from ww w.j a v a 2s. c o m glayout.setWidth("600px"); glayout.setHeight("100%"); tinField = new HRISTextField("TIN: "); glayout.addComponent(tinField, 0, 0); Button tinBtn = new Button("UPDATE TIN NO."); tinBtn.setWidth("100%"); tinBtn.addListener(buttonClickListener); glayout.addComponent(tinBtn, 1, 0); glayout.setComponentAlignment(tinBtn, Alignment.BOTTOM_CENTER); if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) { tinBtn.setEnabled(true); } else { tinBtn.setEnabled(false); } glayout.addComponent(new Label("<HR>", Label.CONTENT_XHTML), 0, 1, 1, 1); employeeDependent = dropDown.populateTotalDependent("Employee's Dependent"); employeeDependent.setWidth("100%"); glayout.addComponent(employeeDependent, 0, 2); Button edBtn = new Button("UPDATE EMPLOYEE's DEPENDENT"); edBtn.setWidth("100%"); edBtn.addListener(buttonClickListener); glayout.addComponent(edBtn, 1, 2); glayout.setComponentAlignment(edBtn, Alignment.BOTTOM_CENTER); if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) { edBtn.setEnabled(true); } else { edBtn.setEnabled(false); } glayout.addComponent(new Label("<HR>", Label.CONTENT_XHTML), 0, 3, 1, 3); sssField = new HRISTextField("SSS: "); glayout.addComponent(sssField, 0, 4); Button sssbtn = new Button("UPDATE SSS NO."); sssbtn.setWidth("100%"); sssbtn.addListener(buttonClickListener); glayout.addComponent(sssbtn, 1, 4); glayout.setComponentAlignment(sssbtn, Alignment.BOTTOM_CENTER); if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) { sssbtn.setEnabled(true); } else { sssbtn.setEnabled(false); } glayout.addComponent(new Label("<HR>", Label.CONTENT_XHTML), 0, 5, 1, 5); phicField = new HRISTextField("Philhealth"); glayout.addComponent(phicField, 0, 6); Button phicBtn = new Button("UPDATE PHIC NO."); phicBtn.setWidth("100%"); phicBtn.addListener(buttonClickListener); glayout.addComponent(phicBtn, 1, 6); glayout.setComponentAlignment(phicBtn, Alignment.BOTTOM_CENTER); if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) { phicBtn.setEnabled(true); } else { phicBtn.setEnabled(false); } glayout.addComponent(new Label("<HR>", Label.CONTENT_XHTML), 0, 7, 1, 7); hdmfField = new HRISTextField("HDMF: "); glayout.addComponent(hdmfField, 0, 8); Button hdmfBtn = new Button("UPDATE HDMF NO."); hdmfBtn.setWidth("100%"); hdmfBtn.addListener(buttonClickListener); glayout.addComponent(hdmfBtn, 1, 8); glayout.setComponentAlignment(hdmfBtn, Alignment.BOTTOM_CENTER); if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) { hdmfBtn.setEnabled(true); } else { hdmfBtn.setEnabled(false); } glayout.addComponent(new Label("<HR>", Label.CONTENT_XHTML), 0, 9, 1, 9); bankAccountNo = new HRISTextField("Bank Account No: "); bankAccountNo.setImmediate(true); glayout.addComponent(bankAccountNo, 0, 10); Button bankAccountBtn = new Button("UPDATE BANK NO."); bankAccountBtn.setWidth("100%"); bankAccountBtn.addListener(buttonClickListener); glayout.addComponent(bankAccountBtn, 1, 10); glayout.setComponentAlignment(bankAccountBtn, Alignment.BOTTOM_CENTER); if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) { bankAccountBtn.setEnabled(true); } else { bankAccountBtn.setEnabled(false); } if (getEmployeeId() != null) { EmploymentInformation ei = si.getEmployeeSalaryInformation(getEmployeeId()); tinField.setValue(ei.getTinNo()); sssField.setValue(ei.getSssNo()); phicField.setValue(ei.getPhicNo()); hdmfField.setValue(ei.gethdmfNo()); bankAccountNo.setValue(ei.getBankAccountNo()); employeeDependent .setValue(Constant.getKeyByValue(Constant.MAP_CONSTANT_DEPENDENT, ei.getTotalDependent())); } return glayout; }
From source file:com.openhris.employee.PostEmploymentInfomation.java
public ComponentContainer layout2() { HorizontalLayout hlayout = new HorizontalLayout(); hlayout.setSpacing(true);/* w w w . j ava 2s.com*/ hlayout.setWidth("100%"); GridLayout glayout2 = new GridLayout(2, 2); glayout2.setSpacing(true); final PopupDateField endDate = new HRISPopupDateField("Exit Date: "); endDate.setWidth("250px"); endDate.setDateFormat("MM/dd/yyyy"); glayout2.addComponent(endDate, 0, 0); glayout2.setComponentAlignment(endDate, Alignment.BOTTOM_LEFT); Button endDateBtn = new Button("RESIGN"); endDateBtn.setWidth("150px"); endDateBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (endDate.getValue() == null || endDate.getValue().toString().trim().isEmpty()) { getWindow().showNotification("Enter End Date.", Window.Notification.TYPE_ERROR_MESSAGE); return; } Window window = new ConfirmResignWindow(getEmployeeId(), utilities.convertDateFormat(endDate.getValue().toString().trim().toLowerCase())); if (window.getParent() == null) { getWindow().addWindow(window); } } }); glayout2.addComponent(endDateBtn, 1, 0); glayout2.setComponentAlignment(endDateBtn, Alignment.BOTTOM_LEFT); if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) { endDateBtn.setEnabled(true); } else { endDateBtn.setEnabled(false); } hlayout.addComponent(glayout2); hlayout.setComponentAlignment(glayout2, Alignment.MIDDLE_RIGHT); final PopupDateField entryDateFromEmp = new HRISPopupDateField("Entry Date from Employment: "); entryDateFromEmp.setWidth("250px"); entryDateFromEmp.setDateFormat("MM/dd/yyyy"); entryDateFromEmp.setValue(utilities.parsingDate(employeeService.getEmploymentEntryDate(getEmployeeId()))); glayout2.addComponent(entryDateFromEmp, 0, 1); glayout2.setComponentAlignment(entryDateFromEmp, Alignment.BOTTOM_LEFT); Button entryDateFromEmpBtn = new Button("EDIT"); entryDateFromEmpBtn.setWidth("150px"); entryDateFromEmpBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (!GlobalVariables.getUserRole().equals("administrator")) { getWindow().showNotification( "You need to be an ADMINISTRATOR to EDIT date entry of employment.", Window.Notification.TYPE_ERROR_MESSAGE); return; } Window sub = new EditEmploymentDateEntryWindow(getEmployeeId(), utilities.convertDateFormat(entryDateFromEmp.getValue().toString())); if (sub.getParent() == null) { getWindow().addWindow(sub); } } }); glayout2.addComponent(entryDateFromEmpBtn, 1, 1); glayout2.setComponentAlignment(entryDateFromEmpBtn, Alignment.BOTTOM_LEFT); if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) { entryDateFromEmpBtn.setEnabled(true); } else { entryDateFromEmpBtn.setEnabled(false); } return hlayout; }
From source file:com.openhris.employee.RemovePositionWindow.java
public RemovePositionWindow(int id) { this.id = id; setCaption("REMOVE POSITION"); setWidth("300px"); VerticalLayout vlayout = new VerticalLayout(); vlayout.setSpacing(true);/*from w w w. jav a 2s . c o m*/ vlayout.setMargin(true); final Window window = new Window("REMOVE POSITION", vlayout); window.setWidth("300px"); Button removeBtn = new Button("Remove Position?"); removeBtn.setWidth("100%"); removeBtn.addListener(this); addComponent(removeBtn); }
From source file:com.openhris.employee.salary.EmployeeSalaryInformation.java
public ComponentContainer layout() { GridLayout glayout = new GridLayout(2, 8); glayout.setSpacing(true);// w w w . j a v a2 s . c o m glayout.setWidth("600px"); glayout.setHeight("100%"); employmentStatus = dropDown.populateEmploymentStatus("Employment Status: "); employmentStatus.setWidth("200px"); glayout.addComponent(employmentStatus, 0, 0); Button esBtn = new Button("UPDATE EMPLOYMENT STATUS"); esBtn.setWidth("100%"); glayout.addComponent(esBtn, 1, 0); esBtn.addListener(buttonClickListener); glayout.setColumnExpandRatio(1, 1); glayout.setComponentAlignment(esBtn, Alignment.BOTTOM_LEFT); if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) { esBtn.setEnabled(true); } else { esBtn.setEnabled(false); } glayout.addComponent(new Label("<HR>", Label.CONTENT_XHTML), 0, 2, 1, 2); employmentWageStatus = dropDown.populateEmploymentWageStatus("Employment Wage Status: "); employmentWageStatus.setWidth("200px"); glayout.addComponent(employmentWageStatus, 0, 3); Button ewsBtn = new Button("UPDATE EMPLOYMENT WAGE STATUS"); ewsBtn.setWidth("100%"); ewsBtn.addListener(buttonClickListener); glayout.addComponent(ewsBtn, 1, 3); glayout.setComponentAlignment(ewsBtn, Alignment.BOTTOM_LEFT); if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) { ewsBtn.setEnabled(true); } else { ewsBtn.setEnabled(false); } glayout.addComponent(new Label("<HR>", Label.CONTENT_XHTML), 0, 4, 1, 4); employmentWageEntry = dropDown.populateEmploymentWageEntry("Employment Wage Entry: "); employmentWageEntry.setWidth("200px"); glayout.addComponent(employmentWageEntry, 0, 5); Button eweBtn = new Button("UPDATE EMPLOYMENT WAGE ENTRY"); eweBtn.setWidth("100%"); glayout.addComponent(eweBtn, 1, 5); eweBtn.addListener(buttonClickListener); glayout.setComponentAlignment(eweBtn, Alignment.BOTTOM_LEFT); if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) { eweBtn.setEnabled(true); } else { eweBtn.setEnabled(false); } glayout.addComponent(new Label("<HR>", Label.CONTENT_XHTML), 0, 6, 1, 6); employmentWage = new TextField("Employment Wage"); employmentWage.setWidth("200px"); employmentWage.addStyleName("numerical"); glayout.addComponent(employmentWage, 0, 7); Button ewBtn = new Button("UPDATE EMPLOYMENT WAGE"); ewBtn.setWidth("100%"); glayout.addComponent(ewBtn, 1, 7); ewBtn.addListener(buttonClickListener); glayout.setComponentAlignment(ewBtn, Alignment.BOTTOM_LEFT); if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) { ewBtn.setEnabled(true); } else { ewBtn.setEnabled(false); } if (getEmployeeId() != null) { EmploymentInformation ei = si.getEmployeeSalaryInformation(getEmployeeId()); employmentStatus.setValue( Constant.getKeyByValue(Constant.MAP_CONSTANT_EMPLOYMENT_STATUS, ei.getEmploymentStatus())); employmentWageStatus.setValue(Constant.getKeyByValue(Constant.MAP_CONSTANT_EMPLOYMENT_WAGE_STATUS, ei.getEmploymentWageStatus())); employmentWageEntry.setValue(Constant.getKeyByValue(Constant.MAP_CONSTANT_EMPLOYMENT_WAGE_ENTRY, ei.getEmploymentWageEntry())); employmentWage.setValue(ei.getEmploymentWage()); } return glayout; }
From source file:com.openhris.employee.salary.EmployeeSalaryInformation.java
public ComponentContainer layout2() { GridLayout glayout = new GridLayout(2, 1); glayout.setSpacing(true);// w ww .ja v a 2s . c om glayout.setWidth("600px"); TextField employmentStatusField = new HRISTextField("Employment Status: "); employmentStatusField.setWidth("200px"); glayout.addComponent(employmentStatusField, 0, 0); Button setContributionBtn = new Button("SET EMPLOYEE'S CONTRIBUTIONS MAIN BRANCH"); setContributionBtn.setWidth("100%"); setContributionBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Window subWindow = setContributionMainBranch(); if (subWindow.getParent() == null) { getWindow().addWindow(subWindow); } subWindow.setModal(true); subWindow.center(); } }); glayout.addComponent(setContributionBtn, 1, 0); glayout.setColumnExpandRatio(1, 1); glayout.setComponentAlignment(setContributionBtn, Alignment.BOTTOM_CENTER); if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) { setContributionBtn.setEnabled(true); } else { setContributionBtn.setEnabled(false); } if (getEmployeeId() != null) { EmploymentInformation employmentInformation = si.getEmployeeSalaryInformation(getEmployeeId()); employmentStatusField.setValue(employmentInformation.getCurrentStatus().toUpperCase()); } employmentStatusField.setReadOnly(true); return glayout; }
From source file:com.openhris.employee.salary.EmployeeSalaryInformation.java
private Window setContributionMainBranch() { VerticalLayout vlayout = new VerticalLayout(); vlayout.setMargin(true);// w ww . j a v a 2s . c o m vlayout.setSpacing(true); final Window subWindow = new Window("Set Branch", vlayout); subWindow.setWidth("300px"); corporate = dropDown.populateCorporateComboBox(new ComboBox()); corporate.addListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (corporate.getValue() == null) { } else { corporateId = companyService.getCorporateId(corporate.getValue().toString()); trade = dropDown.populateTradeComboBox(trade, corporateId); } } }); corporate.setWidth("100%"); subWindow.addComponent(corporate); trade.addListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (trade.getValue() == null) { } else { tradeId = companyService.getTradeId(trade.getValue().toString(), corporateId); branch = dropDown.populateBranchComboBox(branch, tradeId, corporateId); } } }); trade.setWidth("100%"); subWindow.addComponent(trade); branch.setWidth("100%"); branch.addListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (branch.getValue() == null) { } else { branchId = companyService.getBranchId(tradeId, branch.getValue().toString()); } } }); subWindow.addComponent(branch); final ComboBox remarks = new ComboBox("Remarks"); remarks.setWidth("100%"); remarks.setNullSelectionItemId(false); remarks.addItem("Transfer to new Branch."); remarks.addItem("Wrong Entry"); subWindow.addComponent(remarks); Button updateBtn = new Button("SET BRANCH for CONTRIBUTION"); updateBtn.setWidth("100%"); updateBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (corporate.getValue() == null) { getWindow().showNotification("Select Corporation!", Window.Notification.TYPE_ERROR_MESSAGE); return; } if (trade.getValue() == null) { getWindow().showNotification("Select Trade!", Window.Notification.TYPE_ERROR_MESSAGE); return; } if (branch.getValue() == null) { getWindow().showNotification("Select Branch!", Window.Notification.TYPE_ERROR_MESSAGE); return; } if (remarks.getValue() == null) { getWindow().showNotification("Remarks required!", Window.Notification.TYPE_ERROR_MESSAGE); return; } boolean result = si.updateEmployeeContributionBranch(getEmployeeId(), branchId, remarks.getValue().toString(), corporateId); if (result) { getWindow().showNotification("Successfully transferred to new Branch!"); (subWindow.getParent()).removeWindow(subWindow); } else { getWindow().showNotification("SQL Error, Contact your DBA!"); (subWindow.getParent()).removeWindow(subWindow); } } }); subWindow.addComponent(updateBtn); return subWindow; }
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);/* www .j a va 2 s.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; }