private void listWards(LocationLiteVo hospital) { form.grdWards().getRows().clear(); if(hospital == null || hospital.getID_Location() == null) return; LocationForVTEAssessmentVoCollection wards = domain.listWards(hospital); if(wards == null || wards.size() == 0) return; for(LocationForVTEAssessmentVo ward : wards) { if(ward == null) continue; addWardRow(ward); } }
public void saveWards(LocationForVTEAssessmentVoCollection wards) throws StaleObjectException { if(wards == null) throw new CodingRuntimeException("Cannot save a null Wards collection."); if(!wards.isValidated()) throw new CodingRuntimeException("Wards collection is not validated."); DomainFactory factory = getDomainFactory(); for(LocationForVTEAssessmentVo ward : wards) { if(ward == null) continue; Location doWard = LocationForVTEAssessmentVoAssembler.extractLocation(factory, ward); factory.save(doWard); } }
private void populateWardGrid(LocationForVTEAssessmentVoCollection selectedWards) { form.lyrTabs().tabWardSpec().grdWards().getRows().clear(); if (selectedWards == null || selectedWards.size() == 0) return; for (int i = 0; i < selectedWards.size(); i++) { grdWardsRow newRow = form.lyrTabs().tabWardSpec().grdWards().getRows().newRow(); newRow.setColWard(selectedWards.get(i).getName()); newRow.setColNotRequired(true); newRow.setValue(selectedWards.get(i)); } }
private void markAlreadyAddedValues() { if (form.getGlobalContext().Core.getSelectedWardsForVTEConfig() == null || form.getGlobalContext().Core.getSelectedWardsForVTEConfig().size() == 0) return; LocationForVTEAssessmentVoCollection addedWards = form.getGlobalContext().Core.getSelectedWardsForVTEConfig(); for (int i = 0; i < addedWards.size(); i++) { for (int j = 0; j < form.grdWards().getRows().size(); j++) { if (addedWards.get(i).equals(form.grdWards().getRows().get(j).getValue())) { form.grdWards().getRows().get(j).setColSelect(true); } } } }
private void listWards(LocationLiteVo hospital) { form.grdWards().getRows().clear(); if (hospital == null || hospital.getID_Location() == null) return; LocationForVTEAssessmentVoCollection wards = domain.listWards(hospital); if (wards == null || wards.size() == 0) return; for (LocationForVTEAssessmentVo ward : wards) { if (ward == null) continue; addWardRow(ward); } }
private boolean save() { LocationForVTEAssessmentVoCollection wards = new LocationForVTEAssessmentVoCollection(); for(int i=0; i<form.grdWards().getRows().size(); i++) { LocationForVTEAssessmentVo ward = form.grdWards().getRows().get(i).getValue(); if(ward == null) continue; ward.setVTEAsessmentNotRequired(form.grdWards().getRows().get(i).getColNotRequired()); wards.add(ward); } String[] errors = wards.validate(); if(errors != null && errors.length > 0) { engine.showErrors(errors); return false; } try { domain.saveWards(wards); } catch (StaleObjectException e) { e.printStackTrace(); engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); open(); return false; } return true; }
public ims.core.vo.LocationForVTEAssessmentVoCollection listWards(ims.core.resource.place.vo.LocationRefVo hospital) { if(hospital == null || hospital.getID_Location() == null) throw new CodingRuntimeException("Cannot list wards for a null Hospital Id."); return LocationForVTEAssessmentVoAssembler.createLocationForVTEAssessmentVoCollectionFromLocation(listLocationsByParentLocation(hospital)).sort(); }
private LocationForVTEAssessmentVoCollection populateWardsFromScreen() { LocationForVTEAssessmentVoCollection selectedWards = new LocationForVTEAssessmentVoCollection(); for (int i = 0; i < form.lyrTabs().tabWardSpec().grdWards().getRows().size(); i++) { if (form.lyrTabs().tabWardSpec().grdWards().getRows().get(i).getColNotRequired()) { selectedWards.add(form.lyrTabs().tabWardSpec().grdWards().getRows().get(i).getValue()); } } return selectedWards; }
@Override protected void onGrdWardsGridCheckBoxClicked(int column, GenForm.grdWardsRow row, boolean isChecked) throws ims.framework.exceptions.PresentationLogicException { if (form.getGlobalContext().Core.getSelectedWardsForVTEConfig() == null) form.getGlobalContext().Core.setSelectedWardsForVTEConfig(new LocationForVTEAssessmentVoCollection()); if (isChecked) form.getGlobalContext().Core.getSelectedWardsForVTEConfig().add(row.getValue()); else form.getGlobalContext().Core.getSelectedWardsForVTEConfig().remove(row.getValue()); }
public LocationForVTEAssessmentVoCollection listWardsForHospital(String name, LocationRefVo hospital) { List list; if(hospital==null) { list= listLocations(LocationType.WARD, Boolean.TRUE, name); } else { //http://jira/browse/WDEV-21222 OrganisationAndLocation impl = (OrganisationAndLocation)getDomainImpl(OrganisationAndLocationImpl.class); list = impl.listLocationsByParentLocation(LocationType.WARD, hospital, Boolean.TRUE,null, name); } return LocationForVTEAssessmentVoAssembler.createLocationForVTEAssessmentVoCollectionFromLocation(list).sort(); }
@Override protected void onDyngrdWardSpecialtyCellTextSubmited(DynamicGridCell cell) { String typedText = cell.getTypedText(); cell.getItems().clear(); cell.setTypedText(null); if (DynamicCellType.QUERYCOMBOBOX.equals(cell.getType())) cell.getRow().setValue(NO_WARD_SELECTED); DynamicGridColumn hospitalCol = form.lyrTabs().tabWardSpec().dyngrdWardSpecialty().getColumns().getByIdentifier(HOSPITAL_COLUMN); LocationLiteVo hospital = (LocationLiteVo) cell.getRow().getCells().get(hospitalCol).getValue(); if (hospital == null) { engine.showMessage("Please select a Hospital before searching for a Ward."); return; } LocationForVTEAssessmentVoCollection wards = domain.listWardsForHospital(typedText, hospital); if (wards == null || wards.size() == 0) return; for (int i = 0; i < wards.size(); i++) { cell.getItems().newItem(wards.get(i), wards.get(i).getName()); } if (cell.getItems().size() == 1) { cell.setValue(cell.getItems().get(0).getValue()); cell.getRow().setValue(cell.getItems().get(0).getValue()); } else { cell.showOpened(); } DynamicGridRow selectedRow = form.lyrTabs().tabWardSpec().dyngrdWardSpecialty().getSelectedRow(); if (selectedRow != null) { form.lyrTabs().tabWardSpec().dyngrdWardSpecialty().setSelectedRow(null); form.lyrTabs().tabWardSpec().dyngrdWardSpecialty().setSelectedRow(selectedRow); } updateControlsState(); }