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 boolean wardAlreadyAdded(LocationForVTEAssessmentVo ward) { if (form.lyrTabs().tabWardSpec().dyngrdWardSpecialty().getRows().size() > 0) { for (int i = 0; i < form.lyrTabs().tabWardSpec().dyngrdWardSpecialty().getRows().size(); i++) { if ( form.lyrTabs().tabWardSpec().dyngrdWardSpecialty().getRows().get(i).getValue() instanceof LocationForVTEAssessmentVo) { LocationForVTEAssessmentVo addedWard = (LocationForVTEAssessmentVo)form.lyrTabs().tabWardSpec().dyngrdWardSpecialty().getRows().get(i).getValue(); if (addedWard.equals(ward)) return true; } } } return false; }
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; }
private void addWardRow(LocationForVTEAssessmentVo ward) { if(ward == null) return; grdWardsRow row = form.grdWards().getRows().newRow(); row.setColWard(ward.getName()); row.setColNotRequired(ward.getVTEAsessmentNotRequiredIsNotNull() ? ward.getVTEAsessmentNotRequired() : false); row.setValue(ward); }
private void updateControlsState() { form.getContextMenus().Clinical.hideAllVTEConfigWardCMMenuItems(); form.getContextMenus().Clinical.hideAllVTEConfigSpecialtyCMMenuItems(); form.getContextMenus().Clinical.hideAllVTEConfigWardSpecialtyCMMenuItems(); form.getContextMenus().Clinical.hideAllVTEColourConfigCMMenuItems(); boolean isRowSelected = form.lyrTabs().tabWardSpec().dyngrdWardSpecialty().getSelectedRow() != null && form.lyrTabs().tabWardSpec().dyngrdWardSpecialty().getSelectedRow().getValue() != null; boolean isWardSelected = isRowSelected && (form.lyrTabs().tabWardSpec().dyngrdWardSpecialty().getValue() instanceof LocationForVTEAssessmentVo || form.lyrTabs().tabWardSpec().dyngrdWardSpecialty().getValue().equals(NO_WARD_SELECTED)); boolean noWardSelected = isRowSelected && form.lyrTabs().tabWardSpec().dyngrdWardSpecialty().getValue().equals(NO_WARD_SELECTED); boolean isSpecialtySelected = isRowSelected && form.lyrTabs().tabWardSpec().dyngrdWardSpecialty().getValue() instanceof Specialty; boolean noSpecialtySelected = isRowSelected && form.lyrTabs().tabWardSpec().dyngrdWardSpecialty().getValue().equals(NO_SPECIALTY_SELECTED); boolean hasParentWard = form.lyrTabs().tabWardSpec().dyngrdWardSpecialty().getSelectedRow() != null && form.lyrTabs().tabWardSpec().dyngrdWardSpecialty().getSelectedRow().getParent() != null; form.getContextMenus().Clinical.getVTEConfigWardCMADDItem().setVisible(FormMode.EDIT.equals(form.getMode())); form.getContextMenus().Clinical.getVTEConfigWardCMREMOVEItem().setVisible(FormMode.EDIT.equals(form.getMode()) && form.lyrTabs().tabWardSpec().grdWards().getValue() != null); form.getContextMenus().Clinical.getVTEConfigSpecialtyCMADDItem().setVisible(FormMode.EDIT.equals(form.getMode())); form.getContextMenus().Clinical.getVTEConfigSpecialtyCMREMOVEItem().setVisible(FormMode.EDIT.equals(form.getMode()) && form.lyrTabs().tabWardSpec().grdSpecialties().getValue() != null); form.getContextMenus().Clinical.getVTEConfigWardSpecialtyCMADD_WARDItem().setVisible(FormMode.EDIT.equals(form.getMode())); form.getContextMenus().Clinical.getVTEConfigWardSpecialtyCMREMOVE_WARDItem().setVisible(FormMode.EDIT.equals(form.getMode()) && (isWardSelected || noWardSelected)); form.getContextMenus().Clinical.getVTEConfigWardSpecialtyCMADD_SPECIALTYItem().setVisible(FormMode.EDIT.equals(form.getMode()) && (isWardSelected || hasParentWard)); form.getContextMenus().Clinical.getVTEConfigWardSpecialtyCMREMOVE_SPECIALTYItem().setVisible(FormMode.EDIT.equals(form.getMode()) && (isSpecialtySelected || noSpecialtySelected)); form.getContextMenus().Clinical.getVTEColourConfigCMADDItem().setVisible(FormMode.EDIT.equals(form.getMode())); form.getContextMenus().Clinical.getVTEColourConfigCMEDITItem().setVisible(FormMode.EDIT.equals(form.getMode()) && form.lyrTabs().tabColourConfig().dyngrdColourConfig().getValue() != null); form.getContextMenus().Clinical.getVTEColourConfigCMREMOVEItem().setVisible(FormMode.EDIT.equals(form.getMode()) && form.lyrTabs().tabColourConfig().dyngrdColourConfig().getValue() != null); form.btnEdit().setVisible(FormMode.VIEW.equals(form.getMode())); form.btnEdit().setEnabled(FormMode.VIEW.equals(form.getMode())); }
private void addWardRow(LocationForVTEAssessmentVo ward) { if (ward == null) return; grdWardsRow row = form.grdWards().getRows().newRow(); row.setColWard(ward.getName()); row.setColSelect(false); row.setValue(ward); }
private void addWard(LocationLiteVo hospitalForWard, LocationForVTEAssessmentVo ward) { DynamicGridColumn hospitalCol = form.lyrTabs().tabWardSpec().dyngrdWardSpecialty().getColumns().getByIdentifier(HOSPITAL_COLUMN); DynamicGridColumn wardSpecialtyCol = form.lyrTabs().tabWardSpec().dyngrdWardSpecialty().getColumns().getByIdentifier(WARD_SPECIALTY_COLUMN); DynamicGridRow newRow = form.lyrTabs().tabWardSpec().dyngrdWardSpecialty().getRows().newRow(); newRow.setExpandedImage(form.getImages().Admin.Location); newRow.setCollapsedImage(form.getImages().Admin.Location); DynamicGridCell hospitalCell = newRow.getCells().newCell(hospitalCol, DynamicCellType.ENUMERATION); hospitalCell.setAutoPostBack(true); LocationLiteVoCollection hospitalsList = domain.listHospitals(); if (hospitalsList != null && hospitalsList.size() > 0) { for (int i = 0; i < hospitalsList.size(); i++) { LocationLiteVo hospital = hospitalsList.get(i); hospitalCell.getItems().newItem(hospital, hospital.getName()); } } DynamicGridCell wardSpecialtyCell = newRow.getCells().newCell(wardSpecialtyCol, DynamicCellType.QUERYCOMBOBOX); wardSpecialtyCell.setAutoPostBack(true); if (hospitalForWard != null) hospitalCell.setValue(hospitalForWard); if (ward != null) { wardSpecialtyCell.getItems().newItem(ward, ward.getName()); wardSpecialtyCell.setValue(ward); newRow.setValue(ward); } else newRow.setValue(NO_WARD_SELECTED); wardSpecialtyCell.setAutoPostBack(true); form.lyrTabs().tabWardSpec().dyngrdWardSpecialty().setSelectedRow(newRow); }
private void addSpecialty(Specialty specialty) { DynamicGridRow parent = form.lyrTabs().tabWardSpec().dyngrdWardSpecialty().getSelectedRow(); if (!((parent.getValue() instanceof LocationForVTEAssessmentVo) || parent.getValue().equals(NO_WARD_SELECTED))) { parent = parent.getParent(); } DynamicGridColumn wardSpecialtyCol = form.lyrTabs().tabWardSpec().dyngrdWardSpecialty().getColumns().getByIdentifier(WARD_SPECIALTY_COLUMN); DynamicGridRow newRow = parent.getRows().newRow(); newRow.setExpandedImage(form.getImages().Admin.Specialty01); newRow.setCollapsedImage(form.getImages().Admin.Specialty01); DynamicGridCell newCell = newRow.getCells().newCell(wardSpecialtyCol, DynamicCellType.ENUMERATION); SpecialtyCollection lkpSpecialtyCollection = LookupHelper.getSpecialty(domain.getLookupService()); if (lkpSpecialtyCollection != null) { for (int i = 0; i < lkpSpecialtyCollection.size(); i++) { Specialty specialtyToAdd = lkpSpecialtyCollection.get(i); newCell.getItems().newItem(specialtyToAdd, specialtyToAdd.getText()); } } if (specialty != null) { newCell.setValue(specialty); if (newCell.getValue() == null) { newCell.getItems().newItem(specialty, specialty.getText()); newCell.setValue(specialty); } newRow.setValue(specialty); } else newRow.setValue(NO_SPECIALTY_SELECTED); newCell.setAutoPostBack(true); newRow.getParent().setExpanded(true, true); form.lyrTabs().tabWardSpec().dyngrdWardSpecialty().setSelectedRow(newRow); }