Search in sources :

Example 16 with MyTreeNode

use of mom.trd.opentheso.bdd.helper.nodes.MyTreeNode in project opentheso by miledrousset.

the class NewTreeBean method changeGroupType.

public void changeGroupType(String type) {
    MyTreeNode myTN = (MyTreeNode) this.selectedNode;
    if (!myTN.isIsGroup() && !myTN.isIsSubGroup()) {
        // normalement impossible
        return;
    }
    if (myTN.getTypeDomaine().equals(type)) {
        return;
    } else {
        myTN.setTypeDomaine(type);
        GroupHelper gh = new GroupHelper();
        gh.updateTypeGroup(this.connect.getPoolConnexion(), type, idThesoSelected, myTN.getIdConcept());
        ConceptHelper ch = new ConceptHelper();
        this.onNodeExpand(myTN);
        for (TreeNode sbn : myTN.getChildren()) {
            if (((MyTreeNode) sbn).isIsSubGroup())
                changeGroupType(type, sbn);
        }
    }
    reInit();
    this.initTree(idThesoSelected, myTN.getLangue());
    reExpand();
}
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) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper)

Example 17 with MyTreeNode

use of mom.trd.opentheso.bdd.helper.nodes.MyTreeNode in project opentheso by miledrousset.

the class NewTreeBean method editNomT.

/**
 * Change le nom du terme courant avec mise à jour dans l'arbre Choix du
 * type de d'objet sélectionné (Group, sousGroup, Concept)
 */
public void editNomT() {
    duplicate = false;
    if (selectedTerme == null) {
        return;
    }
    // si c'est la même valeur, on fait rien
    if (selectedTerme.getNom().trim().equals(selectedTerme.getNomEdit())) {
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("tree.error2")));
        selectedTerme.setNomEdit(selectedTerme.getNom());
        return;
    }
    // saisie d'une valeur vide
    if (selectedTerme.getNomEdit().trim().equals("")) {
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("tree.error1")));
        selectedTerme.setNomEdit(selectedTerme.getNom());
        return;
    }
    // si le terme existe, il faut proposer le choix de valider ou non !!
    if (!forced) {
        // ici l'utilisateur a accepté de valider un doublon, donc on ne controle plus le terme
        if (new TermHelper().isTermExistForEdit(connect.getPoolConnexion(), selectedTerme.getNomEdit().trim(), idThesoSelected, selectedTerme.getIdT(), selectedTerme.getIdlangue())) {
            // traitement des doublons
            duplicate = true;
            editPassed = true;
            return;
        }
    }
    if (selectedTerme.getIdT() != null && !selectedTerme.getIdT().equals("")) {
        selectedTerme.editTerme(1);
    } else {
        // le terme n'existe pas encore
        if (!selectedTerme.editTerme(2)) {
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("error")));
            selectedTerme.setNomEdit(selectedTerme.getNom());
            return;
        }
    }
    if (selectedNode != null) {
        // ((MyTreeNode) selectedNode).setData(temp + " (Id_" + selectedTerme.getIdC() + ")");
        ((MyTreeNode) selectedNode).setData(selectedTerme.getNom());
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", selectedTerme.getNom() + " " + langueBean.getMsg("tree.info2")));
        selectedTerme.setNomEdit(selectedTerme.getNom());
    }
    selectedTerme.setSelectedTermComp(new NodeAutoCompletion());
    forced = false;
    duplicate = false;
    editPassed = true;
}
Also used : MyTreeNode(mom.trd.opentheso.bdd.helper.nodes.MyTreeNode) FacesMessage(javax.faces.application.FacesMessage) NodeAutoCompletion(mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion) TermHelper(mom.trd.opentheso.bdd.helper.TermHelper)

Example 18 with MyTreeNode

use of mom.trd.opentheso.bdd.helper.nodes.MyTreeNode in project opentheso by miledrousset.

the class UnderTree method onNodeSelect.

/**
 * Affiche les informations du terme correspondant au noeud selectionné dans l'arbre
 * @param event le noeud selectionné
 */
public void onNodeSelect(NodeSelectEvent event) {
    if (!event.getTreeNode().getType().equals("facette")) {
        MyTreeNode temp = (MyTreeNode) selectedNode;
        temp.setTypeConcept(3);
        selectedTerme.majTerme(temp);
        selectedTerme.setTree(3);
    } else {
        selectedTerme.reInitTerme();
    }
}
Also used : MyTreeNode(mom.trd.opentheso.bdd.helper.nodes.MyTreeNode)

Example 19 with MyTreeNode

use of mom.trd.opentheso.bdd.helper.nodes.MyTreeNode in project opentheso by miledrousset.

the class NewTreeBean method onDragDrop.

/**
 * *******************fonctions drag drop #JM*****************************
 */
/**
 * ***********************************************************************
 */
/**
 * Fonction pour récupérer l'éveneme drag drop de l'arbre
 *
 * @param event
 */
