@Override protected void onMessageBoxClosed(int messageBoxId, DialogResult result) throws PresentationLogicException { if (form.getLocalContext().getMessageBoxIsNotNull()) if (messageBoxId == form.getLocalContext().getMessageBox() && result.equals(DialogResult.YES)) { if (form.treProcedures().getSelectedNode() != null && form.treProcedures().getSelectedNode().getIdentifier() != null && form.treProcedures().getSelectedNode().getIdentifier() instanceof ProceduresPerformedByHCPVo) try { domain.removeProcedure((ProceduresPerformedByHCPVo) form.treProcedures().getSelectedNode().getIdentifier()); populateTree(domain.listProceduresPerformedByHCP(form.qmbHCP().getValue(), form.cmbServices().getValue())); } catch (ForeignKeyViolationException e) { e.printStackTrace(); } initialize(); } }
private void treeSelectionChanged(TreeNode node) { if (node != null && node.getValue() != null) { if (node.getValue() instanceof HcpLiteVo) { form.getLocalContext().setSelectedNode("HCP"); form.getLocalContext().setSelectedHcp((HcpLiteVo) node.getValue()); form.getLocalContext().setSelectedProcedurePerf((ProceduresPerformedByHCPVo) node.getNodes().get(0).getValue()); if (domain.getAvailableServices(form.getLocalContext().getSelectedHcp().toHcpRefVo()) != null) form.getLocalContext().setAreServicesAvailable(true); else form.getLocalContext().setAreServicesAvailable(false); } else if (node.getValue() instanceof ProceduresPerformedByHCPVo) { form.getLocalContext().setSelectedNode("Service"); form.getLocalContext().setSelectedProcedurePerf((ProceduresPerformedByHCPVo) node.getValue()); } else if (node.getValue() instanceof ProcedureLiteVo) { form.getLocalContext().setSelectedNode("Procedure"); form.getLocalContext().setSelectedProcedurePerf((ProceduresPerformedByHCPVo) node.getParent().getValue()); } else form.getLocalContext().setSelectedNode(null); } else form.getLocalContext().setSelectedProcedurePerf(null); populatePanel(form.getLocalContext().getSelectedProcedurePerf()); updateContextMenuStatus(); }
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)); } }
public void saveProcedurePerformedByHCP(ProceduresPerformedByHCPVo procedure) throws StaleObjectException, DomainRuntimeException { DomainFactory factory=getDomainFactory(); if (!procedure.isValidated()) { throw new DomainRuntimeException("This Procedure has not be validated."); } if (procedure!=null) { factory.save(ProceduresPerformedByHCPVoAssembler.extractProceduresPerformedByHCP(factory, procedure)); } }
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; }
@Override protected void onContextMenuItemClick(int menuItemID, Control sender) throws PresentationLogicException { DynamicGridRow row; switch (menuItemID) { case GenForm.ContextMenus.ClinicalNamespace.ProcedurePerformedHCP.NewserviceandproceduresperformedbyHCP : clearPanel(); if (form.getLocalContext().getAreHcpsAvailableIsNotNull() && !form.getLocalContext().getAreHcpsAvailable()) { engine.showMessage("All the available HCP and Services are already in use or none exist", "Message", MessageButtons.OK); break; } form.setMode(FormMode.EDIT); form.getLocalContext().setIsNewNode(true); form.getLocalContext().setIsNewProcedure(false); form.getLocalContext().setIsNewService(false); populateServicePanelCombo(form.getLocalContext().getServiceList()); form.treProcedures().setValue(null); form.getLocalContext().setSelectedProcedurePerf(new ProceduresPerformedByHCPVo()); updateContextMenuStatus(); break; case GenForm.ContextMenus.ClinicalNamespace.ProcedurePerformedHCP.ADDSERVICE : if (form.getLocalContext().getAreServicesAvailableIsNotNull() && !form.getLocalContext().getAreServicesAvailable()) { engine.showMessage("There are no more available Services for this HCP", "Message", MessageButtons.OK); break; } form.setMode(FormMode.EDIT); form.getLocalContext().setIsNewNode(false); form.getLocalContext().setIsNewProcedure(false); form.getLocalContext().setIsNewService(true); form.getLocalContext().setAvailableServiceList(domain.getAvailableServices(form.getLocalContext().getSelectedHcp().toHcpRefVo())); form.cmbServicesPanel().setEnabled(true); populatePanel(form.treProcedures().getSelectedNode()); updateContextMenuStatus(); form.dyngrdProcedures().getRows().clear(); break; case GenForm.ContextMenus.ClinicalNamespace.ProcedurePerformedHCP.ADDPROCEDURES : form.setMode(FormMode.EDIT); form.getLocalContext().setIsNewNode(false); form.getLocalContext().setIsNewProcedure(true); form.getLocalContext().setIsNewService(false); populatePanel(form.treProcedures().getSelectedNode()); updateContextMenuStatus(); break; case GenForm.ContextMenus.ClinicalNamespace.ProcedurePerformedHCP.EDITHCP : form.setMode(FormMode.EDIT); form.getLocalContext().seteditHcp(true); form.getLocalContext().setAvailableServiceList(domain.listActiveServices()); populatePanel(form.treProcedures().getSelectedNode()); updateContextMenuStatus(); break; case GenForm.ContextMenus.ClinicalNamespace.ProcedurePerformedHCP.REMOVEPROCEDURE : form.getLocalContext().setMessageBox(engine.showMessage("Are you sure you want to remove this Procedure Performed by HCP?", "Message", MessageButtons.YESNO)); break; case GenForm.ContextMenus.ClinicalNamespace.ProcedureGrid.ADDPROCEDURE : row = form.dyngrdProcedures().getRows().newRow(); DynamicGridCell cell = row.getCells().newCell(form.dyngrdProcedures().getColumns().getByIdentifier(COLUMN_PROC), DynamicCellType.QUERYCOMBOBOX); cell.setAutoPostBack(true); form.dyngrdProcedures().getRows(); break; case GenForm.ContextMenus.ClinicalNamespace.ProcedureGrid.REMOVEPROCEDURE : form.dyngrdProcedures().getRows().remove(form.dyngrdProcedures().getSelectedRow()); updateContextMenuStatus(); break; } }
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); }
public void removeProcedure(ProceduresPerformedByHCPVo procedure) throws ForeignKeyViolationException { DomainFactory factory=getDomainFactory(); if (procedure!=null) factory.delete(ProceduresPerformedByHCPVoAssembler.extractProceduresPerformedByHCP(factory, procedure)); }