private void updateControlState() { Object selectedValue = null; if (form.dyngrdMain().getSelectedRow() != null) selectedValue = form.dyngrdMain().getSelectedRow().getValue(); boolean isConsultantSelected = selectedValue instanceof ConsultantProcedureCategoryVo; boolean isCategorySelected = selectedValue instanceof CategoryProceduresVo; boolean isProcedureSelected = selectedValue instanceof ProcedureLiteVo; boolean viewMode = FormMode.VIEW.equals(form.getMode()); form.getContextMenus().Admin.getConsultantProcedureCategoryAddConsultantItem().setVisible(viewMode); form.getContextMenus().Admin.getConsultantProcedureCategoryAddCategoryItem().setVisible(isConsultantSelected || isCategorySelected); form.getContextMenus().Admin.getConsultantProcedureCategoryAddProcedureItem().setVisible(isCategorySelected || isProcedureSelected); form.getContextMenus().Admin.getConsultantProcedureCategoryRemoveConsultantItem().setVisible(isConsultantSelected); form.getContextMenus().Admin.getConsultantProcedureCategoryRemoveCategoryItem().setVisible(isCategorySelected); form.getContextMenus().Admin.getConsultantProcedureCategoryRemoveProcedureItem().setVisible(isProcedureSelected); if (viewMode) form.btnEdit().setVisible(isCategorySelected || isConsultantSelected || isProcedureSelected); }
private void loadCategoryComboByHcp() { ConsultantProcedureCategoryVo voConsultantProcedureCategory = null; try { voConsultantProcedureCategory = domain.getConsultantProcedureCategoryByHcp(form.getLocalContext().getHcpFilter()); } catch (DomainInterfaceException e) { // TODO Auto-generated catch block e.printStackTrace(); } form.cmbCategory().clear(); if (voConsultantProcedureCategory == null) return; if(voConsultantProcedureCategory.getCategoryProceduresIsNotNull()) for(int x = 0; x < voConsultantProcedureCategory.getCategoryProcedures().size(); x++) { CategoryProceduresVo voCategoryProcedures = voConsultantProcedureCategory.getCategoryProcedures().get(x); form.cmbCategory().newRow(voCategoryProcedures.getCategory(), voCategoryProcedures.getCategory().getText(), voCategoryProcedures.getCategory().getImage(), voCategoryProcedures.getCategory().getTextColor()); } }
private void populateScreenFromData(ConsultantProcedureCategoryVoCollection record) { form.dyngrdMain().getRows().clear(); if (record == null || record.size()==0) { engine.showMessage("No records where found ", "Information", MessageButtons.OK, MessageIcon.INFORMATION); return; } for (int i = 0; i < record.size(); i++) { ConsultantProcedureCategoryVo cpc = record.get(i); if (cpc != null) { DynamicGridRow rowCons = addConsultantToGrid(cpc.getPerformingHCP()); rowCons.setValue(cpc); CategoryProceduresVoCollection categoryProcedures = cpc.getCategoryProcedures(); if (categoryProcedures != null) { for (int j = 0; j < categoryProcedures.size(); j++) { CategoryProceduresVo categoryProceduresVo = categoryProcedures.get(j); DynamicGridRow rowCat = addCategoryToGrid(rowCons, categoryProceduresVo.getCategory()); rowCat.setValue(categoryProceduresVo); ProcedureLiteVoCollection procedures = categoryProceduresVo.getProcedures(); if (procedures != null) { for (int k = 0; k < procedures.size(); k++) { addProcedureToGrid(rowCat, procedures.get(k)); } } } rebindAllGridComboBoxes(rowCons); } } } }
private Image getDisabledImage(DynamicGridRow row) { if (row == null) return null; Object value = row.getValue(); if (value instanceof ConsultantProcedureCategoryVo) return form.getImages().Admin.ConsultantDisabled16; if (value instanceof CategoryProceduresVo) return form.getImages().Admin.CategoryDisabled16; if (value instanceof ProcedureLiteVo) return form.getImages().Admin.ProcedureDisabled16; return null; }
private void addConsultant() { DynamicGridRow consult = addConsultantToGrid(null); consult.setValue(new ConsultantProcedureCategoryVo()); form.getLocalContext().setCurrentEditedConsultant(consult); form.dyngrdMain().setSelectedRow(consult); form.setMode(FormMode.EDIT); }
public ims.admin.vo.ConsultantProcedureCategoryVo save(ims.admin.vo.ConsultantProcedureCategoryVo record) throws ims.domain.exceptions.DomainInterfaceException, ims.domain.exceptions.StaleObjectException, ims.domain.exceptions.UniqueKeyViolationException { if (record == null) throw new DomainInterfaceException("The record you want to save is null"); if (!record.isValidated()) throw new DomainInterfaceException("The record you want to save is not validated"); ConsultantProcedureCategory domObj = ConsultantProcedureCategoryVoAssembler.extractConsultantProcedureCategory(getDomainFactory(), record); getDomainFactory().save(domObj); return ConsultantProcedureCategoryVoAssembler.create(domObj); }
public void deleteConfiguredConsultant(ConsultantProcedureCategoryVo confdConsultant) throws DomainInterfaceException, StaleObjectException, ForeignKeyViolationException { if (!confdConsultant.getID_ConsultantProcedureCategoryIsNotNull()) { throw new DomainInterfaceException("New record recived for deletion "); } ConsultantProcedureCategory obj = ConsultantProcedureCategoryVoAssembler.extractConsultantProcedureCategory(getDomainFactory(),confdConsultant); getDomainFactory().delete(obj); }
public ConsultantProcedureCategoryVo getConsultantProcedureCategoryByHcp(HcpLiteVo hcp) throws DomainInterfaceException { if(hcp == null) throw new CodingRuntimeException("hcp is null"); DomainFactory factory = getDomainFactory(); List conProcCateList = factory.find("from ConsultantProcedureCategory cpc where cpc.performingHCP.id = :idHcp)", new String[]{"idHcp"}, new Object[]{hcp.getID_Hcp()}); ConsultantProcedureCategoryVoCollection coll = ConsultantProcedureCategoryVoAssembler.createConsultantProcedureCategoryVoCollectionFromConsultantProcedureCategory(conProcCateList); if(coll.size()!= 0) return coll.get(0); else return null; }
private void searchAndDisplayHcpInGridQCmb(DynamicGridCell cell) throws PresentationLogicException { String typedText = cell.getTypedText(); cell.getItems().clear(); cell.setTypedText(null); if (form.getLocalContext().getCurrentEditedConsultantIsNotNull() && (form.getLocalContext().getCurrentEditedConsultant().getValue() instanceof ConsultantProcedureCategoryVo)) { HcpLiteVo savedConsultant = ((ConsultantProcedureCategoryVo)form.getLocalContext().getCurrentEditedConsultant().getValue()).getPerformingHCP(); if (savedConsultant != null) cell.getItems().newItem(savedConsultant); } HcpLiteVoCollection result; try { result = domain.listHcpLiteNotConfigured(typedText); } catch (DomainInterfaceException e) { throw new PresentationLogicException(e); } if (result!=null) { for (int i = 0; i < result.size(); i++) { cell.getItems().newItem(result.get(i)); } } if (cell.getItems().size() > 0) { if (cell.getItems().size() == 1) { cell.setValue(cell.getItems().get(0).getValue()); } else { cell.showOpened(); } } DynamicGridRow selectedRow = form.dyngrdMain().getSelectedRow(); if (selectedRow!=null) { form.dyngrdMain().setSelectedRow(null); form.dyngrdMain().setSelectedRow(selectedRow); } }