private void populatePanel(TreeNode node) { ProceduresPerformedByHCPVo proc = null; HcpLiteVo hcp = null; if (node != null) if (node.getValue() instanceof ProceduresPerformedByHCPVo) { proc = (ProceduresPerformedByHCPVo) node.getValue(); hcp = proc.getPerformingHCP(); } else if (node.getValue() instanceof HcpLiteVo) { hcp = (HcpLiteVo) node.getValue(); if (node.getNodes().size() > 0) proc = (ProceduresPerformedByHCPVo) node.getNodes().get(0).getValue(); } if (hcp != null) { form.qmbHCPpanel().newRow(hcp, hcp.getIHcpName()); form.qmbHCPpanel().setEnabled(false); form.qmbHCPpanel().setValue(hcp); form.cmbServicesPanel().setEnabled(true); populateServicePanelCombo(form.getLocalContext().getAvailableServiceList()); form.getContextMenus().Clinical.getProcedureGridADDPROCEDUREItem().setVisible(true); } if (proc != null) { if (proc.getPerformingHCPIsNotNull()) { form.qmbHCPpanel().setValue(proc.getPerformingHCP()); form.qmbHCPpanel().newRow(proc.getPerformingHCP(), proc.getPerformingHCP().getIHcpName()); } if (proc.getServiceIsNotNull()) form.cmbServicesPanel().setValue(proc.getService()); if (proc.getProceduresIsNotNull() && proc.getProcedures().size() > 0) { form.dyngrdProcedures().getRows().clear(); for (int i = 0; i < proc.getProcedures().size(); i++) { DynamicGridRow row = form.dyngrdProcedures().getRows().newRow(); DynamicGridColumn col = form.dyngrdProcedures().getColumns().get(0); DynamicGridCell cell = row.getCells().newCell(col, DynamicCellType.QUERYCOMBOBOX); cell.getItems().newItem(proc.getProcedures().get(i)); cell.setValue(proc.getProcedures().get(i)); row.setValue(proc.getProcedures().get(i)); // WDEV-10772 } } } if (form.getLocalContext().getIsNewProcedureIsNotNull() && form.getLocalContext().getIsNewProcedure()) { if (hcp != null) { form.qmbHCPpanel().newRow(hcp, hcp.getIHcpName()); form.qmbHCPpanel().setValue(hcp); form.qmbHCPpanel().setEnabled(false); } if (proc != null) { form.cmbServicesPanel().newRow(proc.getService(), proc.getService().getServiceName()); form.cmbServicesPanel().setValue(proc.getService()); form.cmbServicesPanel().setEnabled(false); form.qmbHCPpanel().newRow(hcp, proc.getPerformingHCP().getIHcpName()); form.qmbHCPpanel().setValue(proc.getPerformingHCP()); form.qmbHCPpanel().setEnabled(false); } } if (form.getMode().equals(FormMode.EDIT)) { for (int i = 0; i < form.dyngrdProcedures().getRows().size(); i++) { DynamicGridRow row = form.dyngrdProcedures().getRows().get(i); DynamicGridCell cell = null; for (int j = 0; j < row.getCellArray().length; j++) if (row.getCellArray()[j] != null) cell = row.getCellArray()[j]; if (cell != null) cell.setAutoPostBack(true); } } }
private void populatePanel(ProceduresPerformedByHCPVo pphcp) { clearPanel(); if (pphcp == null) return; if (pphcp.getPerformingHCPIsNotNull()) { form.qmbHCPpanel().newRow(pphcp.getPerformingHCP(), pphcp.getPerformingHCP().getIHcpName()); form.qmbHCPpanel().setValue(pphcp.getPerformingHCP()); } if (pphcp.getServiceIsNotNull()) { form.cmbServicesPanel().newRow(pphcp.getService(), pphcp.getService().getServiceName()); form.cmbServicesPanel().setValue(pphcp.getService()); } if (pphcp.getProceduresIsNotNull()) for (int i = 0; i < pphcp.getProcedures().size(); i++) { DynamicGridRow row = form.dyngrdProcedures().getRows().newRow(); DynamicGridColumn col = form.dyngrdProcedures().getColumns().get(0); DynamicGridCell cell = row.getCells().newCell(col, DynamicCellType.QUERYCOMBOBOX); cell.getItems().newItem(pphcp.getProcedures().get(i)); cell.setValue(pphcp.getProcedures().get(i)); } }
@Override protected void onBtnSaveClick() throws PresentationLogicException { ProceduresPerformedByHCPVo proc = null; if (form.getLocalContext().getIsNewNodeIsNotNull() && form.getLocalContext().getIsNewNode() || form.getLocalContext().getIsNewServiceIsNotNull() && form.getLocalContext() .getIsNewService()) // &&form.getLocalContext().getIsNewProcedureIsNotNull()&&form.getLocalContext().getIsNewProcedure()) proc = new ProceduresPerformedByHCPVo(); else if (form.getLocalContext().getSelectedProcedurePerfIsNotNull()) proc = form.getLocalContext().getSelectedProcedurePerf(); ProcedureLiteVoCollection procedures = new ProcedureLiteVoCollection(); if (form.qmbHCPpanel().getValue() != null) proc.setPerformingHCP(form.qmbHCPpanel().getValue()); if (form.cmbServicesPanel().getValue() != null) proc.setService(form.cmbServicesPanel().getValue()); if (form.dyngrdProcedures().getRows().size() != 0) { for (int i = 0; i < form.dyngrdProcedures().getRows().size(); i++) { DynamicGridRow row = form.dyngrdProcedures().getRows().get(i); DynamicGridColumn column = form.dyngrdProcedures().getColumns().getByIdentifier(COLUMN_PROC); DynamicGridCell cell = row.getCells().get(column); // WDEV-17779 if (cell.getValue() == null && cell.getTypedText() != null) { engine.showMessage( "Please select a Procedure. '" + cell.getTypedText() + "' is not valid."); return; } procedures.add((ProcedureLiteVo) cell.getValue()); } } else procedures = null; proc.setProcedures(procedures); try { String[] errors = proc.validate(); if (errors != null) { engine.showErrors(errors); return; } else try { domain.saveProcedurePerformedByHCP(proc); } catch (DomainInterfaceException e) { e.printStackTrace(); engine.showMessage("Error saving Procedure" + e.toString()); return; } } catch (StaleObjectException e) { engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); } form.setMode(FormMode.VIEW); ProceduresPerformedByHCPVoCollection hcpProcedures = domain.listProceduresPerformedByHCP( form.qmbHCP().getValue(), form.cmbServices().getValue()); populateTree(hcpProcedures); initialize(); }
private void populateTree(ProceduresPerformedByHCPVoCollection hcpProcedures) { form.treProcedures().clear(); clearPanel(); // WDEV-17694 Vector<HcpLiteVo> hcps = new Vector<HcpLiteVo>(); if (hcpProcedures != null) for (ProceduresPerformedByHCPVo item : hcpProcedures) { TreeNode hcp = null; TreeNode service = null; TreeNode procedure = null; if (item.getPerformingHCPIsNotNull()) { if (!hcps.contains(item.getPerformingHCP())) { if (item.getPerformingHCP().getName() != null) hcp = form.treProcedures() .getNodes() .add(item.getPerformingHCP(), item.getPerformingHCP().getName().toString()); hcp.setExpandedImage(form.getImages().Admin.MemberOfStaff); hcp.setSelectedImage(form.getImages().Admin.MemberOfStaff); hcp.setCollapsedImage(form.getImages().Admin.MemberOfStaff); hcp.setIdentifier(item); hcps.add(item.getPerformingHCP()); } else { for (int k = 0; k < form.treProcedures().getNodes().size(); k++) { HcpLiteVo existingHcp = (HcpLiteVo) form.treProcedures().getNodes().get(k).getValue(); if (existingHcp.equals(item.getPerformingHCP())) hcp = form.treProcedures().getNodes().get(k); } } } if (item.getServiceIsNotNull()) { service = hcp.getNodes().add(item, item.getService().getServiceName()); service.setExpandedImage(form.getImages().Admin.Service); service.setSelectedImage(form.getImages().Admin.Service); service.setCollapsedImage(form.getImages().Admin.Service); } if (item.getProceduresIsNotNull()) { for (int k = 0; k < item.getProcedures().size(); k++) { procedure = service .getNodes() .add( item.getProcedures().get(k), item.getProcedures().get(k).getProcedureName()); procedure.setExpandedImage(form.getImages().Core.BlueSquare); procedure.setSelectedImage(form.getImages().Core.BlueSquare); procedure.setCollapsedImage(form.getImages().Core.BlueSquare); } } } form.treProcedures().expandAll(); form.getLocalContext().setSelectedNode(null); }
// WDEV-20131 private boolean hasTreeNodeProceduresAdded(Object object) { if (object == null || !(object instanceof ProceduresPerformedByHCPVo)) return false; ProceduresPerformedByHCPVo voObj = (ProceduresPerformedByHCPVo) object; if (voObj.getProceduresIsNotNull() && voObj.getProcedures().size() > 0) return true; return false; }