private void setDetailsTabVisibility() { if (form.getMode().equals(FormMode.VIEW)) { // In view mode, make the details tab visible if a detail instance is selected in the hierarchy grid. form.ctnDetail().lyrBoBath().tabAreaDetail().setHeaderVisible(form.gridDetails().getValue() instanceof BobathTreatmentVo); } else { // In edit mode, make the details tab visible if a hierarchy item has been selected and we're not // editing a parent. form.ctnDetail().lyrBoBath().tabAreaDetail().setHeaderVisible(form.getLocalContext().getSelectedParentInstanceIsNotNull() && form.getLocalContext().getUpdatingParent().equals(Boolean.FALSE)); setAddApplyCaption(); } enableDetailsButtons(); }
private void setUpdatedChild() { // Straight child update - Select the currently being updated child as the one so show - post save if (form.gridDetails().getValue() instanceof BobathTreatmentVo) { form.getLocalContext().setUpdatedChild((BobathTreatmentVo) form.gridDetails().getValue()); } else { // Find the most recently added child if (form.getLocalContext().getUpdatingParent().equals(Boolean.FALSE)) { form.getLocalContext().getSelectedParentInstance().getBobathTreatment().sort(); form.getLocalContext().setUpdatedChild( form.getLocalContext().getSelectedParentInstance().getBobathTreatment().get( form.getLocalContext().getSelectedParentInstance().getBobathTreatment().size() - 1)); } } }
private void populateChildCollectionFromGrid(BobathVo voBobath) { if (form.gridDetails().getValue() == null) return; if (voBobath.getBobathTreatment() == null) voBobath.setBobathTreatment(new BobathTreatmentVoCollection()); GenForm.gridDetailsRow parentRow = form.gridDetails().getValue() instanceof BobathVo || form.gridDetails().getValue() instanceof BobathShortVo ? form.gridDetails().getSelectedRow() : form.gridDetails().getSelectedRow().getParentRow(); if (parentRow.getRows().size() > 0 ) voBobath.getBobathTreatment().clear(); for (int i=0; i < parentRow.getRows().size(); i++) { voBobath.getBobathTreatment().add((BobathTreatmentVo) parentRow.getRows().get(i).getValue()); } }
private boolean newChildNode(BobathTreatmentVo voBobathTreatment) { if (form.getLocalContext().getSelectedChildInstance() != null) return false; if (voBobathTreatment.countFieldsWithValue() >= 1) { String strErrors[] = voBobathTreatment.validate(); if(strErrors != null && strErrors.length > 0) { engine.showErrors(strErrors); return true; } promoteChild(voBobathTreatment); clearChildInstanceControls(); } return false; }
private void promoteChild(BobathTreatmentVo voBobathTreatment) { if (voBobathTreatment == null) return; GenForm.gridDetailsRow childRow = null; form.gridDetails().setValue(form.getLocalContext().getUpdatingParentInstance()); if(form.gridDetails().getValue() != null) { if(form.gridDetails().getSelectedRow().getValue() instanceof BobathTreatmentVo) childRow = form.gridDetails().getSelectedRow().getParentRow().getRows().newRow(); else childRow = form.gridDetails().getSelectedRow().getRows().newRow(); } //GenForm.gridDetailsRow childRow = form.gridDetails().getSelectedRow().getRows().newRow(); populateChildNode(childRow, voBobathTreatment); }
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.gridDetails().getValue() == null || ((form.getLocalContext().getSelectedParentInstanceIsNotNull() && form.getLocalContext().getGoldenInstanceSelected().equals(Boolean.FALSE)))) { newParentInstance(); } // New instance has been invoked with a child node selected. if (form.gridDetails().getValue() instanceof BobathTreatmentVo) { newChildInstance(); } form.setMode(FormMode.EDIT); }
private void showHeaderOrDetailsTab() { if (form.getMode().equals(FormMode.VIEW)) { // In view mode just show the selected node if (form.gridDetails().getValue() instanceof BobathShortVo) form.ctnDetail().lyrBoBath().showtabBoBath(); else if (form.gridDetails().getValue() instanceof BobathVo) form.ctnDetail().lyrBoBath().showtabBoBath(); else if (form.gridDetails().getValue() instanceof BobathTreatmentVo) form.ctnDetail().lyrBoBath().showtabAreaDetail(); enableParentControls(false); } else { if (form.getLocalContext().getSelectedParentInstanceIsNotNull() && (form.getLocalContext().getSelectedParentInstance().getID_BobathIsNotNull())) enableParentControls(false); //on update else enableParentControls(true); //new record if (form.getLocalContext().getUpdatingParent().equals(Boolean.TRUE)) form.ctnDetail().lyrBoBath().showtabBoBath(); else form.ctnDetail().lyrBoBath().showtabAreaDetail(); } }
private void setAddApplyCaption() { form.ctnDetail().lyrBoBath().tabAreaDetail().btnOk().setText("Add"); if (form.getLocalContext().getSelectedChildInstance() == null && (form.gridDetails().getValue() instanceof BobathTreatmentVo)) form.ctnDetail().lyrBoBath().tabAreaDetail().btnOk().setText("Apply"); }
private void populateChildInstanceControls(BobathTreatmentVo voBobathTreat) { if (voBobathTreat == null ) return; form.ctnDetail().lyrBoBath().tabAreaDetail().txtAreaTreated().setValue(voBobathTreat.getAreaTreated()); form.ctnDetail().lyrBoBath().tabAreaDetail().txtPosition().setValue(voBobathTreat.getPosition()); form.ctnDetail().lyrBoBath().tabAreaDetail().txtAnalysis().setValue(voBobathTreat.getAnalysis()); form.ctnDetail().lyrBoBath().tabAreaDetail().txtClinical().setValue(voBobathTreat.getClinicalReasoning()); form.getLocalContext().setSelectedChildInstance(voBobathTreat); }
private void populateChildNode(gridDetailsRow childRow, BobathTreatmentVo voBobathTreat) { if (voBobathTreat == null) return; childRow.setValue(voBobathTreat); childRow.setColAreaTreated(voBobathTreat.getAreaTreated()); childRow.setColPosition(voBobathTreat.getPosition()); childRow.setColAnalysis(voBobathTreat.getAnalysis()); childRow.setColClinicalReasoning(voBobathTreat.getClinicalReasoning()); //if not saved then set the colour if(voBobathTreat.getID_BobathTreatment() == null) childRow.setTextColor(Color.Red); }
private void populateChildInstanceData(BobathTreatmentVo voBobathTreatment) { voBobathTreatment.setAnalysis(form.ctnDetail().lyrBoBath().tabAreaDetail().txtAnalysis().getValue()); voBobathTreatment.setAreaTreated(form.ctnDetail().lyrBoBath().tabAreaDetail().txtAreaTreated().getValue()); voBobathTreatment.setClinicalReasoning(form.ctnDetail().lyrBoBath().tabAreaDetail().txtClinical().getValue()); voBobathTreatment.setPosition(form.ctnDetail().lyrBoBath().tabAreaDetail().txtPosition().getValue()); }
private void updateInstance() { form.getLocalContext().setUpdatingParent(new Boolean(form.gridDetails().getValue() instanceof BobathShortVo)); form.setMode(FormMode.EDIT); if (form.gridDetails().getValue() instanceof BobathTreatmentVo) { BobathTreatmentVo voCachedChild = (BobathTreatmentVo) form.gridDetails().getValue(); if ( voCachedChild.getID_BobathTreatment() == null) { populateChildInstanceControls(voCachedChild); } } }