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);
}
}
}
}
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()));
}
}
}
}
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);
}
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;
}
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);
}
}
Aggregations