private void populateChildNode(grdTreatmentsRow childRow, MobilisationsTreatmentVo voMobTreatment) { if (voMobTreatment == null) return; childRow.setValue(voMobTreatment); if(voMobTreatment.getTreatmentType() != null) childRow.setColTreatment(voMobTreatment.getTreatmentType().toString()); if(voMobTreatment.getReason() != null) childRow.setColReason(voMobTreatment.getReason().toString()); if(voMobTreatment.getAreaTreated() != null) childRow.setColAreaTreated(voMobTreatment.getAreaTreated().toString()); //if not saved then set the colour if(voMobTreatment.getID_MobilisationsTreatment() == null) childRow.setTextColor(Color.Red); }
private void setUpdatedChild() { //Straight child update - Select the currently being updated child as the one so show - post save if (form.grdTreatments().getValue() instanceof MobilisationsTreatmentVo) { form.getLocalContext().setUpdatedChild((MobilisationsTreatmentVo) form.grdTreatments().getValue()); } else { // Find the most recently added child if (form.getLocalContext().getUpdatingParent().equals(Boolean.FALSE)) { form.getLocalContext().getSelectedParentInstance().getMobilisationsTreatment().sort(); form.getLocalContext().setUpdatedChild( form.getLocalContext().getSelectedParentInstance().getMobilisationsTreatment().get( form.getLocalContext().getSelectedParentInstance().getMobilisationsTreatment().size() - 1)); } } }
private void populateChildCollectionFromGrid(MobilisationsVo voMobilisation) { if (form.grdTreatments().getValue() == null) return; if (voMobilisation.getMobilisationsTreatment() == null) voMobilisation.setMobilisationsTreatment(new MobilisationsTreatmentVoCollection()); GenForm.grdTreatmentsRow parentRow = form.grdTreatments().getValue() instanceof MobilisationsShortVo || form.grdTreatments().getValue() instanceof MobilisationsVo ? form.grdTreatments().getSelectedRow() : form.grdTreatments().getSelectedRow().getParentRow(); if (parentRow.getRows().size() > 0 ) voMobilisation.getMobilisationsTreatment().clear(); for (int i=0; i < parentRow.getRows().size(); i++) { voMobilisation.getMobilisationsTreatment().add((MobilisationsTreatmentVo) parentRow.getRows().get(i).getValue()); } }
private void showHeaderOrDetailsTab() { if (form.getMode().equals(FormMode.VIEW)) { // In view mode just show the selected node if (form.grdTreatments().getValue() instanceof MobilisationsVo) form.ctnMob().lyrMob().showtabHeader(); else if (form.grdTreatments().getValue() instanceof MobilisationsShortVo) form.ctnMob().lyrMob().showtabHeader(); else if (form.grdTreatments().getValue() instanceof MobilisationsTreatmentVo) form.ctnMob().lyrMob().showtabDetails(); else form.ctnMob().lyrMob().showtabEmpty(); } else { if (form.getLocalContext().getUpdatingParent().equals(Boolean.TRUE)) form.ctnMob().lyrMob().showtabHeader(); else form.ctnMob().lyrMob().showtabDetails(); } }
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.ctnMob().lyrMob().tabDetails().setHeaderVisible(form.grdTreatments().getValue() instanceof MobilisationsTreatmentVo); form.ctnMob().lyrMob().tabDetails().txtOther().setEnabled(false); } else { // In edit mode, make the details tab visible if a hierarchy item has been selected and we're not // editing a parent. form.ctnMob().lyrMob().tabDetails().setHeaderVisible(form.getLocalContext().getSelectedParentInstanceIsNotNull() && form.getLocalContext().getUpdatingParent().equals(Boolean.FALSE)); fixCombo(); setAddApplyCaption(); } enableDetailsButtons(); }
private boolean newChildNode(MobilisationsTreatmentVo voMobilisationsTreat) { if (form.getLocalContext().getSelectedChildInstance() != null) return false; if (voMobilisationsTreat.countFieldsWithValue() >= 1) { String strErrors[] = voMobilisationsTreat.validate(); if(strErrors != null && strErrors.length > 0) { engine.showErrors(strErrors); return true; } promoteChild(voMobilisationsTreat); clearChildInstanceControls(); } return false; }
private void populateChildInstanceControls(MobilisationsTreatmentVo voMobilisationsTreatment) { if (voMobilisationsTreatment == null ) return; form.ctnMob().lyrMob().tabDetails().txtOther().setValue(voMobilisationsTreatment.getOther()); form.ctnMob().lyrMob().tabDetails().txtAreaTreated().setValue(voMobilisationsTreatment.getAreaTreated()); form.ctnMob().lyrMob().tabDetails().txtReason().setValue(voMobilisationsTreatment.getReason()); form.ctnMob().lyrMob().tabDetails().cmbTreatment().setValue(voMobilisationsTreatment.getTreatmentType()); form.getLocalContext().setSelectedChildInstance(voMobilisationsTreatment); }
private void populateChildInstanceData(MobilisationsTreatmentVo voMobTreatment) { voMobTreatment.setTreatmentType(form.ctnMob().lyrMob().tabDetails().cmbTreatment().getValue()); voMobTreatment.setAreaTreated(form.ctnMob().lyrMob().tabDetails().txtAreaTreated().getValue()); voMobTreatment.setOther(form.ctnMob().lyrMob().tabDetails().txtOther().getValue()); voMobTreatment.setReason(form.ctnMob().lyrMob().tabDetails().txtReason().getValue()); }
private void setAddApplyCaption() { form.ctnMob().lyrMob().tabDetails().btnOkDetails().setText("Add"); if (form.getLocalContext().getSelectedChildInstance() == null && (form.grdTreatments().getValue() instanceof MobilisationsTreatmentVo)) form.ctnMob().lyrMob().tabDetails().btnOkDetails().setText("Apply"); }
private void promoteChild(MobilisationsTreatmentVo voMobilisationsTreat) { if (voMobilisationsTreat == null) return; GenForm.grdTreatmentsRow childRow = null; form.grdTreatments().setValue(form.getLocalContext().getUpdatingParentInstance()); if(form.grdTreatments().getValue() != null) { if(form.grdTreatments().getSelectedRow().getValue() instanceof MobilisationsTreatmentVo) childRow = form.grdTreatments().getSelectedRow().getParentRow().getRows().newRow(); else childRow = form.grdTreatments().getSelectedRow().getRows().newRow(); } populateChildNode(childRow, voMobilisationsTreat); }
private void updateInstance() { form.getLocalContext().setUpdatingParent(new Boolean(form.grdTreatments().getValue() instanceof MobilisationsShortVo || form.grdTreatments().getValue() instanceof MobilisationsVo)); form.setMode(FormMode.EDIT); if (form.grdTreatments().getValue() instanceof MobilisationsTreatmentVo) { MobilisationsTreatmentVo voCachedChild = (MobilisationsTreatmentVo) form.grdTreatments().getValue(); if (voCachedChild.getID_MobilisationsTreatment() == null) { populateChildInstanceControls(voCachedChild); } } disableHeaderInfo(); }
private void newChildInstance() { clearChildInstanceControls(); form.getLocalContext().setSelectedChildInstance(null); if(form.grdTreatments().getValue() instanceof MobilisationsTreatmentVo) form.grdTreatments().setValue(form.grdTreatments().getSelectedRow().getParentRow().getValue()); }