Search in sources :

Example 1 with DefaultTreeNode

use of org.primefaces.model.DefaultTreeNode in project opentheso by miledrousset.

the class NewTreeBean method loadOrphan.

public void loadOrphan(String idTheso, String langue) {
    String typeNode, value = "";
    /*
        this.typeMot = type;
      this.idMot = id;
      this.idTheso = idT;
      this.langue = l;
      this.idDomaine = idD;
      this.typeDomaine = typeDomaine; 
      this.idTopConcept = idTC;
         */
    TreeNode dynamicTreeNode = (TreeNode) new MyTreeNode(1, null, idTheso, langue, null, null, null, "orphan", langueBean.getMsg("index.orphans"), root);
    orphans = new OrphanHelper().getListOrphanId(connect.getPoolConnexion(), idTheso);
    for (String idC : orphans) {
        if (new ConceptHelper().haveChildren(connect.getPoolConnexion(), idTheso, idC)) {
            typeNode = "dossier";
        } else {
            typeNode = "fichier";
        }
        Term term = new TermHelper().getThisTerm(connect.getPoolConnexion(), idC, idTheso, langue);
        if (term != null) {
            value = term.getLexical_value() + " (id_" + idC + ")";
            Concept temp = new ConceptHelper().getThisConcept(connect.getPoolConnexion(), idC, idTheso);
            MyTreeNode mtn = new MyTreeNode(3, idC, idTheso, langue, "Orphan", null, null, typeNode, value, dynamicTreeNode);
            if (typeNode.equals("dossier")) {
                new DefaultTreeNode("fake", mtn);
            }
        }
    }
}
Also used : OrphanHelper(mom.trd.opentheso.bdd.helper.OrphanHelper) Concept(mom.trd.opentheso.bdd.datas.Concept) 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) DefaultTreeNode(org.primefaces.model.DefaultTreeNode) MyTreeNode(mom.trd.opentheso.bdd.helper.nodes.MyTreeNode) Term(mom.trd.opentheso.bdd.datas.Term) StructIdBroaderTerm(mom.trd.opentheso.dragdrop.StructIdBroaderTerm) TermHelper(mom.trd.opentheso.bdd.helper.TermHelper)

Example 2 with DefaultTreeNode

use of org.primefaces.model.DefaultTreeNode in project dwoss by gg-net.

the class MandatorController method init.

@PostConstruct
public void init() {
    root = new DefaultTreeNode("Root", null);
    Map<PositionType, TreeNode> levelOneNodes = new HashMap<>();
    Map<PositionType, Map<TaxType, TreeNode>> levelTwoNodes = new HashMap<>();
    for (PositionType posType : PositionType.values()) {
        for (TaxType taxType : TaxType.values()) {
            Optional<Ledger> opt = mandator.loadPostLedger().get(posType, taxType);
            if (opt.isPresent()) {
                LOG.debug("Tax" + taxType + "  Pos: " + posType + "  Ledger " + opt.get());
                if (!levelOneNodes.containsKey(posType))
                    levelOneNodes.put(posType, new DefaultTreeNode(posType.toString(), root));
                if (!levelTwoNodes.containsKey(posType)) {
                    levelTwoNodes.put(posType, new EnumMap<TaxType, TreeNode>(TaxType.class));
                    levelTwoNodes.get(posType).put(taxType, new DefaultTreeNode(taxType, levelOneNodes.get(posType)));
                } else if (!levelTwoNodes.get(posType).containsKey(taxType)) {
                    levelTwoNodes.get(posType).put(taxType, new DefaultTreeNode(taxType, levelOneNodes.get(posType)));
                }
                levelTwoNodes.get(posType).get(taxType).getChildren().add(new DefaultTreeNode(opt.get()));
            }
        }
    }
}
Also used : DefaultTreeNode(org.primefaces.model.DefaultTreeNode) TreeNode(org.primefaces.model.TreeNode) DefaultTreeNode(org.primefaces.model.DefaultTreeNode) Ledger(eu.ggnet.dwoss.mandator.api.value.Ledger) PostConstruct(javax.annotation.PostConstruct)

Example 3 with DefaultTreeNode

use of org.primefaces.model.DefaultTreeNode in project opentheso by miledrousset.

the class TreeGroups method onNodeExpand.

