private void showHeaderOrDetailsTab() { if (form.getMode().equals(FormMode.VIEW)) { // In view mode just show the selected node if (form.grdArea().getValue() instanceof StretchingShortVo) form.ctnStretching().lyrStretching().showtabHeader(); else if (form.grdArea().getValue() instanceof StretchingDetailsVo) form.ctnStretching().lyrStretching().showtabDetails(); else form.ctnStretching().lyrStretching().showtabEmpty(); } else { if (form.getLocalContext().getUpdatingParent().equals(Boolean.TRUE)) form.ctnStretching().lyrStretching().showtabHeader(); else form.ctnStretching().lyrStretching().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.ctnStretching().lyrStretching().tabDetails().setHeaderVisible(form.grdArea().getValue() instanceof StretchingDetailsVo); } else { // In edit mode, make the details tab visible if a hierarchy item has been selected and we're not // editing a parent. form.ctnStretching().lyrStretching().tabDetails().setHeaderVisible(form.getLocalContext().getSelectedParentInstanceIsNotNull() && form.getLocalContext().getUpdatingParent().equals(Boolean.FALSE)); setAddApplyCaption(); } enableDetailsButtons(); }
private void populateChildNode(grdAreaRow childRow, StretchingDetailsVo voStretchingDetails) { if (voStretchingDetails == null) return; childRow.setValue(voStretchingDetails); if(voStretchingDetails.getStretchingArea() != null) childRow.setColArea(voStretchingDetails.getStretchingArea().toString()); if(voStretchingDetails.getActive() != null) childRow.setColActive(voStretchingDetails.getActive().booleanValue()); if(voStretchingDetails.getPassive() != null) childRow.setcolPassive(voStretchingDetails.getPassive().booleanValue()); if(voStretchingDetails.getComment() != null) childRow.setColComment(voStretchingDetails.getComment().toString()); //if not saved then set the colour if(voStretchingDetails.getID_StretchingDetails() == 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.grdArea().getValue() instanceof StretchingDetailsVo) { form.getLocalContext().setUpdatedChild((StretchingDetailsVo) form.grdArea().getValue()); } else { // Find the most recently added child if (form.getLocalContext().getUpdatingParent().equals(Boolean.FALSE)) { form.getLocalContext().getSelectedParentInstance().getStretchingDetails().sort(); form.getLocalContext().setUpdatedChild( form.getLocalContext().getSelectedParentInstance().getStretchingDetails().get( form.getLocalContext().getSelectedParentInstance().getStretchingDetails().size() - 1)); } } }
private void populateChildCollectionFromGrid(StretchingVo voStretching) { if (form.grdArea().getValue() == null) return; if (voStretching.getStretchingDetails() == null) voStretching.setStretchingDetails(new StretchingDetailsVoCollection()); GenForm.grdAreaRow parentRow = form.grdArea().getValue() instanceof StretchingShortVo ? form.grdArea().getSelectedRow() : form.grdArea().getSelectedRow().getParentRow(); if (parentRow.getRows().size() > 0 ) voStretching.getStretchingDetails().clear(); for (int i=0; i < parentRow.getRows().size(); i++) { voStretching.getStretchingDetails().add((StretchingDetailsVo) 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.grdArea().getValue() instanceof StretchingShortVo) { form.getLocalContext().setSelectedParentInstance(getParentFromDomain((StretchingShortVo) form.grdArea().getValue())); populateParentInstanceControls(form.getLocalContext().getSelectedParentInstance()); //add activities if not added already populateChildNodes(form.grdArea().getSelectedRow(),form.getLocalContext().getSelectedParentInstance().getStretchingDetails()); form.getLocalContext().setSelectedChildInstance(null); clearChildInstanceControls(); } else if(form.grdArea().getValue() instanceof StretchingDetailsVo) { form.getLocalContext().setSelectedChildInstance((StretchingDetailsVo) form.grdArea().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.grdArea().getValue() instanceof StretchingDetailsVo && form.getLocalContext().getGoldenInstanceFound().booleanValue() == true); // The collapsible container form.ctnStretching().setCollapsed(form.getLocalContext().getSelectedParentInstance() == null); // The empty tab if (form.grdArea().getValue() == null) form.ctnStretching().lyrStretching().showtabEmpty(); // The Parent tab setParentTabVisability(); // The details tab setDetailsTabVisibility(); // Pick a tab to show showHeaderOrDetailsTab(); // The context menus updateContextMenusState(); }
private void setAddApplyCaption() { form.ctnStretching().lyrStretching().tabDetails().btnOk().setText("Add"); if (form.getLocalContext().getSelectedChildInstance() == null && (form.grdArea().getValue() instanceof StretchingDetailsVo)) form.ctnStretching().lyrStretching().tabDetails().btnOk().setText("Apply"); }
private void populateChildInstanceControls(StretchingDetailsVo voStretchingDetails) { if (voStretchingDetails == null ) return; //Display the details data form.ctnStretching().lyrStretching().tabDetails().chkActive().setValue(voStretchingDetails.getActiveIsNotNull() ? voStretchingDetails.getActive().booleanValue(): false); form.ctnStretching().lyrStretching().tabDetails().chkPassive().setValue(voStretchingDetails.getPassiveIsNotNull() ? voStretchingDetails.getPassive().booleanValue(): false); form.ctnStretching().lyrStretching().tabDetails().cmbArea().setValue(voStretchingDetails.getStretchingAreaIsNotNull() ? voStretchingDetails.getStretchingArea(): null); form.ctnStretching().lyrStretching().tabDetails().txtComment().setValue(voStretchingDetails.getCommentIsNotNull() ? voStretchingDetails.getComment(): null); }
private boolean newChildNode(StretchingDetailsVo voStretchingDetails,boolean saveorAd) { if (form.getLocalContext().getSelectedChildInstance() != null) return false; if(voStretchingDetails.getActive().equals(Boolean.FALSE)) voStretchingDetails.setActive(null); if(voStretchingDetails.getPassive().equals(Boolean.FALSE)) voStretchingDetails.setPassive(null); //------------- int cont; if(saveorAd == true) cont = 1; else cont = 0; //------------- if (voStretchingDetails.countFieldsWithValue() >= cont)// in if condition was >= 1 { String strErrors[] = voStretchingDetails.validate(); if(strErrors != null && strErrors.length > 0) { engine.showErrors(strErrors); return true; } promoteChild(voStretchingDetails); clearChildInstanceControls(); } return false; }
private void promoteChild(StretchingDetailsVo voStretchingDetails) { if (voStretchingDetails == null) return; GenForm.grdAreaRow childRow = null; form.grdArea().setValue(form.getLocalContext().getSelectedParentInstance()); if(form.grdArea().getSelectedRow().getValue() instanceof StretchingDetailsVo) childRow = form.grdArea().getSelectedRow().getParentRow().getRows().newRow(); else childRow = form.grdArea().getSelectedRow().getRows().newRow(); populateChildNode(childRow, voStretchingDetails); }
private void newChildInstance() { clearChildInstanceControls(); form.getLocalContext().setSelectedChildInstance(null); if (form.grdArea().getValue() instanceof StretchingShortVo) form.grdArea().setValue(form.grdArea().getSelectedRow().getValue()); else if (form.grdArea().getValue() instanceof StretchingDetailsVo) form.grdArea().setValue(form.grdArea().getSelectedRow().getParentRow().getValue()); }
private void populateChildInstanceData(StretchingDetailsVo voStretchingDetails) { voStretchingDetails.setStretchingArea(form.ctnStretching().lyrStretching().tabDetails().cmbArea().getValue()); voStretchingDetails.setActive(new Boolean(form.ctnStretching().lyrStretching().tabDetails().chkActive().getValue())); voStretchingDetails.setPassive(new Boolean(form.ctnStretching().lyrStretching().tabDetails().chkPassive().getValue())); voStretchingDetails.setComment(form.ctnStretching().lyrStretching().tabDetails().txtComment().getValue()); }
private void updateInstance() { form.getLocalContext().setUpdatingParent(new Boolean(form.grdArea().getValue() instanceof StretchingShortVo)); form.setMode(FormMode.EDIT); if (form.grdArea().getValue() instanceof StretchingDetailsVo) { StretchingDetailsVo voChild = (StretchingDetailsVo) form.grdArea().getValue(); if ( voChild.getID_StretchingDetails() == null) { populateChildInstanceControls(voChild); } } disableHeaderInfo(); }