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.ctnTherapy().lyrThermal().tabDetails().setHeaderVisible(form.grdThermal().getValue() instanceof ThermalActivityVo); } else { // In edit mode, make the details tab visible if a hierarchy item has been selected and we're not // editing a parent. form.ctnTherapy().lyrThermal().tabDetails().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.grdThermal().getValue() instanceof ThermalActivityVo) { form.getLocalContext().setUpdatedChild((ThermalActivityVo) form.grdThermal().getValue()); } else { // Find the most recently added child if (form.getLocalContext().getUpdatingParent().equals(Boolean.FALSE)) { form.getLocalContext().getSelectedParentInstance().getThermalActivity().sort(); if(form.getLocalContext().getSelectedParentInstance().getThermalActivity().size() >0) form.getLocalContext().setUpdatedChild( form.getLocalContext().getSelectedParentInstance().getThermalActivity().get( form.getLocalContext().getSelectedParentInstance().getThermalActivity().size() - 1)); } } }
private void populateChildCollectionFromGrid(ThermalVo voThermal) { if (form.grdThermal().getValue() == null) return; if (voThermal.getThermalActivity() == null) voThermal.setThermalActivity(new ThermalActivityVoCollection()); GenForm.grdThermalRow parentRow = form.grdThermal().getValue() instanceof ThermalShortVo || form.grdThermal().getValue() instanceof ThermalVo ? form.grdThermal().getSelectedRow() : form.grdThermal().getSelectedRow().getParentRow(); if (parentRow.getRows().size() > 0 ) voThermal.getThermalActivity().clear(); for (int i=0; i < parentRow.getRows().size(); i++) { voThermal.getThermalActivity().add((ThermalActivityVo) parentRow.getRows().get(i).getValue()); } }
private boolean newChildNode(ThermalActivityVo voThermalActivity) { if (form.getLocalContext().getSelectedChildInstance() != null) return false; if (voThermalActivity.countFieldsWithValue() > 0) { String strErrors[] = voThermalActivity.validate(); if(strErrors != null && strErrors.length > 0) { engine.showErrors(strErrors); return true; } promoteChild(voThermalActivity); clearChildInstanceControls(); } return false; }
private void newInstance() { //clearChildInstanceControls(); // 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.grdThermal().getValue() == null || ((form.getLocalContext().getSelectedParentInstanceIsNotNull() && form.getLocalContext().getGoldenInstanceSelected().equals(Boolean.FALSE)))) { newParentInstance(); } if (form.grdThermal().getValue() instanceof ThermalActivityVo) { newChildInstance(); } form.setMode(FormMode.EDIT); }
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; } if(form.grdThermal().getValue() instanceof ThermalVo) { populateParentInstanceControls((ThermalVo) form.grdThermal().getValue()); } if(form.grdThermal().getValue() instanceof ThermalShortVo) { form.getLocalContext().setSelectedParentInstance(getParentFromDomain((ThermalShortVo) form.grdThermal().getValue())); populateParentInstanceControls(form.getLocalContext().getSelectedParentInstance()); populateChildNodes(form.grdThermal().getSelectedRow(),form.getLocalContext().getSelectedParentInstance().getThermalActivity()); form.getLocalContext().setSelectedChildInstance(null); clearChildInstanceControls(); } else if(form.grdThermal().getValue() instanceof ThermalActivityVo) { GenForm.grdThermalRow parentRow = form.grdThermal().getSelectedRow().getParentRow(); populateParentInstanceControls((ThermalVo) parentRow.getValue()); form.getLocalContext().setSelectedParentInstance((ThermalVo) parentRow.getValue()); form.getLocalContext().setSelectedChildInstance((ThermalActivityVo) form.grdThermal().getValue()); populateChildInstanceControls(form.getLocalContext().getSelectedChildInstance()); } if(form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull()) form.getLocalContext().setGoldenInstanceSelected(new Boolean(form.getLocalContext().getSelectedParentInstance().getClinicalContact().getID_ClinicalContact().equals(form.getGlobalContext().Core.getCurrentClinicalContact().getID_ClinicalContact()))); updateControlsState(); }
private void showHeaderOrDetailsTab() { if (form.getMode().equals(FormMode.VIEW)) { // In view mode just show the selected node if (form.grdThermal().getValue() instanceof ThermalShortVo) form.ctnTherapy().lyrThermal().showtabHeader(); else if(form.grdThermal().getValue() instanceof ThermalVo) form.ctnTherapy().lyrThermal().showtabHeader(); else if (form.grdThermal().getValue() instanceof ThermalActivityVo) form.ctnTherapy().lyrThermal().showtabDetails(); //enableParentControls(false); } else { if (form.getLocalContext().getUpdatingParent().equals(Boolean.TRUE)) form.ctnTherapy().lyrThermal().showtabHeader(); else form.ctnTherapy().lyrThermal().showtabDetails(); if (form.getLocalContext().getSelectedParentInstanceIsNotNull() && (form.getLocalContext().getSelectedParentInstance().getID_ThermalIsNotNull())) enableParentControls(false); //on update else enableParentControls(true); //new record } }
private void setAddApplyCaption() { form.ctnTherapy().lyrThermal().tabDetails().btnOk().setText("Add"); if (form.getLocalContext().getSelectedChildInstance() == null && (form.grdThermal().getValue() instanceof ThermalActivityVo)) form.ctnTherapy().lyrThermal().tabDetails().btnOk().setText("Apply"); }
private void populateChildInstanceControls(ThermalActivityVo voThermalActivity) { if (voThermalActivity == null ) return; form.ctnTherapy().lyrThermal().tabDetails().cmbThermal().setValue(voThermalActivity.getThermal()); if(voThermalActivity.getThermalTypeIsNotNull()) form.ctnTherapy().lyrThermal().tabDetails().cmbType().newRow(voThermalActivity.getThermalType(), voThermalActivity.getThermalType().toString()); form.ctnTherapy().lyrThermal().tabDetails().cmbType().setValue(voThermalActivity.getThermalType()); form.ctnTherapy().lyrThermal().tabDetails().cmbArea().setValue(voThermalActivity.getArea()); form.ctnTherapy().lyrThermal().tabDetails().cmbLaterality().setValue(voThermalActivity.getLaterality()); form.ctnTherapy().lyrThermal().tabDetails().intDuration().setValue(voThermalActivity.getDuration()); form.ctnTherapy().lyrThermal().tabDetails().txtDetails().setValue(voThermalActivity.getDetails()); form.getLocalContext().setSelectedChildInstance(voThermalActivity); }
private void populateChildNode(grdThermalRow childRow, ThermalActivityVo voThermalActivity) { if (voThermalActivity == null) return; if(voThermalActivity.getThermal() != null) childRow.setcolThermalTypeParent(voThermalActivity.getThermal().toString()); else childRow.setcolThermalTypeParent(null); if(voThermalActivity.getThermalType() != null) childRow.setcolThermalTypeChild(voThermalActivity.getThermalType().toString()); else childRow.setcolThermalTypeChild(null); if(voThermalActivity.getArea() != null) childRow.setcolArea(voThermalActivity.getArea().toString()); else childRow.setcolArea(null); if(voThermalActivity.getLaterality() != null) childRow.setcolLaterality(voThermalActivity.getLaterality().toString()); else childRow.setcolLaterality(null); if(voThermalActivity.getDuration() != null) childRow.setcolDuration(voThermalActivity.getDuration().toString()); else childRow.setcolDuration(null); childRow.setcolDetails(voThermalActivity.getDetails()); childRow.setValue(voThermalActivity); //if not saved then set the colour if(voThermalActivity.getID_ThermalActivity() == null) childRow.setTextColor(Color.Red); }
private void populateChildInstanceData(ThermalActivityVo voThermalActivity) { voThermalActivity.setThermal(form.ctnTherapy().lyrThermal().tabDetails().cmbThermal().getValue()); voThermalActivity.setThermalType(form.ctnTherapy().lyrThermal().tabDetails().cmbType().getValue()); voThermalActivity.setArea(form.ctnTherapy().lyrThermal().tabDetails().cmbArea().getValue()); voThermalActivity.setLaterality(form.ctnTherapy().lyrThermal().tabDetails().cmbLaterality().getValue()); voThermalActivity.setDuration(form.ctnTherapy().lyrThermal().tabDetails().intDuration().getValue()); voThermalActivity.setDetails(form.ctnTherapy().lyrThermal().tabDetails().txtDetails().getValue()); }
private void promoteChild(ThermalActivityVo voThermalActivity) { if(voThermalActivity == null) return; GenForm.grdThermalRow childRow = null; form.grdThermal().setValue(form.getLocalContext().getSelectedParentInstance());//maybe need new localcontext if(form.grdThermal().getValue() != null) { if(form.grdThermal().getSelectedRow().getValue() instanceof ThermalActivityVo) childRow = form.grdThermal().getSelectedRow().getParentRow().getRows().newRow(); else childRow = form.grdThermal().getSelectedRow().getRows().newRow(); } populateChildNode(childRow, voThermalActivity); }
private void updateInstance() { form.getLocalContext().setUpdatingParent(new Boolean(form.grdThermal().getValue() instanceof ThermalShortVo)); form.setMode(FormMode.EDIT); if (form.grdThermal().getValue() instanceof ThermalActivityVo) { ThermalActivityVo voCachedChild = (ThermalActivityVo) form.grdThermal().getValue(); if ( voCachedChild.getID_ThermalActivity() == null) { populateChildInstanceControls(voCachedChild); } } }