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 expandParentNode(grdFunctionalTransRow selectedRow) { if (selectedRow.getValue() instanceof FunctionalTransfersShortVo == false) return; form.getLocalContext().setSelectedParentInstance(getParentFromDomain((FunctionalTransfersShortVo) selectedRow.getValue())); if (form.getLocalContext().getSelectedParentInstance() == null) return; FunctionalTransfersVo voParentInstance = form.getLocalContext().getSelectedParentInstance(); if (form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull() && (voParentInstance.getClinicalContact().getID_ClinicalContact().equals(form.getGlobalContext().Core.getCurrentClinicalContact().getID_ClinicalContact()))) { // If this is the Golden Node then we'll colour it golden (ok then // beige). form.getLocalContext().setGoldenInstanceFound(new Boolean(true)); form.getLocalContext().setGoldenInstanceSelected(new Boolean(true)); selectedRow.setBackColor(Color.Beige); } if (voParentInstance.getMovementsIsNotNull()) { selectedRow.setExpanded(true); populateChildNodes(selectedRow, voParentInstance.getMovements()); } populateParentInstanceControls(voParentInstance); }
private void newParentNode(FunctionalTransfersVo voNewParent) { if (voNewParent == null) return; FunctionalTransfersShortVo voParentShort = new FunctionalTransfersShortVo(); voParentShort.setAuthoringCP(voNewParent.getAuthoringCP()); voParentShort.setAuthoringDateTime(voNewParent.getAuthoringDateTime()); voParentShort.setClinicalContact(voNewParent.getClinicalContact()); GenForm.grdFunctionalTransRow parentRow = form.grdFunctionalTrans().getRows().newRow(); if (voParentShort.getAuthoringCP() != null) parentRow.setcolStartingPositionParent(voParentShort.getAuthoringDateTime().toString() + " - " + voParentShort.getAuthoringCP().toString()); parentRow.setValue(voParentShort); parentRow.setBackColor(Color.Beige); form.getLocalContext().setGoldenInstanceSelected(new Boolean(true)); parentRow.setExpanded(true); form.grdFunctionalTrans().setValue(voParentShort); }
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 populateParentNode(FunctionalTransfersShortVo voFunctTransParent) { GenForm.grdFunctionalTransRow parRow = form.grdFunctionalTrans().getRows().newRow(); parRow.setcolStartingPositionParent(voFunctTransParent.getAuthoringDateTime().toString()); // parRow.setTooltip(voRehabParent.getCareContext().toString()); parRow.setValue(voFunctTransParent); form.grdFunctionalTrans().setValue(voFunctTransParent); expandParentNode(parRow); }
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 removeChild() { FunctionalTransfersShortVo voParent = (FunctionalTransfersShortVo) form.grdFunctionalTrans().getSelectedRow().getParentRow().getValue(); form.grdFunctionalTrans().removeSelectedRow(); form.grdFunctionalTrans().setValue(voParent); updateContextMenusState(); }
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(); }
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.grdFunctionalTrans().getValue() instanceof FunctionalTransfersShortVo) { form.getLocalContext().setSelectedParentInstance(getParentFromDomain((FunctionalTransfersShortVo) form.grdFunctionalTrans().getValue())); populateParentInstanceControls(form.getLocalContext().getSelectedParentInstance()); // add activities if not added already populateChildNodes(form.grdFunctionalTrans().getSelectedRow(), form.getLocalContext().getSelectedParentInstance().getMovements()); form.getLocalContext().setSelectedChildInstance(null); clearChildInstanceControls(); } else if (form.grdFunctionalTrans().getValue() instanceof FunctionalTransfersTechniqueVo) { form.getLocalContext().setSelectedChildInstance((FunctionalTransfersTechniqueVo) form.grdFunctionalTrans().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 FunctionalTransfersVo getParentFromDomain(FunctionalTransfersShortVo voFunctTransShort) { return domain.getFunctionalTransfers(voFunctTransShort); }
private void updateContextMenusState() { if (form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull()) { if (form.getLocalContext().getGoldenInstanceSelected().booleanValue()) { // If the golden instance is currently selected we change the // text of the update context menu // based on whether a parent or child node is selected in the // grid. if (form.grdFunctionalTrans().getValue() instanceof FunctionalTransfersShortVo) form.getContextMenus().getGenericGridUpdateItem().setVisible(false); else if (form.grdFunctionalTrans().getValue() instanceof FunctionalTransfersTechniqueVo) form.getContextMenus().getGenericGridUpdateItem().setText("Edit Functional Transfers Technique"); // If the golden node is selected we can now only add child // nodes so set the menu text accordingly. form.getContextMenus().getGenericGridAddItem().setText("Add Functional Transfers Technique"); // Only show the update menu if the user has selected an item to // update. form.getContextMenus().getGenericGridUpdateItem().setVisible((form.getMode().equals(FormMode.VIEW) && form.grdFunctionalTrans().getSelectedRowIndex() >= 0) && form.grdFunctionalTrans().getValue() instanceof FunctionalTransfersTechniqueVo || (form.getMode().equals(FormMode.EDIT) && form.grdFunctionalTrans().getValue() instanceof FunctionalTransfersTechniqueVo && ((FunctionalTransfersTechniqueVo) form.grdFunctionalTrans().getValue()).getID_FunctionalTransfersTechnique() == null)); } else { // If the golden instance has been found but NOT selected hide // the context menu's if (form.getLocalContext().getGoldenInstanceFound().booleanValue() == true) { form.getContextMenus().hideAllGenericGridMenuItems(); return; } else { form.getContextMenus().getGenericGridAddItem().setText("New Functional Transfer"); form.getContextMenus().getGenericGridUpdateItem().setVisible(false); } } form.getContextMenus().getGenericGridAddItem().setVisible(form.getMode().equals(FormMode.VIEW)); form.getContextMenus().getGenericGridRemoveItem().setVisible(form.getMode().equals(FormMode.EDIT) && form.grdFunctionalTrans().getValue() instanceof FunctionalTransfersTechniqueVo && ((FunctionalTransfersTechniqueVo) form.grdFunctionalTrans().getValue()).getID_FunctionalTransfersTechnique() == null); } else { form.getContextMenus().hideAllGenericGridMenuItems(); } }