private void populateChildNode(grdPneumaticRow childRow, ElectrotherapyPneumaticTreatmentVo voPneumaticTreatment) { if (voPneumaticTreatment == null) return; if(voPneumaticTreatment.getMachineUsed() != null && voPneumaticTreatment.getMachineUsed().getDescriptionIsNotNull()) childRow.setColMachineUsed(voPneumaticTreatment.getMachineUsed().getDescription().toString()); if(voPneumaticTreatment.getStartingPosition() != null) childRow.setColStartingPosition(voPneumaticTreatment.getStartingPosition().toString()); if(voPneumaticTreatment.getArea() != null) childRow.setColArea(voPneumaticTreatment.getArea().toString()); if(voPneumaticTreatment.getCycle() != null) childRow.setColCycle(voPneumaticTreatment.getCycle().toString()); childRow.setValue(voPneumaticTreatment); //if not saved then set the colour if(voPneumaticTreatment.getID_ElectrotherapyPneumaticTreatment() == null) childRow.setTextColor(Color.Red); }
private void setUpdatedChild() { if (form.grdPneumatic().getValue() instanceof ElectrotherapyPneumaticTreatmentVo) { form.getLocalContext().setUpdatedChild((ElectrotherapyPneumaticTreatmentVo) form.grdPneumatic().getValue()); } else { if (form.getLocalContext().getUpdatingParent().equals(Boolean.FALSE)) { if(form.getLocalContext().getSelectedParentInstance().getPneumaticTreatment().size() > 0)//WDEV-439 { form.getLocalContext().getSelectedParentInstance().getPneumaticTreatment().sort(); form.getLocalContext().setUpdatedChild( form.getLocalContext().getSelectedParentInstance().getPneumaticTreatment().get( form.getLocalContext().getSelectedParentInstance().getPneumaticTreatment().size() - 1)); } } } }
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 newChildNode(ElectrotherapyPneumaticTreatmentVo voPneumaticTreatment) { if (form.getLocalContext().getSelectedChildInstance() != null) return false; if (voPneumaticTreatment.countFieldsWithValue() >= 1) { String strErrors[] = voPneumaticTreatment.validate(); if(strErrors != null && strErrors.length > 0) { engine.showErrors(strErrors); return false; } promoteChild(voPneumaticTreatment); clearChildInstanceControls(); return true; } return false; }
private void promoteChild(ElectrotherapyPneumaticTreatmentVo voPneumaticTreatment) { if (voPneumaticTreatment == null) return; GenForm.grdPneumaticRow childRow = null; form.grdPneumatic().setValue(form.getLocalContext().getSelectedParentInstance()); if(form.grdPneumatic().getValue() != null) { if(form.grdPneumatic().getSelectedRow().getValue() instanceof ElectrotherapyPneumaticTreatmentVo) childRow = form.grdPneumatic().getSelectedRow().getParentRow().getRows().newRow(); else childRow = form.grdPneumatic().getSelectedRow().getRows().newRow(); populateChildNode(childRow, voPneumaticTreatment); } }
private void setDetailsTabVisibility() { if (form.getMode().equals(FormMode.VIEW)) { form.ctnPneumatic().lyrPneumatic().tabDetails().setHeaderVisible(form.grdPneumatic().getValue() instanceof ElectrotherapyPneumaticTreatmentVo); } else { form.ctnPneumatic().lyrPneumatic().tabDetails().setHeaderVisible(form.getLocalContext().getSelectedParentInstanceIsNotNull() && Boolean.FALSE.equals(form.getLocalContext().getUpdatingParent())); //WDEV-14292 setAddApplyCaption(); } enableDetailsButtons(); }
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); } }
private void promoteUpdatedChild(ElectrotherapyPneumaticTreatmentVo voPneumaticTreatment) { if (voPneumaticTreatment == null) return; form.grdPneumatic().setValue(form.getLocalContext().getSelectedChildInstance()); populateChildNode(form.grdPneumatic().getSelectedRow(),voPneumaticTreatment); }
private void updateInstance() { form.getLocalContext().setUpdatingParent(new Boolean(form.grdPneumatic().getValue() instanceof ElectrotherapyPneumaticShortVo)); form.setMode(FormMode.EDIT); if (form.grdPneumatic().getValue() instanceof ElectrotherapyPneumaticTreatmentVo) { ElectrotherapyPneumaticTreatmentVo voCachedChild = (ElectrotherapyPneumaticTreatmentVo) form.grdPneumatic().getValue(); if ( voCachedChild.getID_ElectrotherapyPneumaticTreatment() == null) { populateChildInstanceControls(voCachedChild); } } }
private void setAddApplyCaption() { form.ctnPneumatic().lyrPneumatic().tabDetails().btnOK().setText("Add"); if (form.getLocalContext().getSelectedChildInstance() == null && (form.grdPneumatic().getValue() instanceof ElectrotherapyPneumaticTreatmentVo)) form.ctnPneumatic().lyrPneumatic().tabDetails().btnOK().setText("Apply"); }
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(); }
private void populateChildInstanceControls(ElectrotherapyPneumaticTreatmentVo voChildInstance) { if(voChildInstance == null) return; populateScreenFromData(voChildInstance); if(voChildInstance.getMachineUsedIsNotNull()) { form.ctnPneumatic().lyrPneumatic().tabDetails().txtModel().setValue(voChildInstance.getMachineUsed().getModel()); form.ctnPneumatic().lyrPneumatic().tabDetails().txtSerialNumber().setValue(voChildInstance.getMachineUsed().getSerialNumber()); } form.getLocalContext().setSelectedChildInstance(voChildInstance); }