use of org.primefaces.model.TreeNode in project opentheso by miledrousset.
the class NewTreeBean method reExpand.
public void reExpand() {
TreeChange tc = new TreeChange();
tc.saveExpandedNodes(root);
this.reInit();
this.initTree(selectedTerme.getIdTheso(), selectedTerme.getIdlangue());
ArrayList<String> ids = new ArrayList<>();
for (TreeNode tn : tc.getExpandedNodes()) {
ids.add(((MyTreeNode) tn).getIdConcept());
}
ids.addAll(tc.getPathFromSelectedConcept(connect, (MyTreeNode) selectedNode));
ids.add(selectedTerme.getIdC());
// code pour forcer le depliment de l'arbre
reExpandNodes(root, ids, selectedTerme.getIdC());
if (selectedNode == null) {
// selectedNode = new MyTreeNode(0, "", "", "", "", "", "domaine", "", root);
}
// selectedNode.setSelected(false);
for (TreeNode tn : selectedNodes) {
tn.setSelected(false);
}
selectedNodes = new ArrayList<>();
ArrayList<String> first = new ArrayList<>();
first.add(selectedTerme.getIdC());
ArrayList<ArrayList<String>> paths = new ArrayList<>();
paths = new ConceptHelper().getPathOfConcept(connect.getPoolConnexion(), selectedTerme.getIdC(), selectedTerme.getIdTheso(), first, paths);
if (paths != null) {
// reExpandTree(paths, selectedTerme.getIdTheso(), selectedTerme.getIdlangue(),tc);
}
}
use of org.primefaces.model.TreeNode in project opentheso by miledrousset.
the class NewTreeBean method changeTerme.
public void changeTerme(String id, int type) {
selectedNode.setSelected(false);
for (TreeNode node : selectedNodes) {
node.setSelected(false);
}
String idTC;
if (((MyTreeNode) selectedNode).isIsGroup() || ((MyTreeNode) selectedNode).isIsSubGroup()) {
// type == 2) { //On vient d'un domaine
idTC = id;
} else {
idTC = selectedTerme.getIdTopConcept();
}
// / ????? à comprendre pourquoi ?????
if (type == 0) {
boolean temp = new ConceptHelper().getThisConcept(connect.getPoolConnexion(), id, selectedTerme.getIdTheso()).isTopConcept();
if (temp) {
type = 2;
} else {
type = 3;
}
}
MyTreeNode mTN = new MyTreeNode(type, id, selectedTerme.getIdTheso(), selectedTerme.getIdlangue(), selectedTerme.getIdDomaine(), selectedTerme.getTypeDomaine(), idTC, null, null, null);
selectedTerme.majTerme(mTN);
selectedNode = mTN;
reExpand();
vue.setOnglet(0);
}
use of org.primefaces.model.TreeNode in project opentheso by miledrousset.
the class NewTreeBean method reExpandNodes.
private void reExpandNodes(TreeNode tn, ArrayList<String> ids, String id) {
for (TreeNode child : tn.getChildren()) {
if (child == null || ((MyTreeNode) child).getIdConcept() == null)
continue;
if (ids.contains(((MyTreeNode) child).getIdConcept())) {
child.setExpanded(true);
this.onNodeExpand(child);
reExpandNodes(child, ids, id);
}
if ((((MyTreeNode) child).getIdConcept()).equals(id)) {
selectedNode = child;
selectedNode.setSelected(true);
}
}
}
Aggregations