private boolean save(PathSpecimenContainerVo voPathSpecimenContainer) { String[] arrErrors = voPathSpecimenContainer.validate(); if(arrErrors != null) { engine.showErrors(arrErrors); return false; } try { voPathSpecimenContainer = domain.savePathSpecimenContainer(voPathSpecimenContainer); } catch (StaleObjectException e) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); return false; } form.getGlobalContext().OCRR.setPathSpecimenContainerVo(voPathSpecimenContainer); return true; }
/** * lists PathSpecimenContainers */ public ims.ocrr.vo.PathSpecimenContainerVoCollection listPathSpecimenContainers(PathSpecimenContainerVo filter) { DomainFactory factory = getDomainFactory(); IMSCriteria imsc= new IMSCriteria (PathSpecimenContainer.class,factory); imsc.addOrder("pathSpecimenOrder", ORDERMODE.ASC); if (filter!=null) { if (filter.getNameIsNotNull()) { imsc.like("name", "%"+filter.getName()+"%"); } if (filter.getManufacturerIsNotNull()) imsc.equal("manufacturer.id", getDomLookup(filter.getManufacturer()).getId()); if (filter.getIsActiveIsNotNull()) imsc.equal("isActive", filter.getIsActive()); } List<?> containers=imsc.find(); return PathSpecimenContainerVoAssembler.createPathSpecimenContainerVoCollectionFromPathSpecimenContainer(containers); }
private void populateContainerData(PathSpecimenContainerVo voPathSpecimenContainer) { populateScreenFromData(voPathSpecimenContainer); populateTaxonomyGrid(voPathSpecimenContainer); if(voPathSpecimenContainer.getColourIsNotNull()){ form.cmbColour().setValue(voPathSpecimenContainer.getColour()); } if(voPathSpecimenContainer.getAdditiveIsNotNull()) setAdditives(voPathSpecimenContainer.getAdditive()); }
private void populateTaxonomyGrid(PathSpecimenContainerVo voPathSpecimenContainer) { form.grdTaxonomy().getRows().clear(); if (voPathSpecimenContainer != null && voPathSpecimenContainer.getTaxonomyMapIsNotNull()) { voPathSpecimenContainer.getTaxonomyMap().sort(); for (int i = 0; i < voPathSpecimenContainer.getTaxonomyMap().size(); i++) { addTaxonomyRow(voPathSpecimenContainer.getTaxonomyMap().get(i)); } } }
private void compareOrder() { Vector<PathSpecimenContainerVo> v=new Vector<PathSpecimenContainerVo>(); Vector<PathSpecimenContainerVo> ve=new Vector<PathSpecimenContainerVo>(); for (int i=0;i<form.grdSpecContainers().getRows().size();i++) { PathSpecimenContainerVo specimen= form.grdSpecContainers().getRows().get(i).getValue(); specimen.setPathSpecimenOrder(i); v.add(specimen); } if (form.getLocalContext().getinitialOrderIsNotNull()) for (int j=0;j<form.getLocalContext().getinitialOrder().size();j++) { ve.add(form.getLocalContext().getinitialOrder().get(j)); } if (v.equals(ve)) { form.btnSave().setEnabled(false); form.getLocalContext().setHasOrderBeenChanged(false); } else { form.btnSave().setEnabled(true); form.getLocalContext().setHasOrderBeenChanged(true); } }
@Override protected void onBtnSaveClick() throws PresentationLogicException { PathSpecimenContainerVoCollection specimens=new PathSpecimenContainerVoCollection(); for (int i=0;i<form.grdSpecContainers().getRows().size();i++) { PathSpecimenContainerVo specimen= form.grdSpecContainers().getRows().get(i).getValue(); specimen.setPathSpecimenOrder(i); specimens.add(specimen); } if (specimens!=null) try { domain.savePathSpecimenContainers(specimens); form.getLocalContext().setinitialOrder(specimens); } catch (StaleObjectException e) { engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); } form.grdSpecContainers().setValue(null); form.getLocalContext().setHasOrderBeenChanged(false); setControlState(); form.btnSave().setEnabled(false); populateSearchCriteria(); doSearch(true); }
private void doSearch(boolean showErrors) { form.getLocalContext().setHasOrderBeenChanged(false); //WDEV-14031 form.grdSpecContainers().getRows().clear(); String[] error = getCriteriaValidationErrors(); if (error != null && error.length > 0) { if (showErrors) engine.showErrors(error); setControlState(); return; } if (form.cmbManufacturer().getValue()!=null) form.getLocalContext().setMovingRowsAllowed(false); else form.getLocalContext().setMovingRowsAllowed(true); PathSpecimenContainerVo filter = new PathSpecimenContainerVo(); filter.setManufacturer(form.cmbManufacturer().getValue()); filter.setName(form.txtName().getValue()); form.getLocalContext().setFilter(filter); form.getLocalContext().setinitialOrder(domain.listPathSpecimenContainers(filter)); populateSpecContainerGrid(form.getLocalContext().getinitialOrder()); if (!form.getLocalContext().getinitialOrderIsNotNull() || form.getLocalContext().getinitialOrder().size()==0) { engine.showMessage("No records found."); } setControlState(); }
protected void onContextMenuItemClick(int menuItemID, ims.framework.Control sender) throws ims.framework.exceptions.PresentationLogicException { int index = form.grdSpecContainers().getSelectedRowIndex(); switch (menuItemID) { case ims.ocrr.forms.specimencontainerlist.GenForm.ContextMenus.OCRRSpecimenContainer.ADD: form.getGlobalContext().OCRR.setPathSpecimenContainerVo(null); engine.open(form.getForms().OCRR.SpecimenContainerAddEdit); break; case ims.ocrr.forms.specimencontainerlist.GenForm.ContextMenus.OCRRSpecimenContainer.UPDATE: grdSpecContainersRow row = form.grdSpecContainers().getRows().get(index); PathSpecimenContainerVo voPathSpecimenContainer = row.getValue(); form.getGlobalContext().OCRR.setPathSpecimenContainerVo(voPathSpecimenContainer); form.getGlobalContext().OCRR.setUpdatePathSpecimenContainer(Boolean.TRUE); engine.open(form.getForms().OCRR.SpecimenContainerAddEdit); break; case ims.ocrr.forms.specimencontainerlist.GenForm.ContextMenus.OCRRSpecimenContainer.VIEW: grdSpecContainersRow rowView = form.grdSpecContainers().getRows().get(index); PathSpecimenContainerVo voPathSpecimenContainerView = rowView.getValue(); form.getGlobalContext().OCRR.setPathSpecimenContainerVo(voPathSpecimenContainerView); form.getGlobalContext().OCRR.setUpdatePathSpecimenContainer(Boolean.FALSE); engine.open(form.getForms().OCRR.SpecimenContainerAddEdit); break; case ims.ocrr.forms.specimencontainerlist.GenForm.ContextMenus.OCRRSpecimenContainer.MOVEUP: form.grdSpecContainers().moveUp(); form.btnSave().setEnabled(true); form.getLocalContext().setHasOrderBeenChanged(true); setControlState(); compareOrder(); break; case ims.ocrr.forms.specimencontainerlist.GenForm.ContextMenus.OCRRSpecimenContainer.MOVEDOWN: form.grdSpecContainers().moveDown(); form.btnSave().setEnabled(true); form.getLocalContext().setHasOrderBeenChanged(true); setControlState(); compareOrder(); } }