Search in sources :

Example 1 with StructIdBroaderTerm

use of mom.trd.opentheso.dragdrop.StructIdBroaderTerm in project opentheso by miledrousset.

the class NewTreeBean method confirmDrop.

/**
 * confrimDrop Fonction qui est appelée depuis le dialogue de confirmation
 * du drag drop de la page JSF , permet de préparer le traitement des
 * paramètres et appelle ensuite la fonction qui correspond à l'évenement
 * produit dans le tree
 */
public void confirmDrop() {
    if ((droppedNode.isIsSubGroup() || droppedNode.isIsGroup()) && (!draggedNode.isIsSubGroup())) {
        for (StructIdBroaderTerm elem : this.idsBT) {
            this.idsBTRemoveNode.add(elem.getIdBroaderTerm());
        }
    } else {
        this.idsBTRemoveNode.add(parentId);
    }
    callTreeHandle();
    callreExpande();
    idsBT = new ArrayList<>();
    idsBTRemoveNode = new ArrayList<>();
}
Also used : StructIdBroaderTerm(mom.trd.opentheso.dragdrop.StructIdBroaderTerm)

Example 2 with StructIdBroaderTerm

use of mom.trd.opentheso.dragdrop.StructIdBroaderTerm in project opentheso by miledrousset.

the class NewTreeBean method executeDragDrop.

private void executeDragDrop(MyTreeNode dragNode, MyTreeNode dropNode) {
    // 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(dropNode.getType())) {
        treeChange.changeLeafToDirectory(dragNode, dropNode);
    }
    if (!"fichier".equals(dropNode.getType()) && !"dossier".equals(dropNode.getType())) {
        treeChange.changeToGroupChild(dragNode, dropNode);
    }
    treeChange.saveExpandedNodes(root);
}
Also used : TreeChange(mom.trd.opentheso.dragdrop.TreeChange) ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) ArrayList(java.util.ArrayList) StructIdBroaderTerm(mom.trd.opentheso.dragdrop.StructIdBroaderTerm) RelationsHelper(mom.trd.opentheso.bdd.helper.RelationsHelper) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper)

Example 3 with StructIdBroaderTerm

use of mom.trd.opentheso.dragdrop.StructIdBroaderTerm in project opentheso by miledrousset.

the class NewTreeBean method confirmDrop.

/**
 * confrimDrop Fonction qui est appelée depuis le dialogue de confirmation
 * du drag drop de la page JSF , permet de préparer le traitement des
 * paramètres et appelle ensuite la fonction qui correspond à l'évenement
 * produit dans le tree
 *
 * @param copyAndPaste
 */
public void confirmDrop(CopyAndPaste copyAndPaste) {
    if ((droppedNode.isIsSubGroup() || droppedNode.isIsGroup()) && (!draggedNode.isIsSubGroup())) {
        for (StructIdBroaderTerm elem : this.idsBT) {
            this.idsBTRemoveNode.add(elem.getIdBroaderTerm());
        }
    } else {
        this.idsBTRemoveNode.add(parentId);
    }
    callTreeHandle();
    callreExpande();
    idsBT = new ArrayList<>();
    idsBTRemoveNode = new ArrayList<>();
    copyAndPaste.initInfo();
}
Also used : StructIdBroaderTerm(mom.trd.opentheso.dragdrop.StructIdBroaderTerm)

Aggregations

StructIdBroaderTerm (mom.trd.opentheso.dragdrop.StructIdBroaderTerm)3 ArrayList (java.util.ArrayList)1 ConceptHelper (mom.trd.opentheso.bdd.helper.ConceptHelper)1 GroupHelper (mom.trd.opentheso.bdd.helper.GroupHelper)1 RelationsHelper (mom.trd.opentheso.bdd.helper.RelationsHelper)1 TreeChange (mom.trd.opentheso.dragdrop.TreeChange)1