private void showHeaderOrDetailsTab() { if (form.getMode().equals(FormMode.VIEW)) { // In view mode just show the selected node if (form.grdTENS().getValue() instanceof ElectrotherapyTENSShortVo) form.ctnDetails().lyrTENS().showtabHeader(); else if (form.grdTENS().getValue() instanceof ElectrotherapyTensTreatmentVo) form.ctnDetails().lyrTENS().showtabDetails(); else form.ctnDetails().lyrTENS().showtabEmpty1(); } else { if (form.getLocalContext().getUpdatingParent().equals(Boolean.TRUE)) form.ctnDetails().lyrTENS().showtabHeader(); else form.ctnDetails().lyrTENS().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.ctnDetails().lyrTENS().tabDetails().setHeaderVisible(form.grdTENS().getValue() instanceof ElectrotherapyTensTreatmentVo); } else { // In edit mode, make the details tab visible if a hierarchy item has been selected and we're not // editing a parent. form.ctnDetails().lyrTENS().tabDetails().setHeaderVisible(form.getLocalContext().getSelectedParentInstanceIsNotNull() && form.getLocalContext().getUpdatingParent().equals(Boolean.FALSE)); setAddApplyCaption(); } enableDetailsButtons(); }
private void populateChildInstanceControls(ElectrotherapyTensTreatmentVo voTensTreatments) { if (voTensTreatments == null ) return; //Display the details data form.ctnDetails().lyrTENS().tabDetails().cmbArea().setValue(voTensTreatments.getAreaIsNotNull() ? voTensTreatments.getArea(): null); form.ctnDetails().lyrTENS().tabDetails().cmbLaterality().setValue(voTensTreatments.getLateralityIsNotNull() ? voTensTreatments.getLaterality(): null); form.ctnDetails().lyrTENS().tabDetails().cmbModel().setValue(voTensTreatments.getModelIsNotNull() ? voTensTreatments.getModel(): null); form.ctnDetails().lyrTENS().tabDetails().txtSerial().setValue(voTensTreatments.getSerialNrIsNotNull() ? voTensTreatments.getSerialNr(): null); form.ctnDetails().lyrTENS().tabDetails().cmbMode().setValue(voTensTreatments.getModeIsNotNull() ? voTensTreatments.getMode(): null); form.ctnDetails().lyrTENS().tabDetails().ansProtocol().setValue(voTensTreatments.getProtocolFollowedIsNotNull() ? voTensTreatments.getProtocolFollowed(): null); form.ctnDetails().lyrTENS().tabDetails().intPulseRate().setValue(voTensTreatments.getPulseRateIsNotNull() ? voTensTreatments.getPulseRate(): null); form.ctnDetails().lyrTENS().tabDetails().intPulseWidth().setValue(voTensTreatments.getPulseWidthIsNotNull() ? voTensTreatments.getPulseWidth(): null); form.ctnDetails().lyrTENS().tabDetails().intDuration().setValue(voTensTreatments.getDurationIsNotNull() ? voTensTreatments.getDuration(): null); form.ctnDetails().lyrTENS().tabDetails().cmbUsage().setValue(voTensTreatments.getDailyUsageIsNotNull() ? voTensTreatments.getDailyUsage(): null); form.ctnDetails().lyrTENS().tabDetails().cmbElectrodes().setValue(voTensTreatments.getElectrodesIsNotNull() ? voTensTreatments.getElectrodes(): null); form.ctnDetails().lyrTENS().tabDetails().cmbSize().setValue(voTensTreatments.getSizeIsNotNull() ? voTensTreatments.getSize(): null); }
private void populateChildNode(grdTENSRow childRow, ElectrotherapyTensTreatmentVo voTensTreatments) { if (voTensTreatments == null) return; childRow.setValue(voTensTreatments); if(voTensTreatments.getArea() != null) childRow.setcolAreaParent(voTensTreatments.getArea().toString()); if(voTensTreatments.getLaterality() != null) childRow.setcolLateralityChild(voTensTreatments.getLaterality().toString()); if(voTensTreatments.getModel() != null) childRow.setcolModel(voTensTreatments.getModel().toString()); if(voTensTreatments.getMode() != null) childRow.setcolMode(voTensTreatments.getMode().toString()); if(voTensTreatments.getDuration() != null) childRow.setcolDuration(voTensTreatments.getDuration().toString()); //if not saved then set the colour if(voTensTreatments.getID_ElectrotherapyTensTreatment() == null) childRow.setTextColor(Color.Red); }
private boolean newChildNode(ElectrotherapyTensTreatmentVo voTensTreatment) { if (form.getLocalContext().getSelectedChildInstance() != null) return false; if (voTensTreatment.countFieldsWithValue() >= 1) { String strErrors[] = voTensTreatment.validate(); if(strErrors != null && strErrors.length > 0) { engine.showErrors(strErrors); return true; } promoteChild(voTensTreatment); clearChildInstanceControls(); } return false; }
private void setUpdatedChild() { // Straight child update - Select the currently being updated child as the one so show - post save if (form.grdTENS().getValue() instanceof ElectrotherapyTensTreatmentVo) { form.getLocalContext().setUpdatedChild((ElectrotherapyTensTreatmentVo) form.grdTENS().getValue()); } else { // Find the most recently added child if (form.getLocalContext().getUpdatingParent().equals(Boolean.FALSE)) { form.getLocalContext().getSelectedParentInstance().getTensTreatments().sort(); form.getLocalContext().setUpdatedChild( form.getLocalContext().getSelectedParentInstance().getTensTreatments().get( form.getLocalContext().getSelectedParentInstance().getTensTreatments().size() - 1)); } } }
private void populateChildCollectionFromGrid(ElectrotherapyTENSVo voTENS) { if (form.grdTENS().getValue() == null) return; if (voTENS.getTensTreatments() == null) voTENS.setTensTreatments(new ElectrotherapyTensTreatmentVoCollection()); GenForm.grdTENSRow parentRow = form.grdTENS().getValue() instanceof ElectrotherapyTENSShortVo ? form.grdTENS().getSelectedRow() : form.grdTENS().getSelectedRow().getParentRow(); if (parentRow.getRows().size() > 0 ) voTENS.getTensTreatments().clear(); for (int i=0; i < parentRow.getRows().size(); i++) { voTENS.getTensTreatments().add((ElectrotherapyTensTreatmentVo) parentRow.getRows().get(i).getValue()); } }
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; } //expand the selected parent if(form.grdTENS().getValue() instanceof ElectrotherapyTENSShortVo) { form.getLocalContext().setSelectedParentInstance(getParentFromDomain((ElectrotherapyTENSShortVo) form.grdTENS().getValue())); populateParentInstanceControls(form.getLocalContext().getSelectedParentInstance()); //add activities if not added already populateChildNodes(form.grdTENS().getSelectedRow(),form.getLocalContext().getSelectedParentInstance().getTensTreatments()); form.getLocalContext().setSelectedChildInstance(null); clearChildInstanceControls(); } else if(form.grdTENS().getValue() instanceof ElectrotherapyTensTreatmentVo) { form.getLocalContext().setSelectedChildInstance((ElectrotherapyTensTreatmentVo) form.grdTENS().getValue()); populateChildInstanceControls(form.getLocalContext().getSelectedChildInstance()); } if (form.getGlobalContext().Core.getCurrentClinicalContact() == null) form.getLocalContext().setGoldenInstanceSelected(new Boolean(false)); else form.getLocalContext().setGoldenInstanceSelected(new Boolean(form.getLocalContext().getSelectedParentInstance().getClinicalContact().getID_ClinicalContact().equals(form.getGlobalContext().Core.getCurrentClinicalContact().getID_ClinicalContact()))); updateControlsState(); if (form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull()) { form.btnNew().setVisible(false); form.btnUpdate().setVisible(false); } }
private void updateControlsState() { // The new button form.btnNew().setVisible(form.getMode().equals(FormMode.VIEW) && form.getLocalContext().getGoldenInstanceFound().booleanValue() == false && form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull()); form.btnUpdate().setVisible(form.getMode().equals(FormMode.VIEW) && form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull() && form.grdTENS().getValue() instanceof ElectrotherapyTensTreatmentVo && form.getLocalContext().getGoldenInstanceFound().booleanValue() == true); // The collapsible container form.ctnDetails().setCollapsed(form.getLocalContext().getSelectedParentInstance() == null); // The empty tab if (form.grdTENS().getValue() == null) form.ctnDetails().lyrTENS().showtabEmpty1(); // The Parent tab setParentTabVisability(); // The details tab setDetailsTabVisibility(); // Pick a tab to show showHeaderOrDetailsTab(); // The context menus updateContextMenusState(); }
private void setAddApplyCaption() { form.ctnDetails().lyrTENS().tabDetails().btnOk().setText("Add"); if (form.getLocalContext().getSelectedChildInstance() == null && (form.grdTENS().getValue() instanceof ElectrotherapyTensTreatmentVo)) form.ctnDetails().lyrTENS().tabDetails().btnOk().setText("Apply"); }
private void promoteChild(ElectrotherapyTensTreatmentVo voTensTreatment) { if (voTensTreatment == null) return; GenForm.grdTENSRow childRow = null; form.grdTENS().setValue(form.getLocalContext().getSelectedParentInstance()); if(form.grdTENS().getSelectedRow().getValue() instanceof ElectrotherapyTensTreatmentVo) childRow = form.grdTENS().getSelectedRow().getParentRow().getRows().newRow(); else childRow = form.grdTENS().getSelectedRow().getRows().newRow(); populateChildNode(childRow, voTensTreatment); }
private void newChildInstance() { clearChildInstanceControls(); form.getLocalContext().setSelectedChildInstance(null); if (form.grdTENS().getValue() instanceof ElectrotherapyTENSShortVo) form.grdTENS().setValue(form.grdTENS().getSelectedRow().getValue()); else if (form.grdTENS().getValue() instanceof ElectrotherapyTensTreatmentVo) form.grdTENS().setValue(form.grdTENS().getSelectedRow().getParentRow().getValue()); }
private void populateChildInstanceData(ElectrotherapyTensTreatmentVo voTensTreatments) { voTensTreatments.setArea(form.ctnDetails().lyrTENS().tabDetails().cmbArea().getValue()); voTensTreatments.setLaterality(form.ctnDetails().lyrTENS().tabDetails().cmbLaterality().getValue()); voTensTreatments.setModel(form.ctnDetails().lyrTENS().tabDetails().cmbModel().getValue()); voTensTreatments.setSerialNr(form.ctnDetails().lyrTENS().tabDetails().txtSerial().getValue()); voTensTreatments.setMode(form.ctnDetails().lyrTENS().tabDetails().cmbMode().getValue()); voTensTreatments.setProtocolFollowed(form.ctnDetails().lyrTENS().tabDetails().ansProtocol().getValue()); voTensTreatments.setPulseRate(form.ctnDetails().lyrTENS().tabDetails().intPulseRate().getValue()); voTensTreatments.setPulseWidth(form.ctnDetails().lyrTENS().tabDetails().intPulseWidth().getValue()); voTensTreatments.setDuration(form.ctnDetails().lyrTENS().tabDetails().intDuration().getValue()); voTensTreatments.setDailyUsage(form.ctnDetails().lyrTENS().tabDetails().cmbUsage().getValue()); voTensTreatments.setElectrodes(form.ctnDetails().lyrTENS().tabDetails().cmbElectrodes().getValue()); voTensTreatments.setSize(form.ctnDetails().lyrTENS().tabDetails().cmbSize().getValue()); }
private void updateInstance() { form.getLocalContext().setUpdatingParent(new Boolean(form.grdTENS().getValue() instanceof ElectrotherapyTENSShortVo)); form.setMode(FormMode.EDIT); if (form.grdTENS().getValue() instanceof ElectrotherapyTensTreatmentVo) { ElectrotherapyTensTreatmentVo voChild = (ElectrotherapyTensTreatmentVo) form.grdTENS().getValue(); if ( voChild.getID_ElectrotherapyTensTreatment() == null) { populateChildInstanceControls(voChild); } } disableHeaderInfo(); }