private void expandParentNode(grdSummaryRow selectedRow) { if (selectedRow.getValue() instanceof StandingSessionShortVo == false ) return; form.getLocalContext().setSelectedParentInstance(getParentFromDomain((StandingSessionShortVo) selectedRow.getValue())); if (form.getLocalContext().getSelectedParentInstance() == null ) return; StandingSessionVo voParentInstance = form.getLocalContext().getSelectedParentInstance(); if(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.getFrameExercise() != null || voParentInstance.getTiltTableExercise() != null) { selectedRow.setExpanded(true); populateChildNodes(selectedRow, voParentInstance); } populateParentInstanceControls(voParentInstance); }
private void populateChildCollectionFromGrid(StandingSessionVo voStandingSession) { if (form.grdSummary().getValue() == null) return; if (voStandingSession.getFrameExercise() == null) voStandingSession.setFrameExercise(new FrameExerciseVoCollection()); if(voStandingSession.getTiltTableExercise() == null) voStandingSession.setTiltTableExercise(new TiltExerciseVoCollection()); GenForm.grdSummaryRow parentRow = form.grdSummary().getValue() instanceof StandingSessionShortVo || form.grdSummary().getValue() instanceof StandingSessionVo ? form.grdSummary().getSelectedRow() : form.grdSummary().getSelectedRow().getParentRow(); if (parentRow.getRows().size() > 0 ) { voStandingSession.getTiltTableExercise().clear(); voStandingSession.getFrameExercise().clear(); } for (int i=0; i < parentRow.getRows().size(); i++) { if(parentRow.getRows().get(i).getValue() instanceof TiltExerciseVo) voStandingSession.getTiltTableExercise().add((TiltExerciseVo) parentRow.getRows().get(i).getValue()); if(parentRow.getRows().get(i).getValue() instanceof FrameExerciseVo) voStandingSession.getFrameExercise().add((FrameExerciseVo) parentRow.getRows().get(i).getValue()); } }
private void newInstance() { // New instance has been invoked for a parent instance with no current selection made OR // with a parent that is not the Golden node.. if (form.grdSummary().getValue() == null || ((form.getLocalContext().getSelectedParentInstanceIsNotNull() && form.getLocalContext().getGoldenInstanceSelected().equals(Boolean.FALSE)))) { newParentInstance(); } // New instance has been invoked with a child node selected. if (form.grdSummary().getValue() instanceof StandingSessionVo || (form.grdSummary().getValue() instanceof FrameExerciseVo || form.grdSummary().getValue() instanceof TiltExerciseVo)) { newChildInstance(); } form.setMode(FormMode.EDIT); }
/** * saves Standing */ public StandingSessionVo save(ims.therapies.vo.StandingSessionVo voStandingSession) throws ims.domain.exceptions.StaleObjectException, UniqueKeyViolationException { if(!voStandingSession.isValidated()) throw new DomainRuntimeException("This Standing Session has not been validated"); if (voStandingSession.getID_StandingSession() == null && getStandingSessionByClinicalContact(voStandingSession.getClinicalContact()) != null) throw new UniqueKeyViolationException("The screen will be refreshed."); DomainFactory factory = getDomainFactory(); StandingSession doStanding = StandingSessionVoAssembler.extractStandingSession(factory, voStandingSession); factory.save(doStanding); return StandingSessionVoAssembler.create(doStanding); }
private void populateParentInstanceControls(StandingSessionVo voStandingParent) { if(voStandingParent != null) { form.ctnStand().lyrParent().tabHeader().dtimAuthoringDateTime().setValue(voStandingParent.getAuthoringDateTime()); if(voStandingParent.getAuthoringCPIsNotNull()) form.ctnStand().lyrParent().tabHeader().qmbAuthoringCP().newRow(voStandingParent.getAuthoringCP(), voStandingParent.getAuthoringCP().toString()); form.ctnStand().lyrParent().tabHeader().qmbAuthoringCP().setValue(voStandingParent.getAuthoringCP()); } }
private void populateChildNodes(grdSummaryRow parRow, StandingSessionVo voParentInstance) { GenForm.grdSummaryRow childRow; FrameExerciseVoCollection voFrameColl = voParentInstance.getFrameExercise(); TiltExerciseVoCollection voTiltColl = voParentInstance.getTiltTableExercise(); if ((voFrameColl == null && voFrameColl.size()<=0) || (voTiltColl == null && voTiltColl.size()<=0)) return; voFrameColl.sort(); voTiltColl.sort(); for(int i=0; i<voFrameColl.size(); i++) { if (parRow != null) { childRow = parRow.getRows().newRow(); populateChildNode(childRow, voFrameColl.get(i)); } } for(int z=0; z<voTiltColl.size(); z++) { if (parRow != null) { childRow = parRow.getRows().newRow(); populateChildNode(childRow, voTiltColl.get(z)); } } //reselect parent parRow.setValue(form.getLocalContext().getSelectedParentInstance()); form.grdSummary().setValue(parRow.getValue()); parRow.setExpanded(true); }
private void showHeaderOrDetailsTab() { if (form.getMode().equals(FormMode.VIEW)) { // In view mode just show the selected node if (form.grdSummary().getValue() instanceof StandingSessionShortVo) form.ctnStand().lyrParent().showtabHeader(); else if (form.grdSummary().getValue() instanceof StandingSessionVo) form.ctnStand().lyrParent().showtabHeader(); else if (form.grdSummary().getValue() instanceof FrameExerciseVo) form.ctnStand().lyrParent().showtabDetails(); else if (form.grdSummary().getValue() instanceof TiltExerciseVo) form.ctnStand().lyrParent().showtabDetails(); enableParentControls(false); } else { if (form.getLocalContext().getUpdatingParent().equals(Boolean.TRUE)) form.ctnStand().lyrParent().showtabHeader(); else form.ctnStand().lyrParent().showtabDetails(); if (form.getLocalContext().getSelectedParentInstanceIsNotNull() && (form.getLocalContext().getSelectedParentInstance().getID_StandingSessionIsNotNull())) enableParentControls(false); //on update else enableParentControls(true); //new record } }
private void newParentInstance() { StandingSessionVo voNewParent = new StandingSessionVo(); Hcp voHcp = (Hcp) domain.getHcpUser(); if(voHcp != null) voNewParent.setAuthoringCP(voHcp); voNewParent.setAuthoringDateTime(new DateTime()); voNewParent.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact()); voNewParent.setTiltTableExercise(new TiltExerciseVoCollection()); populateParentInstanceControls(voNewParent); form.getLocalContext().setSelectedParentInstance(voNewParent); }
private boolean newParentNode(StandingSessionVo voNewParent) { if (voNewParent == null) return true; StandingSessionShortVo voParentShort = new StandingSessionShortVo(); voParentShort.setAuthoringCP(form.ctnStand().lyrParent().tabHeader().qmbAuthoringCP().getValue()); voParentShort.setAuthoringDateTime(form.ctnStand().lyrParent().tabHeader().dtimAuthoringDateTime().getValue()); voParentShort.setClinicalContact(voNewParent.getClinicalContact()); String[] errors = voParentShort.validate(); if(errors != null && errors.length > 0) { engine.showErrors(errors); return false; } GenForm.grdSummaryRow parentRow = form.grdSummary().getRows().newRow(); if(voParentShort.getAuthoringCPIsNotNull()) parentRow.setColDateSupportType(voParentShort.getAuthoringDateTime().toString()+ " - " + voParentShort.getAuthoringCP().toString()); parentRow.setValue(voParentShort); parentRow.setBackColor(Color.Beige); form.getLocalContext().setGoldenInstanceSelected(new Boolean(true)); parentRow.setExpanded(true); form.grdSummary().setValue(voParentShort); return true; }
public StandingSessionVo getStandingSessionByClinicalContact(ClinicalContactRefVo voClinicalContactRef) { if(voClinicalContactRef == null) throw new CodingRuntimeException("Standing Session Filter not provided for get call. "); String hql = new String("from StandingSession s where s.clinicalContact.id = :CLINICAL_CONTACT_ID"); java.util.List list = getDomainFactory().find(hql, "CLINICAL_CONTACT_ID", voClinicalContactRef.getID_ClinicalContact()); StandingSessionVoCollection vo = StandingSessionVoAssembler.createStandingSessionVoCollectionFromStandingSession(list); if(vo!=null && vo.size()>0 ) return vo.get(0); else return null; }
public StandingSessionVo getStanding(StandingSessionRefVo standing) { if(standing == null || standing.getID_StandingSession() == null) throw new CodingRuntimeException("Cannot get StandingSession on null Id."); return StandingSessionVoAssembler.create((StandingSession) getDomainFactory().getDomainObject(StandingSession.class, standing.getID_StandingSession())); }