private boolean countQuestionsExceed(boolean searchClassification, boolean searchText) { QuestionClassificationCollection qcColl = searchClassification?getGridClassification(false):null; Boolean isQuestion = searchClassification?isQuestionSearch():null; PreActiveActiveInactiveStatus status = searchClassification?getStatus():null; String text = searchText?getSearchText():null; Integer recCount = domain.countQuestion(qcColl, text, status, isQuestion); clearGrids(); if(recCount != null && recCount.intValue() == 0) { engine.showMessage("There are no Records for the Search Criteria Provided"); return false; } //If we have more than PAT_SEARCH_MAX_SIZE classifications and the number of selected classification is > 1 if((recCount != null && recCount.intValue() > getMaxValue()) && (qcColl != null && qcColl.size() > 1)) { engine.showMessage("There are more than " + ConfigFlag.DOM.PAT_SEARCH_MAX_SIZE.getValue() + " questions associated with these classification.\r\nPlease select only one classification"); return false; } return true; }
private void loadClassificationTree() { QuestionClassificationCollection classColl = LookupHelper.getQuestionClassification(domain.getLookupService()); form.lyrSearch().tabPageClassification().treClassification().clear(); //Load top parents LookupInstVo[] roots = classColl.getRoots(); for(int i=0; roots != null && i<roots.length; i++) { TreeNode nodeClass = form.lyrSearch().tabPageClassification().treClassification().getNodes().add(roots[i], roots[i].toString()); nodeClass.setExpanded(false); nodeClass.setCheckBoxVisible(true); loadChildren(nodeClass, roots[i]); TreeNode nodeTextClass = form.lyrSearch().tabPageTextClass().treTextAndClass().getNodes().add(roots[i], roots[i].toString()); nodeTextClass.setExpanded(true); nodeTextClass.setCheckBoxVisible(false); loadChildren(nodeTextClass, roots[i]); } }
private void searchClassification() { //Preload the grid with the same selected values as in the top tree (get the entire tree structure) - getGridClassification QuestionClassificationCollection qcColl = getGridClassification(); clearGrids(); //Load the parents loadParentGridNodes(qcColl); //Get the checked Classifications only - getClassification QuestionClassificationCollection qClassColl = getClassification(); //Populate the parent nodes populateParentNodes(qClassColl); //Load the Children Classification Nodes loadChildGridNodes(qcColl); //Populate the child nodes populateChildrenNodes(qClassColl); }
private void displayQuestions(QuestionInformationShortVoCollection collection) { QuestionClassificationCollection parents = new QuestionClassificationCollection(); //gather all the parents for(int i=0; i<collection.size(); i++) getParents(parents, collection.get(i).getClassification()); //Display all the parents buildParentNodes(parents); //Build Parent Data for(int i=0; i<collection.size(); i++) buildParentData(collection.get(i), collection.get(i).getClassification()); //Display all the children for(int i=0; i<collection.size(); i++) buildChildrenNodes(collection.get(i).getClassification()); //Build Child Data for(int i=0; i<collection.size(); i++) buildChildData(collection.get(i), collection.get(i).getClassification()); }
private QuestionClassificationCollection getClassification() { QuestionClassificationCollection coll = new QuestionClassificationCollection(); TreeNodeCollection nodeCollection; TreeNode node; if(isTextAndClassSearch()) nodeCollection = form.lyrSearch().tabPageTextClass().treTextAndClass().getNodes(); else nodeCollection = form.lyrSearch().tabPageClassification().treClassification().getNodes(); for(int i=0; nodeCollection != null && i<nodeCollection.size(); i++) { node = nodeCollection.get(i); if(node.isChecked()) coll.add((QuestionClassification)node.getValue()); if(node.getNodes() != null && node.getNodes().size() > 0) addClassification(coll, node); } return coll; }
private QuestionClassificationCollection getGridClassification(boolean addParents) { QuestionClassificationCollection coll = new QuestionClassificationCollection(); TreeNodeCollection nodeColl; TreeNode node; if(isTextAndClassSearch()) nodeColl = form.lyrSearch().tabPageTextClass().treTextAndClass().getNodes(); else nodeColl = form.lyrSearch().tabPageClassification().treClassification().getNodes(); for(int i=0; i<nodeColl.size(); i++) { node = nodeColl.get(i); if(node.isChecked()) coll.add((QuestionClassification)node.getValue()); if(node.getNodes() != null && node.getNodes().size() > 0) addGridClassification(coll, node, addParents); } return coll; }
private void addGridClassification(QuestionClassificationCollection coll, TreeNode parentNode, boolean addParents) { TreeNode childNode; for(int i=0; parentNode != null && i<parentNode.getNodes().size(); i++) { childNode = parentNode.getNodes().get(i); //Use && childrenSelected(node.getNodes()) == false if you want to have parent or child selected ( as in the Prev method) if(childNode.isChecked()) { coll.add((QuestionClassification)childNode.getValue()); //Add the parent as well if(addParents) { if(coll.indexOf((QuestionClassification)parentNode.getValue()) < 0) coll.add((QuestionClassification)parentNode.getValue()); } } if(childNode.getNodes() != null && childNode.getNodes().size() > 0) addGridClassification(coll, childNode, addParents); } }
private void loadNewGridNodes(QuestionInformationShortVo voQInfo) { QuestionClassificationCollection classification = voQInfo.getClassification(); if(classification != null) { //Get the Parents QuestionClassificationCollection parents = new QuestionClassificationCollection(); getParents(parents, classification); //Add the parents to the grid buildParentNodes(parents); //Add the QuestionInformationVo in the built up tree buildParentData(voQInfo, classification); //Add the children to the grid buildChildrenNodes(classification); //Add the QuestionInformationVo in the built up tree buildChildData(voQInfo, classification); } }
private void getParents(QuestionClassificationCollection parents, QuestionClassificationCollection classification) { QuestionClassification parentLkp; //Build the parent collection for(int i=0; i<classification.size(); i++) { parentLkp = getParentLkp(classification.get(i)); if(parentLkp != null) { if(parents.indexOf(parentLkp) < 0) parents.add(parentLkp); } else { if(parents.indexOf(classification.get(i)) < 0) parents.add(classification.get(i)); } } }
private QuestionClassification getParentLkp(QuestionClassification lkpItem) { QuestionClassificationCollection classColl = LookupHelper.getQuestionClassification(domain.getLookupService()); //Load top parents LookupInstVo[] roots = classColl.getRoots(); for(int i=0; roots != null && i<roots.length; i++) { for(int j=0; roots[i].getChildInstances() != null && j<roots[i].getChildInstances().size(); j++) { if(roots[i].getChildInstances().get(j).equals(lkpItem)) return (QuestionClassification)roots[i]; } } return null; }
/** * */ private void loadClassification() { //Classification if(isDialog()) form.lyrTabs().tabSearchQuestion().cmbClassification().clear(); else form.lyrTabs().tabListQuestions().cmbClassificationList().clear(); QuestionClassificationCollection classificationColl = LookupHelper.getQuestionClassification(domain.getLookupService()); for(int i=0; classificationColl != null && i<classificationColl.size(); i++) { if(classificationColl.get(i).getParent() != null) { if(isDialog()) form.lyrTabs().tabSearchQuestion().cmbClassification().newRow(classificationColl.get(i), classificationColl.get(i).toString()); else form.lyrTabs().tabListQuestions().cmbClassificationList().newRow(classificationColl.get(i), classificationColl.get(i).toString()); } } }
private QuestionClassificationCollection getClassification() { QuestionClassificationCollection coll = new QuestionClassificationCollection(); TreeNode parentNode, childNode; for (int i = 0; i < form.lyrTabs().tabNewQuestion().lyrDetails().tabClasification().treClassification().getNodes().size(); i++) { parentNode = form.lyrTabs().tabNewQuestion().lyrDetails().tabClasification().treClassification().getNodes().get(i); if (parentNode.isChecked()) coll.add((QuestionClassification) parentNode.getValue()); for (int j = 0; parentNode != null && j < parentNode.getNodes().size(); j++) { childNode = parentNode.getNodes().get(j); if (childNode.isChecked()) coll.add((QuestionClassification) childNode.getValue()); } } return coll; }
private void loadClassificationTree() { form.lyrTabs().tabNewQuestion().lyrDetails().tabClasification().treClassification().clear(); /*if (isPrimaryQuestion() == false) return;*/ QuestionClassificationCollection classColl = LookupHelper.getQuestionClassification(domain.getLookupService()); // Load top parents LookupInstVo[] roots = classColl.getRoots(); for (int i = 0; roots != null && i < roots.length; i++) { TreeNode node = form.lyrTabs().tabNewQuestion().lyrDetails().tabClasification().treClassification().getNodes().add(roots[i], roots[i].toString()); node.setExpanded(true); node.setCheckBoxVisible(false); loadChildren(node, roots[i]); } }
private QuestionClassificationCollection getClassification() { QuestionClassificationCollection coll = new QuestionClassificationCollection(); TreeNode parentNode, childNode; for(int i=0; i<form.treClassification().getNodes().size(); i++) { parentNode = form.treClassification().getNodes().get(i); if(parentNode.isChecked()) coll.add((QuestionClassification)parentNode.getValue()); for(int j=0; parentNode != null && j<parentNode.getNodes().size(); j++) { childNode = parentNode.getNodes().get(j); if(childNode.isChecked()) coll.add((QuestionClassification)childNode.getValue()); } } return coll; }