private MedicationUnitVoCollection getUnits(DynamicGridRowCollection rows) { if (rows == null) return null; MedicationUnitVoCollection result = new MedicationUnitVoCollection(); for ( int i = 0 ; i < rows.size() ; i++) { if (rows.get(i).getValue() instanceof MedicationUnitVo) { MedicationUnitVo x = (MedicationUnitVo) rows.get(i).getValue(); if (x.getDoseUnitIsNotNull()) result.add(x); } } if (result.size()==0) return null; return result; }
private void removeSelectedRow() { DynamicGridRow row = form.lyrDetails().tabFRU().dyngrdFRU().getSelectedRow(); if (row == null) return; Object rowValue =row.getValue(); DynamicGridRow parent = row.getParent(); form.lyrDetails().tabFRU().dyngrdFRU().getRows().remove(row); if (rowValue instanceof MedicationFormVo) rebindFormRows(); else if (rowValue instanceof MedicationRouteVo) rebindRouteRows(parent); else if (rowValue instanceof MedicationUnitVo) rebindUnitRows(parent); }
private void rebindUnitRows(DynamicGridRow parent) { if (parent == null) return; DynamicGridRowCollection rows = parent.getRows(); MedicationDoseUnitCollection mRoutes = ims.core.vo.lookups.LookupHelper.getMedicationDoseUnit(this.domain.getLookupService()); for (int i = 0 ; i < rows.size() ; i++) { if (rows.get(i).getValue() instanceof MedicationUnitVo) { MedicationUnitVo x = (MedicationUnitVo) rows.get(i).getValue(); if (!x.getDoseUnitIsNotNull()) continue; mRoutes.remove(x.getDoseUnit()); } } for (int i = 0 ; i < rows.size() ; i++) { DynamicGridCell cell = rows.get(i).getCells().get(form.lyrDetails().tabFRU().dyngrdFRU().getColumns().getByIdentifier(COL_MAIN)); Object back = cell.getValue(); cell.getItems().clear(); if (back!=null) cell.getItems().newItem(back); for (int j = 0 ; j < mRoutes.size() ;j++) cell.getItems().newItem(mRoutes.get(j)); cell.setValue(back); } }