public void onNodeExpand(NodeExpandEvent event) {
    DefaultTreeNode parent = (DefaultTreeNode) event.getTreeNode();
    if (parent.getChildCount() == 1 && parent.getChildren().get(0).getData().toString().equals("DUMMY")) {
        parent.getChildren().remove(0);
        addGroupsChild(parent);
        addConceptsChild(parent);
    }
    FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Expanded", event.getTreeNode().toString());
    FacesContext.getCurrentInstance().addMessage(null, message);
}
Also used : DefaultTreeNode(org.primefaces.model.DefaultTreeNode) FacesMessage(javax.faces.application.FacesMessage)

Example 4 with DefaultTreeNode

use of org.primefaces.model.DefaultTreeNode in project opentheso by miledrousset.

the class DataService method addNodeWithChild.

public TreeNode addNodeWithChild(String typeDocument, TreeNodeData data, TreeNode parentNode) {
    if (parentNode == null)
        return null;
    TreeNode document;
    if (typeDocument == null || typeDocument.isEmpty())
        document = new DefaultTreeNode(data, parentNode);
    else
        document = new DefaultTreeNode(typeDocument, data, parentNode);
    new DefaultTreeNode("DUMMY", document);
    return document;
}
Also used : TreeNode(org.primefaces.model.TreeNode) DefaultTreeNode(org.primefaces.model.DefaultTreeNode) DefaultTreeNode(org.primefaces.model.DefaultTreeNode)

Example 5 with DefaultTreeNode

use of org.primefaces.model.DefaultTreeNode in project opentheso by miledrousset.

the class SelectedTerme method initTree.

/**
 * Récupère les concept pour remplir la racine de l'arbre des facette
 */
public void initTree() {
    List<Integer> idFacettes = new FacetHelper().getIdFacetOfConcept(connect.getPoolConnexion(), idC, idTheso);
    ArrayList<NodeConceptTree> racineNode = new ArrayList<>();
    for (Integer i : idFacettes) {
        racineNode.add(new FacetHelper().getConceptOnFacet(connect.getPoolConnexion(), i, idTheso, idlangue));
    }
    for (NodeConceptTree n : racineNode) {
        TreeNode dynamicTreeNode;
        if (n.getTitle().trim().isEmpty()) {
            dynamicTreeNode = (TreeNode) new MyTreeNode(1, n.getIdConcept(), idTheso, idlangue, "", "", "", "dossier", n.getIdConcept(), root);
        } else {
            dynamicTreeNode = (TreeNode) new MyTreeNode(1, n.getIdConcept(), idTheso, idlangue, "", "", "", "dossier", n.getTitle(), root);
        }
        DefaultTreeNode defaultTreeNode = new DefaultTreeNode("fake", dynamicTreeNode);
        defaultTreeNode.setExpanded(true);
    }
}
Also used : NodeConceptTree(mom.trd.opentheso.bdd.helper.nodes.concept.NodeConceptTree) TreeNode(org.primefaces.model.TreeNode) DefaultTreeNode(org.primefaces.model.DefaultTreeNode) MyTreeNode(mom.trd.opentheso.bdd.helper.nodes.MyTreeNode) DefaultTreeNode(org.primefaces.model.DefaultTreeNode) ArrayList(java.util.ArrayList) FacetHelper(mom.trd.opentheso.bdd.helper.FacetHelper) MyTreeNode(mom.trd.opentheso.bdd.helper.nodes.MyTreeNode)

Aggregations

DefaultTreeNode (org.primefaces.model.DefaultTreeNode)12 TreeNode (org.primefaces.model.TreeNode)8 MyTreeNode (mom.trd.opentheso.bdd.helper.nodes.MyTreeNode)7 ArrayList (java.util.ArrayList)5 GroupHelper (mom.trd.opentheso.bdd.helper.GroupHelper)4 NodeConceptTree (mom.trd.opentheso.bdd.helper.nodes.concept.NodeConceptTree)4 ConceptHelper (mom.trd.opentheso.bdd.helper.ConceptHelper)3 FacetHelper (mom.trd.opentheso.bdd.helper.FacetHelper)2 NodeGroup (mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup)2 NodeSearch (mom.trd.opentheso.bdd.helper.nodes.search.NodeSearch)2 Ledger (eu.ggnet.dwoss.mandator.api.value.Ledger)1 PostConstruct (javax.annotation.PostConstruct)1 FacesMessage (javax.faces.application.FacesMessage)1 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