public void loadStudents(List<Enrollment> enrs) { lstStudents.removeAllItems(); for (Enrollment enr : enrs) { lstStudents.addItem(enr); StringBuffer caption = new StringBuffer(); PhysicalPerson person = enr.getAdmissionAct().getStudent().getPhysicalPerson(); if (person.getIdentificationNumber() != null) { caption.append(person.getIdentificationNumber() + "-"); } else { caption.append("-- "); } if (person.getLastName() != null) { caption.append(person.getLastName() + ", "); } else { caption.append("--"); } if (person.getName() != null) { caption.append(person.getName()); } else { caption.append("--"); } lstStudents.setItemCaption(enr, caption.toString()); } }
public void removeItemLeftIfExistRight() { for (Enrollment enrRight : (Collection<Enrollment>) lstStudentSelecteds.getItemIds()) { for (Enrollment enrLeft : (Collection<Enrollment>) lstStudents.getItemIds()) { if (enrRight.getId().equals(enrLeft.getId())) { lstStudents.removeItem(enrLeft); break; } } } }
public void moveRightLeft() { Collection<Enrollment> studentRSelects = (Collection<Enrollment>) lstStudentSelecteds.getValue(); List<Enrollment> lstLeftSelecteds = new ArrayList<Enrollment>(); for (Enrollment enr : studentRSelects) { lstLeftSelecteds.add(enr); for (Enrollment itemRem : (Collection<Enrollment>) lstStudentSelecteds.getItemIds()) { if (enr.getId().equals(itemRem.getId())) { lstStudentSelecteds.removeItem(itemRem); break; } } } for (Enrollment enr : (Collection<Enrollment>) lstStudents.getItemIds()) { boolean flagExist = false; for (Enrollment itemAdd : lstLeftSelecteds) { if (enr.getId().equalsIgnoreCase(itemAdd.getId())) { flagExist = true; } } if (flagExist == false) { lstLeftSelecteds.add(enr); } } loadStudents(lstLeftSelecteds); }
private void initializeStateLcTextField() { stateLcTextField.setWidth("90%"); stateLcTextField.setNullRepresentation(""); stateLcTextField.setRequired(true); reloadButton.setStyleName("buttonReload"); reloadButton.setDescription("Generar Reincorporación"); reloadButton.setVisible(false); FormLayout formLayout = new FormLayout(); formLayout.setSizeFull(); formLayout.setMargin(false); formLayout.setSpacing(true); formLayout.addComponent(stateLcTextField); gridLayout.addComponent(formLayout, 0, 2); gridLayout.setComponentAlignment(formLayout, Alignment.MIDDLE_LEFT); TextField reinstTextField = new TextField("Reincorporación:"); Enrollment enrollmentSelected = editSanctionActsSubWindow.getLoadSanctionActList().getEnrollmentSelected(); if (enrollmentSelected != null && enrollmentSelected.getStateLc() != null) { stateLcTextField.setValue( loadSanctionActSubWindow .getLoadSanctionActList() .getfilteredFacade() .getTypeStateEnrolled(enrollmentSelected.getId())); if (enrollmentSelected.getStateLc().equals("E") || enrollmentSelected.getStateLc().equals("F") || enrollmentSelected.getStateLc().equals("G")) { List<Reinstatement> lst = loadSanctionActSubWindow .getLoadSanctionActList() .getfilteredFacade() .getIsInitReinstatementByStateLc(enrollmentSelected); if (lst != null && lst.size() > 0) { Reinstatement reinst = lst.get(0); reinstTextField.setValue( loadSanctionActSubWindow .getLoadSanctionActList() .getfilteredFacade() .getNameStateLc(reinst.getStateLc(), "REINSTATEMENT")); gridLayout.addComponent(reinstTextField, 1, 2); gridLayout.setComponentAlignment(reinstTextField, Alignment.MIDDLE_LEFT); reinstTextField.setReadOnly(true); } else { reloadButton.setVisible(true); gridLayout.addComponent(reloadButton, 1, 2); gridLayout.setComponentAlignment(reloadButton, Alignment.MIDDLE_LEFT); } } } stateLcTextField.setReadOnly(true); }