private void newParentRow(PatientHandlingMovementVo voNewParent) { if (voNewParent == null) return; DynamicGridRow parentRow = form.dyngrdDetails().getRows().newRow(); DynamicGridCell cellMovement = parentRow.getCells().newCell( form.dyngrdDetails().getColumns().getByIdentifier(MOVEMENT_COLUMN), DynamicCellType.STRING); if(voNewParent.getAuthoringInformationIsNotNull()) cellMovement.setValue(voNewParent.getAuthoringInformation().toString()); parentRow.setValue(voNewParent); parentRow.setBackColor(Color.Beige); parentRow.setExpanded(true); form.dyngrdDetails().setValue(voNewParent); }
/** * @calls the Domain Get for the selected node.. * */ private void expandParentRow(DynamicGridRow selectedRow) { if (selectedRow.getValue() instanceof PatientHandlingMovementVo == false) return; // form.getLocalContext().setSelectedParentInstance((PatientHandlingMovementVo) selectedRow.getValue()); // if (form.getLocalContext().getSelectedParentInstance() == null) // return; // PatientHandlingMovementVo voParentInstance = ((PatientHandlingMovementVo)selectedRow.getValue()); if (voParentInstance.getDetailsIsNotNull()) { selectedRow.setExpanded(true); populateChildRows(selectedRow, voParentInstance.getDetails()); } populateParentInstanceControls(voParentInstance); }
private void populateParentRow(PatientHandlingMovementVo voPatHandlingMovement) { if (voPatHandlingMovement == null) return; DynamicGridRow parRow = form.dyngrdDetails().getRows().newRow(); DynamicGridCell cellMovement = parRow.getCells().newCell( form.dyngrdDetails().getColumns().getByIdentifier(MOVEMENT_COLUMN), DynamicCellType.STRING); if(voPatHandlingMovement.getAuthoringInformationIsNotNull()) { cellMovement.setValue(voPatHandlingMovement.getAuthoringInformation().toString(" - ")); cellMovement.setTooltip(voPatHandlingMovement.getAuthoringInformation().toString(" - ")); } parRow.setValue(voPatHandlingMovement); if (voPatHandlingMovement.getCareContextIsNotNull() && form.getGlobalContext().Core.getCurrentCareContextIsNotNull() && voPatHandlingMovement.getCareContext().getID_CareContext().equals(form.getGlobalContext().Core.getCurrentCareContext().getID_CareContext())) { //form.dyngrdDetails().setValue(voPatHandlingMovement); expandParentRow(parRow); } }
private void populateChildCollectionFromGrid(PatientHandlingMovementVo voPatHandMovement) { if (form.dyngrdDetails().getValue() == null) return; if (voPatHandMovement.getDetails() == null) voPatHandMovement.setDetails(new HandlingMovementDetailVoCollection()); DynamicGridRow parentRow = form.dyngrdDetails().getValue() instanceof PatientHandlingMovementVo ? form.dyngrdDetails().getSelectedRow() : form.dyngrdDetails().getSelectedRow().getParent(); if (parentRow.getRows().size() > 0) voPatHandMovement.getDetails().clear(); for (int i = 0; i < parentRow.getRows().size(); i++) { voPatHandMovement.getDetails().add((HandlingMovementDetailVo) parentRow.getRows().get(i).getValue()); } }
private void showHeaderOrDetailsTab() { if (form.getMode().equals(FormMode.VIEW)) { // In view mode just show the selected node if (form.dyngrdDetails().getValue() instanceof PatientHandlingMovementVo) form.ctnHandling().lyrDetails().showtabHeader(); else if (form.dyngrdDetails().getValue() instanceof HandlingMovementDetailVo) form.ctnHandling().lyrDetails().showtabDetails(); else form.ctnHandling().lyrDetails().showtabEmpty(); } else { if (form.getLocalContext().getUpdatingParent().equals(Boolean.TRUE)) form.ctnHandling().lyrDetails().showtabHeader(); else form.ctnHandling().lyrDetails().showtabDetails(); } }
private void removeUsedMovements() { PatientHandlingMovementCollection collUsedItems = new PatientHandlingMovementCollection(); if(form.getLocalContext().getSelectedParentInstanceIsNotNull()) { PatientHandlingMovementVo voPatHandlingMovement = form.getLocalContext().getSelectedParentInstance(); if(voPatHandlingMovement.getDetailsIsNotNull()) { for(int i=0; i<voPatHandlingMovement.getDetails().size(); i++) { if(voPatHandlingMovement.getDetails().get(i).getMovementIsNotNull()) collUsedItems.add(voPatHandlingMovement.getDetails().get(i).getMovement()); } } } for(int i=0;i<collUsedItems.size(); i++) form.ctnHandling().lyrDetails().tabDetails().cmbMovement().removeRow(collUsedItems.get(i)); }
private void removeChild() { PatientHandlingMovementVo voParent = (PatientHandlingMovementVo) form.dyngrdDetails().getSelectedRow().getParent().getValue(); form.dyngrdDetails().getRows().remove(form.dyngrdDetails().getSelectedRow()); form.dyngrdDetails().setValue(voParent); updateContextMenusState(); }
private void updateInstance() { form.getLocalContext().setUpdatingParent(new Boolean(form.dyngrdDetails().getValue() instanceof PatientHandlingMovementVo)); if (form.dyngrdDetails().getValue() instanceof HandlingMovementDetailVo) { HandlingMovementDetailVo voCachedChild = (HandlingMovementDetailVo) form.dyngrdDetails().getValue(); if (voCachedChild.getID_HandlingMovementDetail() == null) { populateChildInstanceControls(voCachedChild); } } 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; } // expand the selected parent if (form.dyngrdDetails().getValue() instanceof PatientHandlingMovementVo) { form.getLocalContext().setSelectedParentInstance((PatientHandlingMovementVo) form.dyngrdDetails().getValue()); populateParentInstanceControls(form.getLocalContext().getSelectedParentInstance()); form.getLocalContext().setSelectedChildInstance(null); clearChildInstanceControls(); } else if (form.dyngrdDetails().getValue() instanceof HandlingMovementDetailVo) { form.getLocalContext().setSelectedParentInstance((PatientHandlingMovementVo) form.dyngrdDetails().getSelectedRow().getParent().getValue()); form.getLocalContext().setSelectedChildInstance((HandlingMovementDetailVo) form.dyngrdDetails().getValue()); populateChildInstanceControls(form.getLocalContext().getSelectedChildInstance()); } updateControlsState(); }
private boolean save() { if (checkForUnsavedChild()) return false; PatientHandlingMovementVo voPatHandlingMovement = populateInstanceData(form.getLocalContext().getSelectedParentInstance()); if (voPatHandlingMovement.getCareContext() == null) voPatHandlingMovement.setCareContext(form.getGlobalContext().Core.getCurrentCareContext()); if (voPatHandlingMovement.getClinicalContact() == null) voPatHandlingMovement.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact()); String[] arrErrors = voPatHandlingMovement.validate(); if (arrErrors != null) { engine.showErrors(arrErrors); return false; } try { form.getLocalContext().setSelectedParentInstance(domain.savePatientHandlingMovement(voPatHandlingMovement)); } catch (StaleObjectException e) { engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); open(); return false; } setUpdatedChild(); return true; }
private void newParentInstance() { form.dyngrdDetails().setValue(null); PatientHandlingMovementVo voNewParent = new PatientHandlingMovementVo(); form.ctnHandling().lyrDetails().tabHeader().customControlAuthoringInfo().initializeComponent(); voNewParent.setAuthoringInformation(form.ctnHandling().lyrDetails().tabHeader().customControlAuthoringInfo().getValue()); voNewParent.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact()); voNewParent.setDetails(new HandlingMovementDetailVoCollection()); populateParentInstanceControls(voNewParent); form.getLocalContext().setSelectedParentInstance(voNewParent); }
private void updateContextMenusState() { if (form.dyngrdDetails().getSelectedRow() != null) { // 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.dyngrdDetails().getValue() instanceof PatientHandlingMovementVo) form.getContextMenus().getGenericGridUpdateItem().setText("Edit Patient Handling Movement"); else if (form.dyngrdDetails().getValue() instanceof HandlingMovementDetailVo) form.getContextMenus().getGenericGridUpdateItem().setText("Edit Details"); // If the golden node is selected we can now only add child nodes so // set the menu text accordingly. form.getContextMenus().getGenericGridAddItem().setText("Add Details"); // Only show the update menu if the user has selected an item to // update. form.getContextMenus().getGenericGridUpdateItem().setVisible((form.getMode().equals(FormMode.VIEW) && form.dyngrdDetails().getSelectedRow() != null) || (form.getMode().equals(FormMode.EDIT) && form.dyngrdDetails().getValue() instanceof HandlingMovementDetailVo && ((HandlingMovementDetailVo) form.dyngrdDetails().getValue()).getID_HandlingMovementDetail() == null)); } else { form.getContextMenus().getGenericGridAddItem().setText("New Patient Handling Movement"); form.getContextMenus().getGenericGridUpdateItem().setVisible(false); } form.getContextMenus().getGenericGridAddItem().setVisible(form.getGlobalContext().Core.getCurrentCareContextIsNotNull() && form.getMode().equals(FormMode.VIEW)); form.getContextMenus().getGenericGridRemoveItem().setVisible(form.getMode().equals(FormMode.EDIT) && form.dyngrdDetails().getValue() instanceof HandlingMovementDetailVo && ((HandlingMovementDetailVo) form.dyngrdDetails().getValue()).getID_HandlingMovementDetail() == null); }