List of usage examples for com.vaadin.ui GridLayout addComponent
public void addComponent(Component component, int column, int row) throws OverlapsException, OutOfBoundsException
From source file:com.etest.view.tq.TQCoverageWindow.java
FormLayout buildForms() { FormLayout form = new FormLayout(); form.setWidth("100%"); form.setMargin(true);// w w w. ja v a2 s . c om int itemNo = 1; Label caseTopic; Label stem; Map<Integer, Map<Integer, Integer>> tqCoverage = tq.getTQCoverage(getTQCoverageId()); for (Map.Entry<Integer, Map<Integer, Integer>> tqCases : tqCoverage.entrySet()) { Integer tqCaseId = tqCases.getKey(); caseTopic = new Label(); caseTopic.setValue(ccs.getCellCaseById(tqCaseId).getCaseTopic()); caseTopic.setContentMode(ContentMode.HTML); form.addComponent(caseTopic); Map<Integer, Integer> value = tqCases.getValue(); for (Map.Entry<Integer, Integer> itemIds : value.entrySet()) { Integer itemId = itemIds.getKey(); Integer itemKeyId = itemIds.getValue(); List<String> keyList = k.getAllItemKey(itemId); if (keyList.isEmpty()) { ShowErrorNotification .error("No Item Key was found for STEM: \n" + cis.getCellItemById(itemId).getItem()); return null; } stem = new Label(); // stem.setValue(itemNo+". "+cis.getCellItemById(itemId).getItem().replace("{key}", keyList.get(0))); stem.setValue(itemNo + ". " + cis.getCellItemById(itemId).getItem().replace("{key}", k.getItemKeyById(itemKeyId))); stem.setContentMode(ContentMode.HTML); form.addComponent(stem); GridLayout glayout = new GridLayout(2, 2); glayout.setWidth("100%"); glayout.setSpacing(true); glayout.addComponent(new Label("A) " + cis.getCellItemById(itemId).getOptionA(), ContentMode.HTML), 0, 0); glayout.addComponent(new Label("C) " + cis.getCellItemById(itemId).getOptionC(), ContentMode.HTML), 0, 1); glayout.addComponent(new Label("B) " + cis.getCellItemById(itemId).getOptionB(), ContentMode.HTML), 1, 0); glayout.addComponent(new Label("D) " + cis.getCellItemById(itemId).getOptionD(), ContentMode.HTML), 1, 1); form.addComponent(glayout); itemNo++; } } HorizontalLayout h = new HorizontalLayout(); h.setWidth("100%"); Button delete = new Button("DELETE"); delete.setWidth("200px"); delete.setIcon(FontAwesome.TRASH_O); delete.addStyleName(ValoTheme.BUTTON_PRIMARY); delete.addStyleName(ValoTheme.BUTTON_SMALL); delete.addClickListener(buttonClickListener); h.addComponent(delete); Button approve = new Button("APPROVE"); approve.setWidth("200px"); approve.setIcon(FontAwesome.THUMBS_UP); approve.addStyleName(ValoTheme.BUTTON_PRIMARY); approve.addStyleName(ValoTheme.BUTTON_SMALL); approve.addClickListener(buttonClickListener); h.addComponent(approve); if (tq.isTQCoverageApproved(getTQCoverageId())) { approve.setVisible(false); } else { approve.setVisible(true); } form.addComponent(h); return form; }
From source file:com.hack23.cia.web.impl.ui.application.views.common.menufactory.impl.AbstractMenuItemFactoryImpl.java
License:Apache License
protected final void createButtonLink(final GridLayout panelContent, final String linkText, final Resource icon, final ClickListener command, final String description) { final GridLayout grid = new GridLayout(2, 1); grid.setWidth(100, Unit.PERCENTAGE); grid.setHeight(100, Unit.PERCENTAGE); grid.setColumnExpandRatio(0, 1);// w w w. j av a2 s.c om grid.setColumnExpandRatio(1, 2); final Button b = new Button(linkText); b.setStyleName("link"); b.addClickListener(command); b.setWidth(100, Unit.PERCENTAGE); b.setIcon(icon); b.setWidth(100, Unit.PERCENTAGE); grid.addComponent(b, 0, 0); grid.setComponentAlignment(b, Alignment.MIDDLE_LEFT); final Label descriptionLabel = new Label(description); descriptionLabel.setWidth(100, Unit.PERCENTAGE); grid.addComponent(descriptionLabel, 1, 0); grid.setComponentAlignment(descriptionLabel, Alignment.MIDDLE_LEFT); panelContent.addComponent(grid); panelContent.setComponentAlignment(grid, Alignment.MIDDLE_LEFT); }
From source file:com.jiangyifen.ec2.ui.LoginLayout.java
/** * ?//w ww . j av a2 s . com * * @param panelContent ???? * @param roleType ? */ private void createLoginMainComponents(VerticalLayout panelContent, RoleType roleType) { GridLayout gridLayout = new GridLayout(2, 5); gridLayout.setSpacing(true); gridLayout.setMargin(true); panelContent.addComponent(gridLayout); panelContent.setComponentAlignment(gridLayout, Alignment.MIDDLE_CENTER); // ?? Label username_lb = new Label(" ??", Label.CONTENT_XHTML); gridLayout.addComponent(username_lb, 0, 0); usernameTextField = new TextField(); usernameTextField.setWidth("170px"); usernameTextField.setValue(username); gridLayout.addComponent(usernameTextField, 1, 0); // ? Label password = new Label(" ?", Label.CONTENT_XHTML); gridLayout.addComponent(password, 0, 1); passwordTextField = new PasswordField(); passwordTextField.setWidth("170px"); gridLayout.addComponent(passwordTextField, 1, 1); // ?Csr ? if (roleType.equals(RoleType.csr)) { Label extenNoLabel = new Label(" ", Label.CONTENT_XHTML); gridLayout.addComponent(extenNoLabel, 0, 2); extenNoField = new TextField(); extenNoField.setWidth("170px"); extenNoField.setValue(exten); gridLayout.addComponent(extenNoField, 1, 2); } // ????? String warningMsg = "<font color='red'>?????</font>"; warningLabel = new Label(warningMsg, Label.CONTENT_XHTML); warningLabel.setVisible(false); gridLayout.addComponent(warningLabel, 1, 3); gridLayout.setComponentAlignment(warningLabel, Alignment.MIDDLE_CENTER); // ? login = new Button(" ", this); forget = new NativeButton("?", this); //??? Map<String, String> licenseMap = LicenseManager.licenseValidate(); String validateResult = licenseMap.get(LicenseManager.LICENSE_VALIDATE_RESULT); if (LicenseManager.LICENSE_VALID.equals(validateResult)) { SpringContextHolder.getHttpSession().removeAttribute("businessModels"); String licensedDate = licenseMap.get(LicenseManager.LICENSE_DATE); try { Date stopDate = LicenseManager.simpleDateFormat.parse(licensedDate); Long times = stopDate.getTime() - new Date().getTime(); int outdateWarnDay = (int) (times / (24 * 3600 * 1000)); if (outdateWarnDay < 7) { isValid = true; warningLabel.setValue("<font color='red'>" + outdateWarnDay + ",???</font>"); if (outdateWarnDay < 0) { warningLabel.setValue("<font color='red'>?,???</font>"); isValid = false; } else if (outdateWarnDay == 0) { warningLabel.setValue( "<font color='red'>?,???</font>"); } warningLabel.setVisible(true); } // //?? // if(roleType==RoleType.manager){ // login.setEnabled(true); // } // } catch (Exception e) { e.printStackTrace(); login.setEnabled(false); forget.setEnabled(false); } } else { warningLabel.setVisible(true); warningLabel.setValue("<font color='red'>??,???</font>"); login.setEnabled(false); forget.setEnabled(false); isValid = false; //chb ??? if (roleType == RoleType.manager) { if (isValid == false) { login.setEnabled(true); } else { //normal login } } } HorizontalLayout operatorHLayout = new HorizontalLayout(); operatorHLayout.setSpacing(true); operatorHLayout.addComponent(login); operatorHLayout.addComponent(forget); gridLayout.addComponent(operatorHLayout, 1, 4); }
From source file:com.lizardtech.expresszip.vaadin.FindLayersViewComponent.java
License:Apache License
private void setupAddFilterWindow(Window window) { // General variables // Layouts/* w w w. jav a 2 s. com*/ GridLayout mainLayout = new GridLayout(1, 3); HorizontalLayout axisLayout = new HorizontalLayout(); HorizontalLayout criteriaLayout = new HorizontalLayout(); HorizontalLayout buttonLayout = new HorizontalLayout(); hznCriteria = criteriaLayout; // Buttons ExpressZipButton btnAdd = new ExpressZipButton("Add", Style.ACTION); btnAdd.setClickShortcut(KeyCode.ENTER); btnAdd.addStyleName("primary"); ExpressZipButton btnCancel = new ExpressZipButton("Cancel", Style.ACTION); // Fields ComboBox cmbAxis = new ComboBox(); cmbAxis.setTextInputAllowed(false); cmbAxis.setNullSelectionAllowed(false); // Labels Label lblAxis = new Label("Axis"); btnAdd.addListener(filterButtonListener); btnCancel.addListener(filterButtonListener); for (Filter.AxisFilters f : Filter.axisArray) { cmbAxis.addItem(filter.getNameOfFilter(f)); } cmbAxis.setImmediate(true); cmbAxis.addListener(axisSelectedListener); cmbAxis.setValue(filter.getNameOfFilter(Filter.axisArray[0])); mainLayout.addComponent(axisLayout, 0, 0); mainLayout.addComponent(criteriaLayout, 0, 1); mainLayout.addComponent(buttonLayout, 0, 2); mainLayout.setSpacing(true); axisLayout.setSpacing(true); axisLayout.addComponent(lblAxis); axisLayout.addComponent(cmbAxis); axisLayout.setExpandRatio(lblAxis, .2f); axisLayout.setExpandRatio(cmbAxis, .8f); axisLayout.setComponentAlignment(lblAxis, Alignment.MIDDLE_LEFT); axisLayout.setComponentAlignment(cmbAxis, Alignment.MIDDLE_LEFT); axisLayout.setSizeFull(); criteriaLayout.setSizeFull(); buttonLayout.setSpacing(true); buttonLayout.addComponent(btnAdd); buttonLayout.addComponent(btnCancel); buttonLayout.setComponentAlignment(btnAdd, Alignment.BOTTOM_RIGHT); buttonLayout.setComponentAlignment(btnCancel, Alignment.BOTTOM_RIGHT); buttonLayout.setExpandRatio(btnAdd, 1f); buttonLayout.setExpandRatio(btnCancel, 0f); buttonLayout.setSizeFull(); mainLayout.setRowExpandRatio(0, 1f); mainLayout.setRowExpandRatio(1, 1f); mainLayout.setRowExpandRatio(2, 1f); mainLayout.setSizeFull(); window.addComponent(mainLayout); window.getContent().setSizeFull(); }
From source file:com.mycollab.module.crm.ui.components.PeopleInfoComp.java
License:Open Source License
public void displayEntryPeople(ValuedBean bean) { this.removeAllComponents(); this.withMargin(false); Label peopleInfoHeader = new Label( FontAwesome.USER.getHtml() + " " + UserUIContext.getMessage(CrmCommonI18nEnum.SUB_INFO_PEOPLE), ContentMode.HTML);/* w w w .j a v a2s . c o m*/ peopleInfoHeader.setStyleName("info-hdr"); this.addComponent(peopleInfoHeader); GridLayout layout = new GridLayout(2, 2); layout.setSpacing(true); layout.setWidth("100%"); layout.setMargin(new MarginInfo(false, false, false, true)); try { Label createdLbl = new Label(UserUIContext.getMessage(CrmCommonI18nEnum.ITEM_CREATED_PEOPLE)); createdLbl.setSizeUndefined(); layout.addComponent(createdLbl, 0, 0); String createdUserName = (String) PropertyUtils.getProperty(bean, "createduser"); String createdUserAvatarId = (String) PropertyUtils.getProperty(bean, "createdUserAvatarId"); String createdUserDisplayName = (String) PropertyUtils.getProperty(bean, "createdUserFullName"); UserLink createdUserLink = new UserLink(createdUserName, createdUserAvatarId, createdUserDisplayName); layout.addComponent(createdUserLink, 1, 0); layout.setColumnExpandRatio(1, 1.0f); Label assigneeLbl = new Label(UserUIContext.getMessage(CrmCommonI18nEnum.ITEM_ASSIGN_PEOPLE)); assigneeLbl.setSizeUndefined(); layout.addComponent(assigneeLbl, 0, 1); String assignUserName = (String) PropertyUtils.getProperty(bean, "assignuser"); String assignUserAvatarId = (String) PropertyUtils.getProperty(bean, "assignUserAvatarId"); String assignUserDisplayName = (String) PropertyUtils.getProperty(bean, "assignUserFullName"); UserLink assignUserLink = new UserLink(assignUserName, assignUserAvatarId, assignUserDisplayName); layout.addComponent(assignUserLink, 1, 1); } catch (Exception e) { LOG.error("Can not build user link {} ", BeanUtility.printBeanObj(bean)); } this.addComponent(layout); }
From source file:com.openhris.calendar.SchedulerMainUI.java
public SchedulerMainUI() { setMargin(true);/*from w w w. j a va 2 s.com*/ cal = new Calendar(); calendarEvents(); cal.setWidth("100%"); cal.setHeight("100%"); cal.setImmediate(true); Date today = new Date(); calendar = new GregorianCalendar(); calendar.setTime(today); updateCaptionLabel(); initNavigationButtons(); if (!showWeeklyView) { int rollAmount = calendar.get(GregorianCalendar.DAY_OF_MONTH) - 1; calendar.add(GregorianCalendar.DAY_OF_MONTH, -rollAmount); currentMonthsFirstDate = calendar.getTime(); cal.setStartDate(currentMonthsFirstDate); calendar.add(GregorianCalendar.MONTH, 1); calendar.add(GregorianCalendar.DATE, -1); cal.setEndDate(calendar.getTime()); } cal.setHandler(new BasicDateClickHandler() { @Override public void dateClick(CalendarComponentEvents.DateClickEvent event) { Calendar cal = event.getComponent(); long currentCalDateRange = cal.getEndDate().getTime() - cal.getStartDate().getTime(); if (currentCalDateRange < VCalendar.DAYINMILLIS) { // Change the date range to the current week cal.setStartDate(cal.getFirstDateForWeek(event.getDate())); cal.setEndDate(cal.getLastDateForWeek(event.getDate())); } else { // Default behaviour, change date range to one day super.dateClick(event); } } }); addCalendarEventListeners(); GridLayout grid = new GridLayout(5, 1); grid.setSizeFull(); monthButton.setVisible(false); weekButton.setVisible(false); grid.addComponent(monthButton, 1, 0); grid.setComponentAlignment(monthButton, Alignment.MIDDLE_CENTER); monthLabel = new Label(); monthLabel.setValue(OpenHrisUtilities.convertDateFormatForCalendar(currentMonthsFirstDate.toString())); monthLabel.setContentMode(Label.CONTENT_XHTML); monthLabel.addStyleName("month"); grid.addComponent(monthLabel, 2, 0); grid.setComponentAlignment(monthLabel, Alignment.MIDDLE_CENTER); grid.addComponent(weekButton, 3, 0); grid.setComponentAlignment(weekButton, Alignment.MIDDLE_CENTER); grid.addComponent(nextButton, 4, 0); grid.setComponentAlignment(nextButton, Alignment.MIDDLE_RIGHT); grid.addComponent(prevButton, 0, 0); grid.setComponentAlignment(prevButton, Alignment.MIDDLE_LEFT); addComponent(grid); addComponent(cal); setExpandRatio(cal, 1); }
From source file:com.openhris.employee.allowance.EmployeeAllowanceInformation.java
ComponentContainer component() { GridLayout glayout = new GridLayout(3, 14); glayout.setSpacing(true);/* w w w . ja v a 2 s . c o m*/ glayout.setWidth("600px"); glayout.setHeight("100%"); communication = new TextField("Communication Allowance: "); communication.setWidth("170px"); communication.addStyleName("numerical"); glayout.addComponent(communication, 0, 0); communicationEntry = dropDown.populateEmploymentAllowanceEntry("Entry Type: "); communicationEntry.setWidth("150px"); glayout.addComponent(communicationEntry, 1, 0); Button communicationBtn = new Button("UPDATE COMMUNICATION ALLOWANCE"); communicationBtn.setWidth("250px"); communicationBtn.addListener(buttonClickListener); glayout.addComponent(communicationBtn, 2, 0); glayout.setComponentAlignment(communicationBtn, Alignment.BOTTOM_LEFT); if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) { communicationBtn.setEnabled(true); } else { communicationBtn.setEnabled(false); } glayout.addComponent(new Label("<HR>", Label.CONTENT_XHTML), 0, 1, 2, 1); perDiem = new TextField("Per Diem: "); perDiem.setWidth("170px"); perDiem.addStyleName("numerical"); glayout.addComponent(perDiem, 0, 2); perDiemEntry = dropDown.populateEmploymentAllowanceEntry("Entry Type: "); perDiemEntry.setWidth("150px"); glayout.addComponent(perDiemEntry, 1, 2); Button perDiemBtn = new Button("UPDATE PER DIEM"); perDiemBtn.setWidth("250px"); perDiemBtn.addListener(buttonClickListener); glayout.addComponent(perDiemBtn, 2, 2); glayout.setComponentAlignment(perDiemBtn, Alignment.BOTTOM_LEFT); if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) { perDiemBtn.setEnabled(true); } else { perDiemBtn.setEnabled(false); } glayout.addComponent(new Label("<HR>", Label.CONTENT_XHTML), 0, 3, 2, 3); cola = new TextField("Cola: "); cola.setWidth("170px"); cola.addStyleName("numerical"); glayout.addComponent(cola, 0, 4); colaEntry = dropDown.populateEmploymentAllowanceEntry("Entry Type: "); colaEntry.setWidth("150px"); glayout.addComponent(colaEntry, 1, 4); Button colaBtn = new Button("UPDATE COLA"); colaBtn.setWidth("250px"); colaBtn.addListener(buttonClickListener); glayout.addComponent(colaBtn, 2, 4); glayout.setComponentAlignment(colaBtn, Alignment.BOTTOM_LEFT); if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) { colaBtn.setEnabled(true); } else { colaBtn.setEnabled(false); } glayout.addComponent(new Label("<HR>", Label.CONTENT_XHTML), 0, 5, 2, 5); meal = new TextField("Meal Allowance: "); meal.setWidth("170px"); meal.addStyleName("numerical"); glayout.addComponent(meal, 0, 6); mealEntry = dropDown.populateEmploymentAllowanceEntry("Entry Type: "); mealEntry.setWidth("150px"); glayout.addComponent(mealEntry, 1, 6); Button mealBtn = new Button("UPDATE MEAL ALLOWANCE"); mealBtn.setWidth("250px"); mealBtn.addListener(buttonClickListener); glayout.addComponent(mealBtn, 2, 6); glayout.setComponentAlignment(mealBtn, Alignment.BOTTOM_LEFT); if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) { mealBtn.setEnabled(true); } else { mealBtn.setEnabled(false); } glayout.addComponent(new Label("<HR>", Label.CONTENT_XHTML), 0, 7, 2, 7); transportation = new TextField("Transportation Allowance: "); transportation.setWidth("170px"); transportation.addStyleName("numerical"); glayout.addComponent(transportation, 0, 8); transportationEntry = dropDown.populateEmploymentAllowanceEntry("Entry Type: "); transportationEntry.setWidth("150px"); glayout.addComponent(transportationEntry, 1, 8); Button transportationBtn = new Button("UPDATE TRANSPORTATION ALLOWANCE"); transportationBtn.setWidth("250px"); transportationBtn.addListener(buttonClickListener); glayout.addComponent(transportationBtn, 2, 8); glayout.setComponentAlignment(transportationBtn, Alignment.BOTTOM_LEFT); if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) { transportationBtn.setEnabled(true); } else { transportationBtn.setEnabled(false); } glayout.addComponent(new Label("<HR>", Label.CONTENT_XHTML), 0, 9, 2, 9); others = new TextField("Other Allowances: "); others.setWidth("170px"); others.addStyleName("numerical"); glayout.addComponent(others, 0, 10); othersEntry = dropDown.populateEmploymentAllowanceEntry("Entry Type: "); othersEntry.setWidth("150px"); glayout.addComponent(othersEntry, 1, 10); Button othersBtn = new Button("UPDATE OTHER ALLOWANCES"); othersBtn.setWidth("250px"); othersBtn.addListener(buttonClickListener); glayout.addComponent(othersBtn, 2, 10); glayout.setComponentAlignment(othersBtn, Alignment.BOTTOM_LEFT); if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) { othersBtn.setEnabled(true); } else { othersBtn.setEnabled(false); } glayout.addComponent(new Label("<HR>", Label.CONTENT_XHTML), 0, 11, 2, 11); afl = new TextField("Allowance for Liquidation: "); afl.setWidth("170px"); afl.addStyleName("numerical"); glayout.addComponent(afl, 0, 12); Button aflBtn = new Button("UPDATE AFL"); aflBtn.setWidth("100%"); aflBtn.addListener(buttonClickListener); glayout.addComponent(aflBtn, 1, 12, 2, 12); glayout.setComponentAlignment(aflBtn, Alignment.BOTTOM_LEFT); if (GlobalVariables.getUserRole().equals("administrator") || GlobalVariables.getUserRole().equals("hr")) { aflBtn.setEnabled(true); } else { aflBtn.setEnabled(false); } if (getEmployeeId() != null) { Allowances a = ais.getAllowancesByEmployee(getEmployeeId()); communication.setValue(a.getCommunication()); communicationEntry.setValue( Constant.getKeyByValue(Constant.MAP_CONSTANT_EMPLOYMENT_ALLOWANCE_ENTRY, a.getComEntryType())); perDiem.setValue(a.getPerDiem()); perDiemEntry.setValue(Constant.getKeyByValue(Constant.MAP_CONSTANT_EMPLOYMENT_ALLOWANCE_ENTRY, a.getPerDiemEntryType())); cola.setValue(a.getCola()); colaEntry.setValue( Constant.getKeyByValue(Constant.MAP_CONSTANT_EMPLOYMENT_ALLOWANCE_ENTRY, a.getColaEntryType())); meal.setValue(a.getMeal()); mealEntry.setValue( Constant.getKeyByValue(Constant.MAP_CONSTANT_EMPLOYMENT_ALLOWANCE_ENTRY, a.getMealEntryType())); transportation.setValue(a.getTransportation()); transportationEntry.setValue(Constant.getKeyByValue(Constant.MAP_CONSTANT_EMPLOYMENT_ALLOWANCE_ENTRY, a.getTransEntryType())); others.setValue(a.getOthers()); othersEntry.setValue(Constant.getKeyByValue(Constant.MAP_CONSTANT_EMPLOYMENT_ALLOWANCE_ENTRY, a.getOthersEntryType())); afl.setValue(a.getAllowanceForLiquidation()); } 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);// www . j a v a2 s. c om 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 www .j ava 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 layout2() { HorizontalLayout hlayout = new HorizontalLayout(); hlayout.setSpacing(true);// ww w . j a v a2 s . c om 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; }