public void onDragDrop(TreeDragDropEvent event) {
    MyTreeNode dragNode = (MyTreeNode) event.getDragNode();
    MyTreeNode dropNode = (MyTreeNode) event.getDropNode();
    idsBT = new ArrayList<>();
    idsBTRemoveNode = new ArrayList<>();
    TreeChange treeChange = new TreeChange();
    // int dropIndex = event.getDropIndex();
    this.draggedNode = dragNode;
    this.parentId = dragNode.getIdParent();
    this.droppedNode = dropNode;
    ArrayList<String> idsbt = null;
    RelationsHelper relationsHelper = new RelationsHelper();
    ConceptHelper conceptHelper = new ConceptHelper();
    GroupHelper groupHelper = new GroupHelper();
    if (dragNode.isIsTopConcept()) {
        idsbt = dragNode.getOtherGroup();
    } else {
        idsbt = relationsHelper.getListIdOfBT(connect.getPoolConnexion(), dragNode.getIdConcept(), idThesoSelected);
    }
    ArrayList<StructIdBroaderTerm> sibt = new ArrayList<>();
    for (String id : idsbt) {
        StructIdBroaderTerm elem = new StructIdBroaderTerm();
        String idLang = (selectedTerme.getIdlangue().isEmpty()) ? defaultLanguage : selectedTerme.getIdlangue();
        String idGroup = conceptHelper.getGroupIdOfConcept(connect.getPoolConnexion(), id, idThesoSelected);
        String lexicalValue = conceptHelper.getLexicalValueOfConcept(connect.getPoolConnexion(), id, idThesoSelected, idLang);
        String lexicalValueGroup = groupHelper.getLexicalValueOfGroup(connect.getPoolConnexion(), idGroup, idThesoSelected, idLang);
        elem.setIdBroaderTerm(id);
        elem.setIdGroupBroaderTerm(idGroup);
        elem.setLexicalValueTerm(lexicalValue);
        elem.setLexicalValueGroup(lexicalValueGroup);
        sibt.add(elem);
    }
    idsBT.addAll(sibt);
    if ("fichier".equals(event.getDropNode().getType())) {
        treeChange.changeLeafToDirectory(event.getDragNode(), event.getDropNode());
    }
    if (!"fichier".equals(event.getDropNode().getType()) && !"dossier".equals(event.getDropNode().getType())) {
        treeChange.changeToGroupChild(event.getDragNode(), event.getDropNode());
    }
    treeChange.saveExpandedNodes(root);
}
Also used : TreeChange(mom.trd.opentheso.dragdrop.TreeChange) ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) ArrayList(java.util.ArrayList) MyTreeNode(mom.trd.opentheso.bdd.helper.nodes.MyTreeNode) StructIdBroaderTerm(mom.trd.opentheso.dragdrop.StructIdBroaderTerm) RelationsHelper(mom.trd.opentheso.bdd.helper.RelationsHelper) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper)

Example 20 with MyTreeNode

use of mom.trd.opentheso.bdd.helper.nodes.MyTreeNode in project opentheso by miledrousset.

the class NewTreeBean method changeGroupType.

public void changeGroupType(String type, TreeNode sbn) {
    ((MyTreeNode) sbn).setTypeDomaine(type);
    GroupHelper gh = new GroupHelper();
    gh.updateTypeGroup(this.connect.getPoolConnexion(), type, idThesoSelected, ((MyTreeNode) sbn).getIdConcept());
    this.onNodeExpand(sbn);
    for (TreeNode sn : sbn.getChildren()) {
        if (((MyTreeNode) sn).isIsSubGroup())
            changeGroupType(type, sn);
    }
}
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) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper)

Aggregations

MyTreeNode (mom.trd.opentheso.bdd.helper.nodes.MyTreeNode)25 DefaultTreeNode (org.primefaces.model.DefaultTreeNode)12 TreeNode (org.primefaces.model.TreeNode)11 ArrayList (java.util.ArrayList)9 ConceptHelper (mom.trd.opentheso.bdd.helper.ConceptHelper)9 GroupHelper (mom.trd.opentheso.bdd.helper.GroupHelper)9 NodeConceptTree (mom.trd.opentheso.bdd.helper.nodes.concept.NodeConceptTree)6 FacetHelper (mom.trd.opentheso.bdd.helper.FacetHelper)4 TermHelper (mom.trd.opentheso.bdd.helper.TermHelper)4 PrefixString (com.k_int.IR.QueryModels.PrefixString)3 FacesMessage (javax.faces.application.FacesMessage)3 Concept (mom.trd.opentheso.bdd.datas.Concept)2 ThesaurusHelper (mom.trd.opentheso.bdd.helper.ThesaurusHelper)2 NodeAutoCompletion (mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion)2 NodeFacet (mom.trd.opentheso.bdd.helper.nodes.NodeFacet)2 NodeGroup (mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup)2 StructIdBroaderTerm (mom.trd.opentheso.dragdrop.StructIdBroaderTerm)2 TreeChange (mom.trd.opentheso.dragdrop.TreeChange)2 Languages_iso639 (mom.trd.opentheso.bdd.datas.Languages_iso639)1 Term (mom.trd.opentheso.bdd.datas.Term)1