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.grdFunctionalTrans().getValue() instanceof FunctionalTransfersTechniqueVo && form.getLocalContext().getGoldenInstanceFound().booleanValue() == true); // The collapsible container form.ctnFunctTrans().setCollapsed(form.getLocalContext().getSelectedParentInstance() == null); // The empty tab if (form.grdFunctionalTrans().getValue() == null) form.ctnFunctTrans().lyrFunctTransfers().showtabEmpty(); // The Parent tab setParentTabVisability(); // The details tab setDetailsTabVisibility(); // Pick a tab to show showHeaderOrDetailsTab(); // The context menus updateContextMenusState(); }
private void showHeaderOrDetailsTab() { if (form.getMode().equals(FormMode.VIEW)) { // In view mode just show the selected node if (form.grdFunctionalTrans().getValue() instanceof FunctionalTransfersShortVo) form.ctnFunctTrans().lyrFunctTransfers().showtabHeader(); else if (form.grdFunctionalTrans().getValue() instanceof FunctionalTransfersTechniqueVo) form.ctnFunctTrans().lyrFunctTransfers().showtabDetails(); else form.ctnFunctTrans().lyrFunctTransfers().showtabEmpty(); form.ctnFunctTrans().lyrFunctTransfers().tabDetails().grdEquipment().setReadOnly(true); form.ctnFunctTrans().lyrFunctTransfers().tabDetails().grdTechnique().setReadOnly(true); } else { if (form.getLocalContext().getUpdatingParent().equals(Boolean.TRUE)) form.ctnFunctTrans().lyrFunctTransfers().showtabHeader(); else form.ctnFunctTrans().lyrFunctTransfers().showtabDetails(); form.ctnFunctTrans().lyrFunctTransfers().tabDetails().grdEquipment().setReadOnly(false); form.ctnFunctTrans().lyrFunctTransfers().tabDetails().grdTechnique().setReadOnly(false); } }
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.ctnFunctTrans().lyrFunctTransfers().tabDetails().setHeaderVisible(form.grdFunctionalTrans().getValue() instanceof FunctionalTransfersTechniqueVo); } else { // In edit mode, make the details tab visible if a hierarchy item // has been selected and we're not // editing a parent. form.ctnFunctTrans().lyrFunctTransfers().tabDetails().setHeaderVisible(form.getLocalContext().getSelectedParentInstanceIsNotNull() && form.getLocalContext().getUpdatingParent().equals(Boolean.FALSE)); setAddApplyCaption(); } enableDetailsButtons(); }
private void populateChildInstanceControls(FunctionalTransfersTechniqueVo voFTTechnique) { if (voFTTechnique == null) return; form.ctnFunctTrans().lyrFunctTransfers().tabDetails().cmbFinishPos().setValue(voFTTechnique.getFinishPosition()); form.ctnFunctTrans().lyrFunctTransfers().tabDetails().cmbRisk().setValue(voFTTechnique.getRisk()); form.ctnFunctTrans().lyrFunctTransfers().tabDetails().cmbStartPos().setValue(voFTTechnique.getStartPosition()); form.ctnFunctTrans().lyrFunctTransfers().tabDetails().intFIMScore().setValue(voFTTechnique.getFIMScore()); form.ctnFunctTrans().lyrFunctTransfers().tabDetails().intFinishHeight().setValue(voFTTechnique.getFinishHeight()); form.ctnFunctTrans().lyrFunctTransfers().tabDetails().intFinishTarget().setValue(voFTTechnique.getFinishTarget()); form.ctnFunctTrans().lyrFunctTransfers().tabDetails().intStartHeight().setValue(voFTTechnique.getStartHeight()); form.ctnFunctTrans().lyrFunctTransfers().tabDetails().intStartTarget().setValue(voFTTechnique.getStartTarget()); // TODO - WORK FOR THE GRIDS STILL NEEDS TO BE DONE. loadEquipment(); loadTechnique(); overlayEquipment(voFTTechnique.getEquipment()); overlayTechnique(voFTTechnique.getTechnique()); }
private boolean newChildNode(FunctionalTransfersTechniqueVo voFunctionalTransfersTechnique, boolean bOnSave) { if (form.getLocalContext().getSelectedChildInstance() != null) return false; if (voFunctionalTransfersTechnique.countFieldsWithValue() >= 1) { String strErrors[] = voFunctionalTransfersTechnique.validate(); if (strErrors != null && strErrors.length > 0) { engine.showErrors(strErrors); return true; } promoteChild(voFunctionalTransfersTechnique); clearChildInstanceControls(); loadEquipment(); loadTechnique(); } else if (!bOnSave) engine.showMessage("No details fields have been filled in."); return false; }
private void setUpdatedChild() { // Straight child update - Select the currently being updated child as // the one so show - post save if (form.grdFunctionalTrans().getValue() instanceof FunctionalTransfersTechniqueVo) { form.getLocalContext().setUpdatedChild((FunctionalTransfersTechniqueVo) form.grdFunctionalTrans().getValue()); } else { // Find the most recently added child if (form.getLocalContext().getUpdatingParent().equals(Boolean.FALSE)) { form.getLocalContext().getSelectedParentInstance().getMovements().sort(); form.getLocalContext().setUpdatedChild(form.getLocalContext().getSelectedParentInstance().getMovements().get(form.getLocalContext().getSelectedParentInstance().getMovements().size() - 1)); } } }
private void populateChildCollectionFromGrid(FunctionalTransfersVo voFunctionalTransfers) { if (form.grdFunctionalTrans().getValue() == null) return; if (voFunctionalTransfers.getMovements() == null) voFunctionalTransfers.setMovements(new FunctionalTransfersTechniqueVoCollection()); GenForm.grdFunctionalTransRow parentRow = form.grdFunctionalTrans().getValue() instanceof FunctionalTransfersShortVo ? form.grdFunctionalTrans().getSelectedRow() : form.grdFunctionalTrans().getSelectedRow().getParentRow(); if (parentRow.getRows().size() > 0) voFunctionalTransfers.getMovements().clear(); for (int i = 0; i < parentRow.getRows().size(); i++) { voFunctionalTransfers.getMovements().add((FunctionalTransfersTechniqueVo) parentRow.getRows().get(i).getValue()); } }
private void setAddApplyCaption() { form.ctnFunctTrans().lyrFunctTransfers().tabDetails().btnOk().setText("Add"); if (form.getLocalContext().getSelectedChildInstance() == null && (form.grdFunctionalTrans().getValue() instanceof FunctionalTransfersTechniqueVo)) form.ctnFunctTrans().lyrFunctTransfers().tabDetails().btnOk().setText("Apply"); }
private void populateChildNode(grdFunctionalTransRow childRow, FunctionalTransfersTechniqueVo voFunctTransMovements) { if (voFunctTransMovements == null) return; childRow.setValue(voFunctTransMovements); if (voFunctTransMovements.getStartPosition() != null) childRow.setcolStartingPositionParent(voFunctTransMovements.getStartPosition().toString()); if (voFunctTransMovements.getStartHeight() != null) childRow.setcolHeightStartChild(voFunctTransMovements.getStartHeight().toString()); if (voFunctTransMovements.getStartTarget() != null) childRow.setcolTargetStart(voFunctTransMovements.getStartTarget().toString()); if (voFunctTransMovements.getFinishPosition() != null) childRow.setcolFinishingPosition(voFunctTransMovements.getFinishPosition().toString()); if (voFunctTransMovements.getFinishHeight() != null) childRow.setcolHeightFinish(voFunctTransMovements.getFinishHeight().toString()); if (voFunctTransMovements.getFinishTarget() != null) childRow.setcolTargetFinish(voFunctTransMovements.getFinishTarget().toString()); if (voFunctTransMovements.getFIMScore() != null) childRow.setcolFIMScore(voFunctTransMovements.getFIMScore().toString()); if (voFunctTransMovements.getRisk() != null) childRow.setcolRisk(voFunctTransMovements.getRisk().toString()); // if not saved then set the colour if (voFunctTransMovements.getID_FunctionalTransfersTechnique() == null) childRow.setTextColor(Color.Red); }
private void promoteChild(FunctionalTransfersTechniqueVo voFunctionalTransfersTechnique) { if (voFunctionalTransfersTechnique == null) return; GenForm.grdFunctionalTransRow childRow = null; form.grdFunctionalTrans().setValue(form.getLocalContext().getSelectedParentInstance()); if (form.grdFunctionalTrans().getSelectedRow().getValue() instanceof FunctionalTransfersTechniqueVo) childRow = form.grdFunctionalTrans().getSelectedRow().getParentRow().getRows().newRow(); else childRow = form.grdFunctionalTrans().getSelectedRow().getRows().newRow(); populateChildNode(childRow, voFunctionalTransfersTechnique); }
private void newChildInstance() { clearChildInstanceControls(); form.getLocalContext().setSelectedChildInstance(null); loadEquipment(); loadTechnique(); if (form.grdFunctionalTrans().getValue() instanceof FunctionalTransfersShortVo) form.grdFunctionalTrans().setValue(form.grdFunctionalTrans().getSelectedRow().getValue()); else if (form.grdFunctionalTrans().getValue() instanceof FunctionalTransfersTechniqueVo) form.grdFunctionalTrans().setValue(form.grdFunctionalTrans().getSelectedRow().getParentRow().getValue()); }
private void updateInstance() { form.getLocalContext().setUpdatingParent(new Boolean(form.grdFunctionalTrans().getValue() instanceof FunctionalTransfersShortVo)); form.setMode(FormMode.EDIT); if (form.grdFunctionalTrans().getValue() instanceof FunctionalTransfersTechniqueVo) { FunctionalTransfersTechniqueVo voCachedChild = (FunctionalTransfersTechniqueVo) form.grdFunctionalTrans().getValue(); if (voCachedChild.getID_FunctionalTransfersTechnique() == null) { populateChildInstanceControls(voCachedChild); } } disableHeaderInfo(); }