private void expandParentNode(grdPneumaticRow selectedRow) { if (selectedRow.getValue() instanceof ElectrotherapyPneumaticShortVo == false ) return; form.getLocalContext().setSelectedParentInstance(getParentFromDomain((ElectrotherapyPneumaticShortVo) selectedRow.getValue())); if (form.getLocalContext().getSelectedParentInstance() == null ) return; ElectrotherapyPneumaticVo voParentInstance = form.getLocalContext().getSelectedParentInstance(); if(form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull() && (voParentInstance.getClinicalContact().getID_ClinicalContact().equals (form.getGlobalContext().Core.getCurrentClinicalContact().getID_ClinicalContact()))) { // If this is the Golden Node then we'll colour it golden (ok then beige). form.getLocalContext().setGoldenInstanceFound(new Boolean(true)); form.getLocalContext().setGoldenInstanceSelected(new Boolean(true)); selectedRow.setBackColor(Color.Beige); } if (voParentInstance.getPneumaticTreatment() != null) { selectedRow.setValue(voParentInstance); selectedRow.setExpanded(true); populateChildNodes(selectedRow, voParentInstance.getPneumaticTreatment()); } populateParentInstanceControls(voParentInstance); }
private void populateChildCollectionFromGrid(ElectrotherapyPneumaticVo voElectrotherapyPneumatic) { if (form.grdPneumatic().getValue() == null) return; if (voElectrotherapyPneumatic.getPneumaticTreatment() == null) voElectrotherapyPneumatic.setPneumaticTreatment(new ElectrotherapyPneumaticTreatmentVoCollection()); GenForm.grdPneumaticRow parentRow = form.grdPneumatic().getValue() instanceof ElectrotherapyPneumaticShortVo || form.grdPneumatic().getValue() instanceof ElectrotherapyPneumaticVo ? form.grdPneumatic().getSelectedRow() : form.grdPneumatic().getSelectedRow().getParentRow(); if (parentRow.getRows().size() > 0 ) voElectrotherapyPneumatic.getPneumaticTreatment().clear(); for (int i=0; i < parentRow.getRows().size(); i++) { voElectrotherapyPneumatic.getPneumaticTreatment().add((ElectrotherapyPneumaticTreatmentVo) parentRow.getRows().get(i).getValue()); } }
private boolean newParentNode(ElectrotherapyPneumaticVo voNewParent) { if (voNewParent == null) return true; if(form.ctnPneumatic().lyrPneumatic().tabPneumatic().qmbAuthoringCP().getValue()==null || form.ctnPneumatic().lyrPneumatic().tabPneumatic().dtimAuthoringDateTime().getValue() == null) { engine.showMessage("'Authoring HCP' and 'Authoring Date / Time' are a mandatory fields."); return false; } ElectrotherapyPneumaticShortVo voParentShort = new ElectrotherapyPneumaticShortVo(); voParentShort.setAuthoringCP(form.ctnPneumatic().lyrPneumatic().tabPneumatic().qmbAuthoringCP().getValue()); voParentShort.setAuthoringDateTime(form.ctnPneumatic().lyrPneumatic().tabPneumatic().dtimAuthoringDateTime().getValue()); voParentShort.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact()); GenForm.grdPneumaticRow parentRow = form.grdPneumatic().getRows().newRow(); parentRow.setColMachineUsed(voParentShort.getAuthoringDateTime().toString()+ " - " + voParentShort.getAuthoringCP().toString()); parentRow.setValue(voParentShort); parentRow.setBackColor(Color.Beige); form.getLocalContext().setGoldenInstanceSelected(new Boolean(true)); parentRow.setExpanded(true); form.grdPneumatic().setValue(voParentShort); return true; }
private void showHeaderOrDetailsTab() { if (form.getMode().equals(FormMode.VIEW)) { if (form.grdPneumatic().getValue() instanceof ElectrotherapyPneumaticShortVo) form.ctnPneumatic().lyrPneumatic().showtabPneumatic(); else if(form.grdPneumatic().getValue() instanceof ElectrotherapyPneumaticVo) form.ctnPneumatic().lyrPneumatic().showtabPneumatic(); else if (form.grdPneumatic().getValue() instanceof ElectrotherapyPneumaticTreatmentVo) form.ctnPneumatic().lyrPneumatic().showtabDetails(); } else { if (form.getLocalContext().getUpdatingParent().equals(Boolean.TRUE)) form.ctnPneumatic().lyrPneumatic().showtabPneumatic(); else form.ctnPneumatic().lyrPneumatic().showtabDetails(); if (form.getLocalContext().getSelectedParentInstanceIsNotNull() && (form.getLocalContext().getSelectedParentInstance().getID_ElectrotherapyPneumaticIsNotNull())) enableParentControls(false); else enableParentControls(true); } }
public ElectrotherapyPneumaticVo saveElectrotherapyPneumaticTreatmentVo(ElectrotherapyPneumaticVo electrotherapyPneumaticTreatmentVo) throws StaleObjectException, UniqueKeyViolationException { if(electrotherapyPneumaticTreatmentVo == null) throw new CodingRuntimeException ("ElectrotherapyPneumaticVo is null"); if (!electrotherapyPneumaticTreatmentVo.isValidated()) throw new DomainRuntimeException ("This ElectrotherapyPneumaticVo has not been validated"); DomainFactory factory = getDomainFactory(); if (electrotherapyPneumaticTreatmentVo.getID_ElectrotherapyPneumatic() == null)//Inserting a record { ElectrotherapyPneumaticVo vo = getElectrotheraphyPneumaticVoByClinicalContact(electrotherapyPneumaticTreatmentVo.getClinicalContact()); if(vo != null) throw new UniqueKeyViolationException("The screen will be refreshed"); } ElectrotherapyPneumatic domElectrotherapyPneumatic = ElectrotherapyPneumaticVoAssembler.extractElectrotherapyPneumatic(factory, electrotherapyPneumaticTreatmentVo); factory.save(domElectrotherapyPneumatic); return ElectrotherapyPneumaticVoAssembler.create(domElectrotherapyPneumatic); }
private void newParentInstance() { ElectrotherapyPneumaticVo voNewParent = new ElectrotherapyPneumaticVo(); Hcp voHcp = (Hcp) domain.getHcpUser(); if(voHcp != null) voNewParent.setAuthoringCP(voHcp); voNewParent.setAuthoringDateTime(new DateTime()); voNewParent.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact()); voNewParent.setPneumaticTreatment(new ElectrotherapyPneumaticTreatmentVoCollection()); populateParentInstanceControls(voNewParent); clearChildInstanceControls(); form.getLocalContext().setSelectedParentInstance(voNewParent); form.getLocalContext().setSelectedChildInstance(null); }
private void populateParentInstanceControls(ElectrotherapyPneumaticVo voElectrotherapyPneumatic) { if(voElectrotherapyPneumatic != null) { form.ctnPneumatic().lyrPneumatic().tabPneumatic().dtimAuthoringDateTime().setValue(voElectrotherapyPneumatic.getAuthoringDateTime()); if(voElectrotherapyPneumatic.getAuthoringCPIsNotNull()) form.ctnPneumatic().lyrPneumatic().tabPneumatic().qmbAuthoringCP().newRow(voElectrotherapyPneumatic.getAuthoringCP(), voElectrotherapyPneumatic.getAuthoringCP().toString()); form.ctnPneumatic().lyrPneumatic().tabPneumatic().qmbAuthoringCP().setValue(voElectrotherapyPneumatic.getAuthoringCP()); form.ansWarning().setValue(voElectrotherapyPneumatic.getWarningGiven()); } }
private void getSelectedInstance() { if (form.getMode().equals(FormMode.EDIT)) { updateContextMenusState(); return; } if(form.grdPneumatic().getValue() instanceof ElectrotherapyPneumaticVo) { populateParentInstanceControls((ElectrotherapyPneumaticVo) form.grdPneumatic().getValue()); } else if(form.grdPneumatic().getValue() instanceof ElectrotherapyPneumaticShortVo) { form.getLocalContext().setSelectedParentInstance(getParentFromDomain((ElectrotherapyPneumaticShortVo) form.grdPneumatic().getValue())); if (form.getLocalContext().getSelectedParentInstanceIsNotNull()) { populateParentInstanceControls(form.getLocalContext().getSelectedParentInstance()); populateChildNodes(form.grdPneumatic().getSelectedRow(),form.getLocalContext().getSelectedParentInstance().getPneumaticTreatment()); } form.getLocalContext().setSelectedChildInstance(null); clearChildInstanceControls(); } else if(form.grdPneumatic().getValue() instanceof ElectrotherapyPneumaticTreatmentVo) { GenForm.grdPneumaticRow parentRow = form.grdPneumatic().getSelectedRow().getParentRow(); populateParentInstanceControls((ElectrotherapyPneumaticVo) parentRow.getValue()); form.getLocalContext().setSelectedParentInstance((ElectrotherapyPneumaticVo) parentRow.getValue()); form.getLocalContext().setSelectedChildInstance((ElectrotherapyPneumaticTreatmentVo) form.grdPneumatic().getValue()); populateChildInstanceControls(form.getLocalContext().getSelectedChildInstance()); } if(form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull()) form.getLocalContext().setGoldenInstanceSelected(form.getLocalContext().getSelectedParentInstanceIsNotNull() ? new Boolean(form.getLocalContext().getSelectedParentInstance().getClinicalContact().getID_ClinicalContact().equals(form.getGlobalContext().Core.getCurrentClinicalContact().getID_ClinicalContact())): false); updateControlsState(); }
public ElectrotherapyPneumaticVo getElectrotheraphyPneumaticVoByClinicalContact(ClinicalContactRefVo voClinicalContactRef) { if(voClinicalContactRef == null) throw new CodingRuntimeException("ElectrotherapyPneumatic Filter not provided for get call. "); String hql = new String("from ElectrotherapyPneumatic p where p.clinicalContact.id = :CLINICAL_CONTACT_ID"); java.util.List list = getDomainFactory().find(hql, "CLINICAL_CONTACT_ID", voClinicalContactRef.getID_ClinicalContact()); ElectrotherapyPneumaticVoCollection coll = ElectrotherapyPneumaticVoAssembler.createElectrotherapyPneumaticVoCollectionFromElectrotherapyPneumatic(list); if(coll!=null && coll.size()>0) return coll.get(0); else return null; }
public ElectrotherapyPneumaticVo getElectrotheraphyPneumatic(ElectrotherapyPneumaticRefVo electrotherapyPneumatic) { if(electrotherapyPneumatic == null || electrotherapyPneumatic.getID_ElectrotherapyPneumatic() == null) throw new CodingRuntimeException("Cannot get ElectrotherapyPneumatic on null Id."); return ElectrotherapyPneumaticVoAssembler.create((ElectrotherapyPneumatic) getDomainFactory().getDomainObject(ElectrotherapyPneumatic.class, electrotherapyPneumatic.getID_ElectrotherapyPneumatic())); }