/** * Invoked when the user clicks OK to add a new element to the child array * Basically we update the hierarchy grid with the newly added details clearing the control * to facilitate new input. We then update the local conte xt variable with the new child * */ private boolean newChildNode(RehabilitationActivityVo voRehabActivity) { if (form.getLocalContext().getSelectedChildInstance() != null) return false; if (voRehabActivity.countFieldsWithValue() > 0) { String strErrors[] = voRehabActivity.validate(); if(strErrors != null && strErrors.length > 0) { engine.showErrors(strErrors); return true; } promoteChild(voRehabActivity); clearChildInstanceControls(); loadEquipment(); loadAdaptation(); loadTechnique(); } return false; }
public void updateControlsState() { // The new button form.btnNew().setVisible(form.getMode().equals(FormMode.VIEW) && form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull() && form.getLocalContext().getGoldenInstanceFound().booleanValue() == false); form.btnUpdate().setVisible(form.getMode().equals(FormMode.VIEW) && form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull() && form.grdActivity().getValue() instanceof RehabilitationActivityVo && form.getLocalContext().getGoldenInstanceFound().booleanValue() == true); // The collapsible container form.ctnDetail().setCollapsed(form.getLocalContext().getSelectedParentInstance() == null); // The empty tab //if (form.grdHierarchy().getValue() == null) //form.ctnDetail().lyrUltra().showtabEmpty(); // Show Header and/or Detail showHeaderOrDetails(); // The context menus updateContextMenusState(); }
private void setUpdatedChild() { // Straight child update - Select the currently being updated child as the one so show - post save if (form.grdActivity().getValue() instanceof RehabilitationActivityVo) { form.getLocalContext().setUpdatedChild((RehabilitationActivityVo) form.grdActivity().getValue()); } else { // Find the most recently added child if (form.getLocalContext().getUpdatingParent().equals(Boolean.FALSE)) { form.getLocalContext().getSelectedParentInstance().getRehabActivity().sort(); form.getLocalContext().setUpdatedChild( form.getLocalContext().getSelectedParentInstance().getRehabActivity().get( form.getLocalContext().getSelectedParentInstance().getRehabActivity().size() - 1)); } } }
private void populateChildCollectionFromGrid(RehabilitationVo voRehab) { if (form.grdActivity().getValue() == null) return; if (voRehab.getRehabActivity() == null) voRehab.setRehabActivity(new RehabilitationActivityVoCollection()); GenForm.grdActivityRow parentRow = form.grdActivity().getValue() instanceof RehabilitationShortVo ? form.grdActivity().getSelectedRow() : form.grdActivity().getSelectedRow().getParentRow(); if (parentRow.getRows().size() > 0 ) voRehab.getRehabActivity().clear(); for (int i=0; i < parentRow.getRows().size(); i++) { voRehab.getRehabActivity().add((RehabilitationActivityVo) parentRow.getRows().get(i).getValue()); } }
private void populateChildNode(GenForm.grdActivityRow childRow, RehabilitationActivityVo voRehabActivity) { if (voRehabActivity == null) return; childRow.setValue(voRehabActivity); childRow.setColActCategory(voRehabActivity.getActivityCategoryIsNotNull()?voRehabActivity.getActivityCategory().toString():null); childRow.setColActDateAndType(voRehabActivity.getActivityTypeIsNotNull()?voRehabActivity.getActivityType().toString():null); childRow.setColActGroup(voRehabActivity.getActivityGroupIsNotNull()?voRehabActivity.getActivityGroup().toString():null); childRow.setColActivity(voRehabActivity.getActivityIsNotNull()?voRehabActivity.getActivity().toString():null); childRow.setColDateTime(""); childRow.setColIndependence(voRehabActivity.getIndependenceLevelIsNotNull()?voRehabActivity.getIndependenceLevel().toString():null); childRow.setColLocation(voRehabActivity.getLocationIsNotNull()?voRehabActivity.getLocation().toString():null); childRow.setValue(voRehabActivity); //if not saved then set the colour if(voRehabActivity.getID_RehabilitationActivity() == null) childRow.setTextColor(Color.Red); }
private void promoteChild(RehabilitationActivityVo voRehabActivity) { if (voRehabActivity == null) return; GenForm.grdActivityRow childRow = null; form.grdActivity().setValue(form.getLocalContext().getSelectedParentInstance()); if(form.grdActivity().getSelectedRow().getValue() instanceof RehabilitationActivityVo) childRow = form.grdActivity().getSelectedRow().getParentRow().getRows().newRow(); else childRow = form.grdActivity().getSelectedRow().getRows().newRow(); populateChildNode(childRow, voRehabActivity); }
private void newChildInstance() { clearChildInstanceControls(); form.getLocalContext().setSelectedChildInstance(null); loadEquipment(); loadAdaptation(); loadTechnique(); if (form.grdActivity().getValue() instanceof RehabilitationShortVo) form.grdActivity().setValue(form.grdActivity().getSelectedRow().getValue()); else if (form.grdActivity().getValue() instanceof RehabilitationActivityVo) form.grdActivity().setValue(form.grdActivity().getSelectedRow().getParentRow().getValue()); }
private void populateChildInstanceControlsForUpdate(RehabilitationActivityVo voRehabActivity) { if (voRehabActivity != null) { form.ctnDetail().cmbTypes().setValue(voRehabActivity.getActivityTypeIsNotNull() ? voRehabActivity.getActivityType() : null); selectionChangeCmbTypes(); form.ctnDetail().cmbCategory().setValue(voRehabActivity.getActivityCategoryIsNotNull() ? voRehabActivity.getActivityCategory() : null); selectionChangedCmbCategory(); form.ctnDetail().cmbGroup().setValue(voRehabActivity.getActivityGroupIsNotNull() ? voRehabActivity.getActivityGroup() : null); selectionChangedCmbGroup(); form.ctnDetail().cmbActivity().setValue(voRehabActivity.getActivityIsNotNull() ? voRehabActivity.getActivity() : null); form.ctnDetail().cmbLocation().setValue(voRehabActivity.getLocationIsNotNull() ? voRehabActivity.getLocation() : null); form.ctnDetail().cmbPurpose().setValue(voRehabActivity.getPurposeIsNotNull() ? voRehabActivity.getPurpose() : null); form.ctnDetail().cmbIndependence().setValue(voRehabActivity.getIndependenceLevelIsNotNull() ? voRehabActivity.getIndependenceLevel() : null); loadEquipment(); loadAdaptation(); loadTechnique(); overlayEquipment(voRehabActivity.getEquipment()); overlayEnvirAdaptation(voRehabActivity.getEnvAdaptations()); overlayTechnique(voRehabActivity.getTechnique()); form.getLocalContext().setSelectedChildInstance(voRehabActivity); } }
private void updateInstance() { form.getLocalContext().setUpdatingParent(new Boolean(form.grdActivity().getValue() instanceof RehabilitationShortVo || form.grdActivity().getValue() instanceof RehabilitationVo)); form.setMode(FormMode.EDIT); if (form.grdActivity().getValue() instanceof RehabilitationActivityVo) { RehabilitationActivityVo voCachedChild = (RehabilitationActivityVo) form.grdActivity().getValue(); if (voCachedChild.getID_RehabilitationActivity() == null) { populateChildInstanceControlsForUpdate(voCachedChild); } } }
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.grdActivity().getValue() == null || ((form.getLocalContext().getSelectedParentInstanceIsNotNull() && form.getLocalContext().getGoldenInstanceSelected().equals(Boolean.FALSE)))) { form.ctnDetail().dtimAuthoring().setValue(null); form.ctnDetail().qmbAuthoringCP().setValue(null); form.ctnDetail().qmbAuthoringCP().clear(); newParentInstance(); } if (form.grdActivity().getValue() instanceof RehabilitationShortVo) { //new instance for golden parent node meaning add a new child newChildInstance(); } else if (form.grdActivity().getValue() instanceof RehabilitationActivityVo) { // New instance has been invoked with a child node selected. newChildInstance(); } form.setMode(FormMode.EDIT); }