Search in sources :

Example 11 with TreeNode

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);
    }
}
Also used : TreeChange(mom.trd.opentheso.dragdrop.TreeChange) ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) MyTreeNode(mom.trd.opentheso.bdd.helper.nodes.MyTreeNode) TreeNode(org.primefaces.model.TreeNode) DefaultTreeNode(org.primefaces.model.DefaultTreeNode) ArrayList(java.util.ArrayList) MyTreeNode(mom.trd.opentheso.bdd.helper.nodes.MyTreeNode)

Example 12 with TreeNode

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);
}
Also used : ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) MyTreeNode(mom.trd.opentheso.bdd.helper.nodes.MyTreeNode) TreeNode(org.primefaces.model.TreeNode) DefaultTreeNode(org.primefaces.model.DefaultTreeNode) MyTreeNode(mom.trd.opentheso.bdd.helper.nodes.MyTreeNode)

Example 13 with TreeNode

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);
        }
    }
}
Also used : MyTreeNode(mom.trd.opentheso.bdd.helper.nodes.MyTreeNode) TreeNode(org.primefaces.model.TreeNode) DefaultTreeNode(org.primefaces.model.DefaultTreeNode) MyTreeNode(mom.trd.opentheso.bdd.helper.nodes.MyTreeNode)

Aggregations

MyTreeNode (mom.trd.opentheso.bdd.helper.nodes.MyTreeNode)13 DefaultTreeNode (org.primefaces.model.DefaultTreeNode)13 TreeNode (org.primefaces.model.TreeNode)13 ArrayList (java.util.ArrayList)5 ConceptHelper (mom.trd.opentheso.bdd.helper.ConceptHelper)5 GroupHelper (mom.trd.opentheso.bdd.helper.GroupHelper)5 NodeConceptTree (mom.trd.opentheso.bdd.helper.nodes.concept.NodeConceptTree)3 FacetHelper (mom.trd.opentheso.bdd.helper.FacetHelper)2 NodeGroup (mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup)2 Concept (mom.trd.opentheso.bdd.datas.Concept)1 Term (mom.trd.opentheso.bdd.datas.Term)1 OrphanHelper (mom.trd.opentheso.bdd.helper.OrphanHelper)1 TermHelper (mom.trd.opentheso.bdd.helper.TermHelper)1 StructIdBroaderTerm (mom.trd.opentheso.dragdrop.StructIdBroaderTerm)1 TreeChange (mom.trd.opentheso.dragdrop.TreeChange)1