List of usage examples for com.vaadin.ui GridLayout GridLayout
public GridLayout(int columns, int rows)
From source file:com.openhris.employee.EmployeeAddress.java
public ComponentContainer layout() { glayout = new GridLayout(3, 3); glayout.setSpacing(true);//from ww w. jav a 2 s. co m glayout.setWidth("600px"); glayout.setHeight("100%"); addressType = dropDown.populateAddressType(new ComboBox()); addressType.setWidth("200px"); glayout.addComponent(addressType, 0, 0); streetField = createTextField("Street: "); streetField.setWidth("388px"); glayout.addComponent(streetField, 1, 0, 2, 0); cityField = createTextField("City/Town: "); cityField.setWidth("200px"); glayout.addComponent(cityField, 0, 1); provinceField = createTextField("Province: "); glayout.addComponent(provinceField, 1, 1); zipCodeField = createTextField("Zip Code: "); glayout.addComponent(zipCodeField, 2, 1); Button submitBtn = new Button("ADD/UPDATE"); submitBtn.setWidth("100%"); submitBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (getEmployeeId() == null) { getWindow().showNotification("You did not Select an Employee!", Window.Notification.TYPE_WARNING_MESSAGE); return; } if (addressType.getValue() == null) { getWindow().showNotification("Select Address type!", Window.Notification.TYPE_WARNING_MESSAGE); return; } if (streetField.getValue() == null || streetField.getValue().toString().trim().isEmpty() || cityField.getValue() == null || cityField.getValue().toString().trim().isEmpty()) { getWindow().showNotification("Street/City/Town is Required!", Window.Notification.TYPE_WARNING_MESSAGE); return; } Address address = new Address(); address.setAddressId(classAddressId); address.setEmployeeId(getEmployeeId()); if (util.checkInputIfInteger(addressType.getValue().toString())) { address.setType(addressType.getItemCaption(addressTypeId)); } else { address.setType(addressType.getValue().toString().trim().toLowerCase()); } address.setStreet(streetField.getValue().toString().trim().toLowerCase()); address.setCity(cityField.getValue().toString().trim().toLowerCase()); address.setProvince((provinceField.getValue() == null) ? " " : provinceField.getValue().toString().trim().toLowerCase()); address.setZipcode((zipCodeField.getValue() == null) ? " " : zipCodeField.getValue().toString().trim().toLowerCase()); boolean result = eaService.insertEmployeeAddress(address); if (result) { employeeAddressTable(); clearFields(); } else { getWindow().showNotification("Error on Employee Address SQL", Window.Notification.TYPE_ERROR_MESSAGE); } } }); glayout.addComponent(submitBtn, 1, 2, 2, 2); return glayout; }
From source file:com.openhris.employee.EmployeeCharacterReference.java
public ComponentContainer layout() { glayout = new GridLayout(3, 3); glayout.setCaption("Character References"); glayout.setSpacing(true);// w ww. ja va 2 s. c o m glayout.setSizeFull(); nameField = createTextField("Name: "); glayout.addComponent(nameField, 0, 0); occupationField = createTextField("Occupation: "); glayout.addComponent(occupationField, 1, 0); contactNoField = createTextField("Contact No: "); glayout.addComponent(contactNoField, 2, 0); addressField = createTextField("Address: "); glayout.addComponent(addressField, 0, 1, 1, 1); Button addReferenceBtn = new Button("Add/Update Reference: "); addReferenceBtn.setWidth("100%"); addReferenceBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (nameField.getValue() == null || nameField.getValue().toString().trim().isEmpty()) { getWindow().showNotification("Enter Name of Reference!", Window.Notification.TYPE_WARNING_MESSAGE); return; } if (occupationField.getValue() == null || occupationField.getValue().toString().trim().isEmpty()) { getWindow().showNotification("Enter Occuation of Reference!", Window.Notification.TYPE_WARNING_MESSAGE); return; } if (contactNoField.getValue() == null || contactNoField.getValue().toString().trim().isEmpty()) { getWindow().showNotification("Enter Contact No of Reference!", Window.Notification.TYPE_WARNING_MESSAGE); return; } if (addressField.getValue() == null || addressField.getValue().toString().trim().isEmpty()) { getWindow().showNotification("Enter Address of Reference!", Window.Notification.TYPE_WARNING_MESSAGE); return; } CharacterReference charRef = new CharacterReference(); charRef.setCharacterReferenceId(classCharacterRefId); charRef.setEmployeeId(getEmployeeId()); charRef.setName(nameField.getValue().toString().trim().toLowerCase()); charRef.setOccupation(occupationField.getValue().toString().trim().toLowerCase()); charRef.setContactNo(contactNoField.getValue().toString().trim().toLowerCase()); charRef.setAddress(addressField.getValue().toString().trim().toLowerCase()); boolean result = charRefService.updateEmployeeCharacterReference(charRef); if (result) { characterReferenceTable(); clearFields(); } else { getWindow().showNotification("Error on Character Reference SQL, Contact your DBA!", Window.Notification.TYPE_ERROR_MESSAGE); } } }); glayout.addComponent(addReferenceBtn); glayout.setComponentAlignment(addReferenceBtn, Alignment.BOTTOM_CENTER); return glayout; }
From source file:com.openhris.employee.EmployeePersonalInformation.java
public ComponentContainer layout() { glayout = new GridLayout(4, 19); glayout.setSpacing(true);//from ww w. ja v a 2s . c o m glayout.setWidth("600px"); glayout.setHeight("100%"); final Panel imagePanel = new Panel(); imagePanel.setStyleName("light"); AbstractLayout panelLayout = (AbstractLayout) imagePanel.getContent(); panelLayout.setMargin(false); imagePanel.setWidth("100px"); avatar = new Embedded(null, new ThemeResource("../myTheme/img/fnc.jpg")); avatar.setImmediate(true); avatar.setWidth(90, Sizeable.UNITS_PIXELS); avatar.setHeight(90, Sizeable.UNITS_PIXELS); avatar.addStyleName("logo-img"); imagePanel.addComponent(avatar); glayout.addComponent(avatar, 0, 0, 0, 1); glayout.setComponentAlignment(imagePanel, Alignment.MIDDLE_CENTER); Button uploadPhotoBtn = new Button("Upload.."); uploadPhotoBtn.setWidth("100%"); uploadPhotoBtn.setStyleName(Reindeer.BUTTON_SMALL); uploadPhotoBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (getEmployeeId() == null) { getWindow().showNotification("You did not select and Employee!", Window.Notification.TYPE_WARNING_MESSAGE); return; } Window uploadImage = new UploadImage(imagePanel, avatar, getEmployeeId()); uploadImage.setWidth("450px"); if (uploadImage.getParent() == null) { getWindow().addWindow(uploadImage); } uploadImage.setModal(true); uploadImage.center(); } }); glayout.addComponent(uploadPhotoBtn, 0, 2); glayout.setComponentAlignment(uploadPhotoBtn, Alignment.MIDDLE_CENTER); fnField = createTextField("Firstname: "); glayout.addComponent(fnField, 1, 0); glayout.setComponentAlignment(fnField, Alignment.MIDDLE_LEFT); mnField = createTextField("Middlename: "); glayout.addComponent(mnField, 2, 0); glayout.setComponentAlignment(mnField, Alignment.MIDDLE_LEFT); lnField = createTextField("Lastname: "); glayout.addComponent(lnField, 3, 0); glayout.setComponentAlignment(lnField, Alignment.MIDDLE_LEFT); companyIdField = createTextField("Employee ID: "); companyIdField.setEnabled(false); glayout.addComponent(companyIdField, 1, 1, 2, 1); glayout.setComponentAlignment(companyIdField, Alignment.MIDDLE_LEFT); dobField = new PopupDateField("Date of Birth: "); dobField.addStyleName("mydate"); dobField.setDateFormat("MM/dd/yyyy"); dobField.setWidth("100%"); dobField.setResolution(DateField.RESOLUTION_DAY); glayout.addComponent(dobField, 1, 2); glayout.setComponentAlignment(dobField, Alignment.MIDDLE_LEFT); pobField = createTextField("Birth Place: "); pobField.setValue("N/A"); glayout.addComponent(pobField, 2, 2, 3, 2); glayout.setComponentAlignment(pobField, Alignment.MIDDLE_LEFT); genderBox = dropDownComponent.populateGenderList(new ComboBox()); genderBox.setWidth("100%"); glayout.addComponent(genderBox, 1, 3); glayout.setComponentAlignment(genderBox, Alignment.MIDDLE_LEFT); civilStatusBox = dropDownComponent.populateCivilStatusList(new ComboBox()); civilStatusBox.setWidth("100%"); glayout.addComponent(civilStatusBox, 2, 3); glayout.setComponentAlignment(civilStatusBox, Alignment.MIDDLE_LEFT); citizenshipField = createTextField("Citizenship: "); citizenshipField.setValue("N/A"); glayout.addComponent(citizenshipField, 3, 3); glayout.setComponentAlignment(citizenshipField, Alignment.MIDDLE_LEFT); heightField = createTextField("Height(cm):"); heightField.setValue(0.0); glayout.addComponent(heightField, 1, 4); glayout.setComponentAlignment(heightField, Alignment.MIDDLE_LEFT); weightField = createTextField("Weight(kg): "); weightField.setValue(0.0); glayout.addComponent(weightField, 2, 4); glayout.setComponentAlignment(weightField, Alignment.MIDDLE_LEFT); religionField = createTextField("Religion: "); religionField.setValue("N/A"); glayout.addComponent(religionField, 3, 4); glayout.setComponentAlignment(religionField, Alignment.MIDDLE_LEFT); spouseNameField = createTextField("Spouse Name: "); spouseNameField.setValue("N/A"); glayout.addComponent(spouseNameField, 1, 5, 2, 5); glayout.setComponentAlignment(spouseNameField, Alignment.MIDDLE_LEFT); spouseOccupationField = createTextField("Spouse Occupation: "); spouseOccupationField.setValue("N/A"); glayout.addComponent(spouseOccupationField, 3, 5); glayout.setComponentAlignment(spouseOccupationField, Alignment.MIDDLE_LEFT); spouseOfficeAddressField = createTextField("Spouse Office Address: "); spouseOfficeAddressField.setValue("N/A"); glayout.addComponent(spouseOfficeAddressField, 1, 6, 3, 6); glayout.setComponentAlignment(spouseOfficeAddressField, Alignment.MIDDLE_LEFT); fathersNameField = createTextField("Father's Name: "); fathersNameField.setValue("N/A"); glayout.addComponent(fathersNameField, 1, 7, 2, 7); glayout.setComponentAlignment(fathersNameField, Alignment.MIDDLE_LEFT); fathersOccupationField = createTextField("Father's Occupation: "); fathersOccupationField.setValue("N/A"); glayout.addComponent(fathersOccupationField, 3, 7); glayout.setComponentAlignment(fathersOccupationField, Alignment.MIDDLE_LEFT); mothersNameField = createTextField("Mother's Maiden Name: "); mothersNameField.setValue("N/A"); glayout.addComponent(mothersNameField, 1, 8, 2, 8); glayout.setComponentAlignment(mothersNameField, Alignment.MIDDLE_LEFT); mothersOccupationField = createTextField("Mother's Occupation: "); mothersOccupationField.setValue("N/A"); glayout.addComponent(mothersOccupationField, 3, 8); glayout.setComponentAlignment(mothersOccupationField, Alignment.MIDDLE_LEFT); parentsAddressField = createTextField("Parents Address"); parentsAddressField.setValue("N/A"); glayout.addComponent(parentsAddressField, 1, 9, 3, 9); glayout.setComponentAlignment(parentsAddressField, Alignment.MIDDLE_LEFT); dialectSpeakWriteField = createTextField("Language or Dialect you can speak or write: "); dialectSpeakWriteField.setValue("N/A"); glayout.addComponent(dialectSpeakWriteField, 1, 10, 3, 10); glayout.setComponentAlignment(dialectSpeakWriteField, Alignment.MIDDLE_LEFT); contactPersonNameField = createTextField("Contact Person: "); contactPersonNameField.setValue("N/A"); glayout.addComponent(contactPersonNameField, 1, 11); glayout.setComponentAlignment(contactPersonNameField, Alignment.MIDDLE_LEFT); contactPersonAddressField = createTextField("Contact Person's Address: "); contactPersonAddressField.setValue("N/A"); glayout.addComponent(contactPersonAddressField, 2, 11, 3, 11); glayout.setComponentAlignment(contactPersonAddressField, Alignment.MIDDLE_LEFT); contactPersonNoField = createTextField("Contact Person's Tel No: "); contactPersonNoField.setValue("N/A"); glayout.addComponent(contactPersonNoField, 1, 12); glayout.setComponentAlignment(contactPersonNoField, Alignment.MIDDLE_LEFT); skillsField = createTextField("Skills: "); skillsField.setValue("N/A"); glayout.addComponent(skillsField, 2, 12); glayout.setComponentAlignment(skillsField, Alignment.MIDDLE_LEFT); hobbyField = createTextField("Hobbies"); hobbyField.setValue("N/A"); glayout.addComponent(hobbyField, 3, 12); glayout.setComponentAlignment(hobbyField, Alignment.MIDDLE_LEFT); if (employeeId != null) { personalInformation = piService.getPersonalInformationData(employeeId); final byte[] image = personalInformation.getImage(); if (image != null) { StreamResource.StreamSource imageSource = new StreamResource.StreamSource() { @Override public InputStream getStream() { return new ByteArrayInputStream(image); } }; StreamResource imageResource = new StreamResource(imageSource, personalInformation.getFirstname() + ".jpg", getThisApplication()); imageResource.setCacheTime(0); avatar.setSource(imageResource); } fnField.setValue(personalInformation.getFirstname().toUpperCase()); mnField.setValue(personalInformation.getMiddlename().toUpperCase()); lnField.setValue(personalInformation.getLastname().toUpperCase()); companyIdField.setValue(employeeId); dobField.setValue(personalInformation.getDob()); pobField.setValue(personalInformation.getPob()); if (personalInformation.getCivilStatus() != null) { Object civilStatusId = civilStatusBox.addItem(); civilStatusBox.setItemCaption(civilStatusId, personalInformation.getCivilStatus()); civilStatusBox.setValue(civilStatusId); } if (personalInformation.getGender() != null) { Object genderId = genderBox.addItem(); genderBox.setItemCaption(genderId, personalInformation.getGender()); genderBox.setValue(genderId); } citizenshipField.setValue(personalInformation.getCitizenship()); heightField.setValue(personalInformation.getHeight()); weightField.setValue(personalInformation.getWeight()); religionField.setValue(personalInformation.getReligion()); spouseNameField.setValue(personalInformation.getSpouseName()); spouseOccupationField.setValue(personalInformation.getSpouseOccupation()); spouseOfficeAddressField.setValue(personalInformation.getSpouseOfficeAddress()); fathersNameField.setValue(personalInformation.getFathersName()); fathersOccupationField.setValue(personalInformation.getFathersOccupation()); mothersNameField.setValue(personalInformation.getMothersName()); mothersOccupationField.setValue(personalInformation.getMothersOccupation()); parentsAddressField.setValue(personalInformation.getParentsAddress()); dialectSpeakWriteField.setValue(personalInformation.getDialectSpeakWrite()); contactPersonNameField.setValue(personalInformation.getContactPersonName()); contactPersonAddressField.setValue(personalInformation.getContactPersonAddress()); contactPersonNoField.setValue(personalInformation.getContactPersonNo()); skillsField.setValue(personalInformation.getSkills()); hobbyField.setValue(personalInformation.getHobby()); } Button removeBtn = new Button("REMOVE EMPLOYEE"); removeBtn.setWidth("100%"); boolean visible = false; if (GlobalVariables.getUserRole() == null) { visible = false; } else if (GlobalVariables.getUserRole().equals("hr") || GlobalVariables.getUserRole().equals("administrator")) { visible = true; } removeBtn.setVisible(visible); removeBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (!GlobalVariables.getUserRole().equals("administrator")) { getWindow().showNotification("You need to an ADMINISTRATOR to perform this ACTION.", Window.Notification.TYPE_WARNING_MESSAGE); return; } Window window = getRemoveWindow(getEmployeeId()); window.setModal(true); if (window.getParent() == null) { getWindow().addWindow(window); } window.center(); } }); glayout.addComponent(removeBtn, 1, 13); Button saveButton = new Button("UPDATE EMPLOYEE's INFORMATION"); saveButton.setWidth("100%"); saveButton.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (dobField.getValue() == null || dobField.getValue().toString().isEmpty()) { getWindow().showNotification("Date of Birth Required!", Window.Notification.TYPE_ERROR_MESSAGE); return; } if (heightField.getValue() == null || heightField.getValue().toString().isEmpty()) { getWindow().showNotification("Null/Empty Value for Height is not ALLOWED!", Window.Notification.TYPE_ERROR_MESSAGE); return; } else { if (!convertionUtilities.checkInputIfDouble(heightField.getValue().toString())) { getWindow().showNotification("Enter a numeric format for Height!", Window.Notification.TYPE_ERROR_MESSAGE); return; } } if (weightField.getValue() == null || weightField.getValue().toString().isEmpty()) { getWindow().showNotification("Null/Empty Value for Weight is not ALLOWED!", Window.Notification.TYPE_ERROR_MESSAGE); return; } else { if (!convertionUtilities.checkInputIfDouble(weightField.getValue().toString())) { getWindow().showNotification("Enter a numeric format for Weight!", Window.Notification.TYPE_ERROR_MESSAGE); return; } } if (genderBox.getValue() == null || genderBox.getValue().toString().isEmpty()) { getWindow().showNotification("Select a Gender!", Window.Notification.TYPE_ERROR_MESSAGE); return; } if (civilStatusBox.getValue() == null || civilStatusBox.getValue().toString().isEmpty()) { getWindow().showNotification("Select Civil Status!", Window.Notification.TYPE_ERROR_MESSAGE); return; } PersonalInformation pi = new PersonalInformation(); pi.setFirstname(fnField.getValue().toString().toLowerCase().trim()); pi.setMiddlename(mnField.getValue().toString().toLowerCase().trim()); pi.setLastname(lnField.getValue().toString().toLowerCase().trim()); pi.setEmployeeId(employeeId); pi.setDob((Date) dobField.getValue()); pi.setPob((pobField.getValue() == null) ? "N/A" : pobField.getValue().toString().toLowerCase().trim()); pi.setHeight(convertionUtilities.convertStringToDouble(heightField.getValue().toString())); pi.setWeight(convertionUtilities.convertStringToDouble(weightField.getValue().toString())); if (convertionUtilities.checkInputIfInteger(genderBox.getValue().toString())) { pi.setGender(genderBox.getItemCaption(genderBox.getValue())); } else { pi.setGender(genderBox.getValue().toString()); } if (convertionUtilities.checkInputIfInteger(civilStatusBox.getValue().toString())) { pi.setCivilStatus(civilStatusBox.getItemCaption(civilStatusBox.getValue())); } else { pi.setCivilStatus(civilStatusBox.getValue().toString()); } pi.setCitizenship( (citizenshipField.getValue() == null) ? "N/A" : citizenshipField.getValue().toString()); pi.setReligion((religionField.getValue() == null) ? "N/A" : religionField.getValue().toString()); pi.setSpouseName( (spouseNameField.getValue() == null) ? "N/A" : spouseNameField.getValue().toString()); pi.setSpouseOccupation((spouseOccupationField.getValue() == null) ? "N/A" : spouseOccupationField.getValue().toString()); pi.setSpouseOfficeAddress((spouseOfficeAddressField.getValue() == null) ? "N/A" : spouseOfficeAddressField.getValue().toString()); pi.setFathersName( (fathersNameField.getValue() == null) ? "N/A" : fathersNameField.getValue().toString()); pi.setFathersOccupation((fathersOccupationField.getValue() == null) ? "N/A" : fathersOccupationField.getValue().toString()); pi.setMothersName( (mothersNameField.getValue() == null) ? "N/A" : mothersNameField.getValue().toString()); pi.setMothersOccupation((mothersOccupationField.getValue() == null) ? "N/A" : mothersOccupationField.getValue().toString()); pi.setParentsAddress((parentsAddressField.getValue() == null) ? "N/A" : parentsAddressField.getValue().toString()); pi.setDialectSpeakWrite((dialectSpeakWriteField.getValue() == null) ? "N/A" : dialectSpeakWriteField.getValue().toString()); pi.setContactPersonName((contactPersonNameField.getValue() == null) ? "N/A" : contactPersonNameField.getValue().toString()); pi.setContactPersonAddress((contactPersonAddressField.getValue() == null) ? "N/A" : contactPersonAddressField.getValue().toString()); pi.setContactPersonNo((contactPersonNoField.getValue() == null) ? "N/A" : contactPersonNoField.getValue().toString()); pi.setSkills((skillsField.getValue() == null) ? "N/A" : skillsField.getValue().toString()); pi.setHobby((hobbyField.getValue() == null) ? "N/A" : hobbyField.getValue().toString()); pi.setEmployeeId(getEmployeeId()); // boolean result = piService.updatePersonalInformation(pi, "UPDATE PERSONAL INFORMATION"); Window window = updatePersonalInformationConfirmation(pi); window.setModal(true); if (window.getParent() == null) { getWindow().addWindow(window); } window.center(); // if(result){ // getWindow().showNotification("Information Updated", Window.Notification.TYPE_TRAY_NOTIFICATION); // } else { // getWindow().showNotification("SQL Error", Window.Notification.TYPE_ERROR_MESSAGE); // } } }); if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) { saveButton.setEnabled(true); } else { saveButton.setEnabled(false); } glayout.addComponent(saveButton, 2, 13, 3, 13); glayout.setColumnExpandRatio(1, .10f); glayout.setColumnExpandRatio(2, .10f); glayout.setColumnExpandRatio(3, .10f); return glayout; }
From source file:com.openhris.employee.NewEmployeeWindow.java
public NewEmployeeWindow(String employeeId) { this.employeeId = employeeId; setCaption("New Employee"); setWidth("535px"); errorLabel.setVisible(false);/* w ww . j a v 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 va 2 s . 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 layout() { glayout = new GridLayout(3, 3); glayout.setSpacing(true);//from w w w . ja va 2s . co m glayout.setWidth("100%"); glayout.setHeight("100%"); corporate = dropDown.populateCorporateComboBox(new ComboBox()); corporate.setWidth("250px"); glayout.addComponent(corporate, 0, 0); trade = new ComboBox("Trade: "); trade.setWidth("200px"); corporate.addListener(corporateListener); glayout.addComponent(trade, 1, 0); branch = new ComboBox("Branch: "); branch.setWidth("180px"); trade.addListener(tradeListener); branch.addListener(branchListener); glayout.addComponent(branch, 2, 0); department = new HRISTextField("Department: "); glayout.addComponent(department, 0, 1); position = new HRISTextField("Position: "); glayout.addComponent(position, 1, 1); entryDate = new HRISPopupDateField("Entry Date:"); entryDate.setDateFormat("MM/dd/yyyy"); glayout.addComponent(entryDate, 2, 1); newPositionBtn.addListener(newBtnPositionListener); newPositionBtn.setValue(true); newPositionBtn.setImmediate(true); glayout.addComponent(newPositionBtn, 0, 2); if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) { newPositionBtn.setEnabled(true); } else { newPositionBtn.setEnabled(false); } updateBtn = new Button(); updateBtn.setCaption(BTN_CAPTION_1); updateBtn.setWidth("100%"); updateBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (corporate.getValue() == null) { getWindow().showNotification("Select a Company!", Window.Notification.TYPE_WARNING_MESSAGE); return; } if (trade.getValue() == null) { getWindow().showNotification("Select a Trade!", Window.Notification.TYPE_WARNING_MESSAGE); return; } if (branch.getValue() == null) { getWindow().showNotification("Select a Branch!", Window.Notification.TYPE_WARNING_MESSAGE); return; } if (department.getValue() == null || department.getValue().toString().isEmpty()) { getWindow().showNotification("Add a Department!", Window.Notification.TYPE_WARNING_MESSAGE); return; } if (position.getValue() == null || position.getValue().toString().isEmpty()) { getWindow().showNotification("Add a Position!", Window.Notification.TYPE_WARNING_MESSAGE); return; } if (entryDate.getValue() == null || entryDate.getValue().toString().isEmpty()) { getWindow().showNotification("Add an Entry Date!", Window.Notification.TYPE_WARNING_MESSAGE); return; } PostEmploymentInformationBean positionHistory = new PostEmploymentInformationBean(); positionHistory.setPosition(position.getValue().toString().toLowerCase()); if (utilities.checkInputIfInteger(corporate.getValue().toString())) { positionHistory.setCompany(corporate.getItemCaption(corporate.getValue())); } else { positionHistory.setCompany(corporate.getValue().toString()); } if (utilities.checkInputIfInteger(trade.getValue().toString())) { positionHistory.setTrade(trade.getItemCaption(trade.getValue())); } else { positionHistory.setTrade(trade.getValue().toString()); } if (utilities.checkInputIfInteger(branch.getValue().toString())) { positionHistory.setBranch(branch.getItemCaption(branch.getValue())); } else { positionHistory.setBranch(branch.getValue().toString()); } positionHistory.setDepartment(department.getValue().toString().toLowerCase()); positionHistory.setEntryDate((Date) entryDate.getValue()); if (getBranchId() == 0) { corporateId = companyService.getCorporateId(positionHistory.getCompany()); tradeId = companyService.getTradeId(positionHistory.getTrade(), corporateId); branchId = companyService.getBranchId(tradeId, positionHistory.getBranch()); } positionHistory.setBranchId(getBranchId()); positionHistory.setPositionId(getPositionId()); if (updateBtn.getCaption().equals("EDIT") && getPositionId() == 0) { getWindow().showNotification("Select a row from the table to EDIT."); return; } if (updateBtn.getCaption().equals("EDIT")) { isEdit = true; } else { isEdit = false; } boolean result = positionHistoryService.updatePositionHistory(getEmployeeId(), positionHistory, isEdit, getPositionId()); if (result) { positionHistoryTable(); getWindow().showNotification("Position has been updated.", Window.Notification.TYPE_TRAY_NOTIFICATION); } else { getWindow().showNotification("Error on Position History SQL", Window.Notification.TYPE_ERROR_MESSAGE); } } }); if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) { updateBtn.setEnabled(true); } else { updateBtn.setEnabled(false); } glayout.addComponent(updateBtn, 1, 2, 2, 2); return glayout; }
From source file:com.openhris.employee.PostEmploymentInfomation.java
public ComponentContainer layout2() { HorizontalLayout hlayout = new HorizontalLayout(); hlayout.setSpacing(true);//from ww w . j a v a 2 s . c o m 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.salary.EmployeeSalaryInformation.java
public ComponentContainer layout() { GridLayout glayout = new GridLayout(2, 8); glayout.setSpacing(true);// ww w . j a v a2s.c om 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);/*from w ww . j a v a2 s . c o m*/ 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.payroll.PayrollAdvancesLedgerUI.java
public PayrollAdvancesLedgerUI(int branchId) { this.branchId = branchId; setSpacing(false);/*from w w w.j ava 2 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); }