private void showHeaderOrDetailsTab() { if (form.getMode().equals(FormMode.VIEW)) { // In view mode just show the selected node if (form.grdArea().getValue() instanceof StretchingShortVo) form.ctnStretching().lyrStretching().showtabHeader(); else if (form.grdArea().getValue() instanceof StretchingDetailsVo) form.ctnStretching().lyrStretching().showtabDetails(); else form.ctnStretching().lyrStretching().showtabEmpty(); } else { if (form.getLocalContext().getUpdatingParent().equals(Boolean.TRUE)) form.ctnStretching().lyrStretching().showtabHeader(); else form.ctnStretching().lyrStretching().showtabDetails(); } }
private void newParentNode(StretchingVo voNewParent) { if (voNewParent == null) return; StretchingShortVo voParentShort = new StretchingShortVo(); voParentShort.setAuthoringCP(voNewParent.getAuthoringCP()); voParentShort.setAuthoringDateTime(voNewParent.getAuthoringDateTime()); voParentShort.setClinicalContact(voNewParent.getClinicalContact()); GenForm.grdAreaRow parentRow = form.grdArea().getRows().newRow(); if(voParentShort.getAuthoringCP() != null) parentRow.setColArea(voParentShort.getAuthoringDateTime().toString()+ " - " + voParentShort.getAuthoringCP().toString()); parentRow.setValue(voParentShort); parentRow.setBackColor(Color.Beige); form.getLocalContext().setGoldenInstanceSelected(new Boolean(true)); parentRow.setExpanded(true); form.grdArea().setValue(voParentShort); }
private void populateChildCollectionFromGrid(StretchingVo voStretching) { if (form.grdArea().getValue() == null) return; if (voStretching.getStretchingDetails() == null) voStretching.setStretchingDetails(new StretchingDetailsVoCollection()); GenForm.grdAreaRow parentRow = form.grdArea().getValue() instanceof StretchingShortVo ? form.grdArea().getSelectedRow() : form.grdArea().getSelectedRow().getParentRow(); if (parentRow.getRows().size() > 0 ) voStretching.getStretchingDetails().clear(); for (int i=0; i < parentRow.getRows().size(); i++) { voStretching.getStretchingDetails().add((StretchingDetailsVo) parentRow.getRows().get(i).getValue()); } }
private void getSelectedInstance() { // In update mode we can select nodes without displaying anything but the context // menus can change based on what's selected so we need to update them if (form.getMode().equals(FormMode.EDIT)) { updateContextMenusState(); return; } //expand the selected parent if(form.grdArea().getValue() instanceof StretchingShortVo) { form.getLocalContext().setSelectedParentInstance(getParentFromDomain((StretchingShortVo) form.grdArea().getValue())); populateParentInstanceControls(form.getLocalContext().getSelectedParentInstance()); //add activities if not added already populateChildNodes(form.grdArea().getSelectedRow(),form.getLocalContext().getSelectedParentInstance().getStretchingDetails()); form.getLocalContext().setSelectedChildInstance(null); clearChildInstanceControls(); } else if(form.grdArea().getValue() instanceof StretchingDetailsVo) { form.getLocalContext().setSelectedChildInstance((StretchingDetailsVo) form.grdArea().getValue()); populateChildInstanceControls(form.getLocalContext().getSelectedChildInstance()); } if (form.getGlobalContext().Core.getCurrentClinicalContact() == null) form.getLocalContext().setGoldenInstanceSelected(new Boolean(false)); else form.getLocalContext().setGoldenInstanceSelected(new Boolean(form.getLocalContext().getSelectedParentInstance().getClinicalContact().getID_ClinicalContact().equals(form.getGlobalContext().Core.getCurrentClinicalContact().getID_ClinicalContact()))); updateControlsState(); if (form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull()) { form.btnNew().setVisible(false); form.btnUpdate().setVisible(false); } }
private void populateParentNodes(StretchingShortVoCollection voStretchingColl) { if (voStretchingColl == null) return; for(StretchingShortVo stretchingShortVo : voStretchingColl) { populateParentNode(stretchingShortVo); } }
private void populateParentNode(StretchingShortVo voStretching) { if (voStretching == null) return; GenForm.grdAreaRow parRow = form.grdArea().getRows().newRow(); parRow.setColArea((voStretching.getAuthoringDateTimeIsNotNull()?voStretching.getAuthoringDateTime().toString():"") + " - " + (voStretching.getAuthoringCPIsNotNull()? voStretching.getAuthoringCP().toString():"")); //parRow.setTooltip(voRehabParent.getCareContext().toString()); parRow.setValue(voStretching); form.grdArea().setValue(voStretching); expandParentNode(parRow); }
private void expandParentNode(grdAreaRow selectedRow) { if (selectedRow.getValue() instanceof StretchingShortVo == false ) return; StretchingVo voStretching = getParentFromDomain((StretchingShortVo) form.grdArea().getValue()); if(voStretching.getStretchingDetails()==null || voStretching.getStretchingDetails().size()==0){ try { domain.deleteStretchingVo((StretchingShortVo) selectedRow.getValue()); } catch (ForeignKeyViolationException e) { // TODO Auto-generated catch block e.printStackTrace(); } open(); return; } form.getLocalContext().setSelectedParentInstance(getParentFromDomain((StretchingShortVo) selectedRow.getValue())); if (form.getLocalContext().getSelectedParentInstance() == null ) return; StretchingVo 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.getStretchingDetailsIsNotNull()) { selectedRow.setExpanded(true); populateChildNodes(selectedRow, voParentInstance.getStretchingDetails()); } populateParentInstanceControls(voParentInstance); }
private void newChildInstance() { clearChildInstanceControls(); form.getLocalContext().setSelectedChildInstance(null); if (form.grdArea().getValue() instanceof StretchingShortVo) form.grdArea().setValue(form.grdArea().getSelectedRow().getValue()); else if (form.grdArea().getValue() instanceof StretchingDetailsVo) form.grdArea().setValue(form.grdArea().getSelectedRow().getParentRow().getValue()); }
private void removeChild() { StretchingShortVo voParent = (StretchingShortVo) form.grdArea().getSelectedRow().getParentRow().getValue(); form.grdArea().removeSelectedRow(); form.grdArea().setValue(voParent); updateContextMenusState(); }
private void updateInstance() { form.getLocalContext().setUpdatingParent(new Boolean(form.grdArea().getValue() instanceof StretchingShortVo)); form.setMode(FormMode.EDIT); if (form.grdArea().getValue() instanceof StretchingDetailsVo) { StretchingDetailsVo voChild = (StretchingDetailsVo) form.grdArea().getValue(); if ( voChild.getID_StretchingDetails() == null) { populateChildInstanceControls(voChild); } } disableHeaderInfo(); }