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 addCategory() { DynamicGridRow parent = form.dyngrdMain().getSelectedRow(); if (parent.getValue() instanceof CategoryProceduresVo) parent = parent.getParent(); DynamicGridRow newRow = addCategoryToGrid(parent, null); newRow.setValue(new CategoryProceduresVo()); form.dyngrdMain().setSelectedRow(newRow); form.getLocalContext().setCurrentEditedConsultant(getConsultantParent(parent)); form.getLocalContext().getCurrentEditedConsultant().setExpanded(true,true); rebindAllGridComboBoxes(parent); if (FormMode.VIEW.equals(form.getMode())) { form.setMode(FormMode.EDIT); } }
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; }
@Override protected void onDyngrdMainCellValueChanged(DynamicGridCell cell) { if (cell.getRow().getValue() instanceof CategoryProceduresVo) { rebindAllGridComboBoxes(cell.getRow().getParent()); updateControlState(); } }
private void addCategory() { DynamicGridRow parent = form.dyngrdMain().getSelectedRow(); if (parent.getValue() instanceof CategoryProceduresVo) parent = parent.getParent(); //WDEV-20498 if(remainingCategory(parent) == 0) { engine.showMessage("No Categories available.", "Warning", MessageButtons.OK, MessageIcon.WARNING); return; } DynamicGridRow newRow = addCategoryToGrid(parent, null); newRow.setValue(new CategoryProceduresVo()); form.dyngrdMain().setSelectedRow(newRow); form.getLocalContext().setCurrentEditedConsultant(getConsultantParent(parent)); form.getLocalContext().getCurrentEditedConsultant().setExpanded(true,true); rebindAllGridComboBoxes(parent); if (FormMode.VIEW.equals(form.getMode())) { form.setMode(FormMode.EDIT); } }