use of mom.trd.opentheso.bdd.helper.nodes.MyTreeNode 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);
}
}
use of mom.trd.opentheso.bdd.helper.nodes.MyTreeNode 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);
}
use of mom.trd.opentheso.bdd.helper.nodes.MyTreeNode 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);
}
}
}
use of mom.trd.opentheso.bdd.helper.nodes.MyTreeNode in project opentheso by miledrousset.
the class SelectedTerme method majSearch.
public void majSearch() {
if (nodeSe.isTopConcept()) {
type = 2;
} else {
type = 3;
}
MyTreeNode mtn = new MyTreeNode(type, nodeSe.getIdConcept(), nodeSe.getIdThesaurus(), nodeSe.getIdLang(), nodeSe.getIdGroup(), nodeSe.getTypeGroup(), null, null, nodeSe.getLexical_value(), null);
majTerme(mtn);
}
use of mom.trd.opentheso.bdd.helper.nodes.MyTreeNode in project opentheso by miledrousset.
the class SelectedThesaurus method preRenderView.
/**
* récupère la variable URL et affiche le terme qu'elle désigne
*/
public void preRenderView() {
// if the URL is for Concept
if (idCurl != null && idTurl != null) {
idLurl = Locale.getDefault().toString().substring(0, 2);
ArrayList<Languages_iso639> temp = new LanguageHelper().getLanguagesOfThesaurus(connect.getPoolConnexion(), idTurl);
if (temp.isEmpty()) {
idCurl = null;
idGurl = null;
idTurl = null;
return;
} else {
boolean lExist = false;
for (Languages_iso639 l : temp) {
if (l.getId_iso639_1().trim().equals(idLurl)) {
lExist = true;
}
}
if (!lExist) {
idLurl = temp.get(0).getId_iso639_1().trim();
}
}
if (new ConceptHelper().getThisConcept(connect.getPoolConnexion(), idCurl, idTurl) == null) {
idCurl = null;
idGurl = null;
idTurl = null;
return;
}
tree.getSelectedTerme().reInitTerme();
// Initialisation du thésaurus et de l'arbre
thesaurus.setId_thesaurus(idTurl);
thesaurus.setLanguage(idLurl);
tree.getSelectedTerme().reInitTerme();
tree.reInit();
tree.initTree(null, null);
ThesaurusHelper th = new ThesaurusHelper();
thesaurus = th.getThisThesaurus(connect.getPoolConnexion(), thesaurus.getId_thesaurus(), thesaurus.getLanguage());
tree.initTree(thesaurus.getId_thesaurus(), thesaurus.getLanguage());
languesTheso = new LanguageHelper().getSelectItemLanguagesOneThesaurus(connect.getPoolConnexion(), thesaurus.getId_thesaurus(), thesaurus.getLanguage());
user.initUserNodePref(idTurl);
// Initialisation du terme séléctionné et de l'arbre
int type;
Concept c = new ConceptHelper().getThisConcept(connect.getPoolConnexion(), idCurl, idTurl);
if (c.isTopConcept()) {
type = 2;
} else {
type = 3;
}
tree.getSelectedTerme().setIdTheso(idTurl);
tree.getSelectedTerme().setIdlangue(idLurl);
MyTreeNode mTN = new MyTreeNode(type, idCurl, idTurl, idLurl, c.getIdGroup(), "", null, null, null, null);
tree.getSelectedTerme().majTerme(mTN);
tree.reExpand();
idCurl = null;
idGurl = null;
idTurl = null;
idLurl = null;
return;
}
// if the URL is for Groups
if (idGurl != null && idTurl != null) {
idLurl = Locale.getDefault().toString().substring(0, 2);
ArrayList<Languages_iso639> temp = new LanguageHelper().getLanguagesOfThesaurus(connect.getPoolConnexion(), idTurl);
if (temp.isEmpty()) {
idCurl = null;
idGurl = null;
idTurl = null;
return;
} else {
boolean lExist = false;
for (Languages_iso639 l : temp) {
if (l.getId_iso639_1().trim().equals(idLurl)) {
lExist = true;
}
}
if (!lExist) {
idLurl = temp.get(0).getId_iso639_1().trim();
}
}
if (new GroupHelper().getThisConceptGroup(connect.getPoolConnexion(), idGurl, idTurl, idLurl) == null) {
idCurl = null;
idGurl = null;
idTurl = null;
return;
}
tree.getSelectedTerme().reInitTerme();
// Initialisation du thésaurus et de l'arbre
thesaurus.setId_thesaurus(idTurl);
thesaurus.setLanguage(idLurl);
tree.getSelectedTerme().reInitTerme();
tree.reInit();
tree.initTree(null, null);
ThesaurusHelper th = new ThesaurusHelper();
thesaurus = th.getThisThesaurus(connect.getPoolConnexion(), thesaurus.getId_thesaurus(), thesaurus.getLanguage());
tree.initTree(thesaurus.getId_thesaurus(), thesaurus.getLanguage());
languesTheso = new LanguageHelper().getSelectItemLanguagesOneThesaurus(connect.getPoolConnexion(), thesaurus.getId_thesaurus(), thesaurus.getLanguage());
user.initUserNodePref(idTurl);
// Initialisation du terme séléctionné et de l'arbre
int type = 1;
// NodeGroup nodeGroup = new GroupHelper().getThisConceptGroup(connect.getPoolConnexion(),idGurl, idTurl, idLurl);
/*
Concept c = new ConceptHelper().getThisConcept(connect.getPoolConnexion(), idCurl, idTurl);
if (c.isTopConcept()) {
type = 2;
} else {
type = 3;
}*/
tree.getSelectedTerme().setIdTheso(idTurl);
tree.getSelectedTerme().setIdlangue(idLurl);
MyTreeNode mTN = new MyTreeNode(type, idGurl, idTurl, idLurl, idGurl, "", null, null, null, null);
tree.getSelectedTerme().majTerme(mTN);
tree.reExpand();
idCurl = null;
idGurl = null;
idTurl = null;
idLurl = null;
return;
}
// if the URL is only for thésaurus
if (idTurl != null) {
idLurl = Locale.getDefault().toString().substring(0, 2);
ArrayList<Languages_iso639> temp = new LanguageHelper().getLanguagesOfThesaurus(connect.getPoolConnexion(), idTurl);
if (temp.isEmpty()) {
idCurl = null;
idGurl = null;
idTurl = null;
return;
} else {
boolean lExist = false;
for (Languages_iso639 l : temp) {
if (l.getId_iso639_1().trim().equals(idLurl)) {
lExist = true;
}
}
if (!lExist) {
idLurl = temp.get(0).getId_iso639_1().trim();
}
}
/* if (new GroupHelper().getThisConceptGroup(connect.getPoolConnexion(), idGurl, idTurl, idLurl) == null) {
idCurl = null;
idGurl = null;
idTurl = null;
return;
}*/
tree.getSelectedTerme().reInitTerme();
// Initialisation du thésaurus et de l'arbre
thesaurus.setId_thesaurus(idTurl);
thesaurus.setLanguage(idLurl);
tree.getSelectedTerme().reInitTerme();
tree.reInit();
tree.initTree(null, null);
ThesaurusHelper th = new ThesaurusHelper();
thesaurus = th.getThisThesaurus(connect.getPoolConnexion(), thesaurus.getId_thesaurus(), thesaurus.getLanguage());
tree.initTree(thesaurus.getId_thesaurus(), thesaurus.getLanguage());
languesTheso = new LanguageHelper().getSelectItemLanguagesOneThesaurus(connect.getPoolConnexion(), thesaurus.getId_thesaurus(), thesaurus.getLanguage());
user.initUserNodePref(idTurl);
// Initialisation du terme séléctionné et de l'arbre
// NodeGroup nodeGroup = new GroupHelper().getThisConceptGroup(connect.getPoolConnexion(),idGurl, idTurl, idLurl);
/*
Concept c = new ConceptHelper().getThisConcept(connect.getPoolConnexion(), idCurl, idTurl);
if (c.isTopConcept()) {
type = 2;
} else {
type = 3;
}*/
tree.getSelectedTerme().setIdTheso(idTurl);
tree.getSelectedTerme().setIdlangue(idLurl);
// MyTreeNode mTN = new MyTreeNode(type, idGurl, idTurl, idLurl, idGurl, "", null, null, null);
// tree.getSelectedTerme().majTerme(mTN);
// tree.reExpand();
idCurl = null;
idGurl = null;
idTurl = null;
idLurl = null;
}
}
Aggregations