136,7 → 136,7 |
// on crée une racine pour l'arbre |
TreeNode root = new TreeNode("Dates"); |
root.setId("racine_date"); |
String[] usObject = { "Dates" }; |
String[] usObject = { "Dates", "Dates", "racine_date" }; |
root.setUserObject(usObject); |
|
arbreDonneesDates.setRootNode(root); |
256,8 → 256,6 |
boolean repandreRaffraichissement) { |
|
if (nouvelleDonnees instanceof ListeDateObservation) { |
|
GWT.log("AH ah ah ah ah je suis un canard",null); |
|
String annee=null; |
String mois=null; |
269,9 → 267,10 |
TreeNode root = new TreeNode(); |
root.setId("racine_date"); |
root.setText("Dates"); |
String[] usObjRoot = { "Dates", "Dates"}; |
String[] usObjRoot = { "Dates", "Dates", "racine_date"}; |
root.setUserObject(usObjRoot); |
donneesDates.setRootNode(root); |
Tree nouvelArbre = new Tree(); |
nouvelArbre.setRootNode(root); |
|
// on la parse et on récupère les informations qui nous interessent |
for (Iterator<String> it= data.keySet().iterator(); it.hasNext();) { |
291,16 → 290,16 |
jour="Inconnue" ; |
} |
|
Node noeudMemeAnnee = donneesDates.getNodeById(""+annee); |
Node noeudMemeAnnee = nouvelArbre.getNodeById(""+annee); |
// si la région existe déjà |
if(noeudMemeAnnee != null) |
{ |
// on teste si la localité existe |
Node noeudMemeMois = donneesDates.getNodeById(""+(annee+mois)); |
Node noeudMemeMois = nouvelArbre.getNodeById(""+(annee+mois)); |
if(noeudMemeMois != null) |
{ |
// enfin on teste si le lieu dit existe |
Node noeudMemeJour = donneesDates.getNodeById(""+(annee+mois+jour)); |
Node noeudMemeJour = nouvelArbre.getNodeById(""+(annee+mois+jour)); |
if(noeudMemeJour != null) |
{ |
// tous les noeuds existent déjà, normalement ça ne devrait pas arriver |
312,7 → 311,7 |
node_jour.setId(""+(annee+mois+jour)); |
node_jour.setText(jour); |
noeudMemeMois.appendChild(node_jour) ; |
String[] usObj = {jour,jour}; |
String[] usObj = {jour,jour,annee+mois+jour}; |
node_jour.setUserObject(usObj); |
} |
} |
322,7 → 321,7 |
node_mois.setId(""+(annee+mois)); |
node_mois.setText(moisLettre); |
noeudMemeAnnee.appendChild(node_mois) ; |
String[] usObj = {moisLettre,mois}; |
String[] usObj = {moisLettre,mois,annee+mois}; |
node_mois.setUserObject(usObj); |
|
TreeNode node_jour = new TreeNode(); |
329,7 → 328,7 |
node_jour.setId(""+(annee+mois+jour)); |
node_jour.setText(jour); |
node_mois.appendChild(node_jour) ; |
String[] usObj2 = {jour,jour}; |
String[] usObj2 = {jour,jour,annee+mois+jour}; |
node_jour.setUserObject(usObj2); |
|
} |
340,7 → 339,7 |
node_annee.setId(""+annee); |
node_annee.setText(annee); |
root.appendChild(node_annee) ; |
String[] usObj = {annee, annee}; |
String[] usObj = {annee, annee, annee}; |
node_annee.setUserObject(usObj); |
|
TreeNode node_mois = new TreeNode(); |
347,7 → 346,7 |
node_mois.setId(""+(annee+mois)); |
node_mois.setText(moisLettre); |
node_annee.appendChild(node_mois) ; |
String[] usObj2 = {moisLettre,mois}; |
String[] usObj2 = {moisLettre,mois,annee+mois}; |
node_mois.setUserObject(usObj2); |
|
TreeNode node_jour = new TreeNode(); |
354,12 → 353,16 |
node_jour.setId(""+(annee+mois+jour)); |
node_jour.setText(jour); |
node_mois.appendChild(node_jour) ; |
String[] usObj3 = {jour,jour}; |
String[] usObj3 = {jour,jour,annee+mois+jour}; |
node_jour.setUserObject(usObj3); |
} |
|
} |
|
|
// on trie |
root.sort(comparerNoeuds()) ; |
|
// on vide tous les noeuds |
arbreDonneesDates.getRootNode().eachChild(new NodeTraversalCallback() { |
|
372,11 → 375,8 |
}); |
|
// et on recopie le nouvel arbre |
copierFilsNoeud(donneesDates.getRootNode(), arbreDonneesDates |
copierFilsNoeud(nouvelArbre.getRootNode(), arbreDonneesDates |
.getRootNode()); |
|
// on trie |
root.sort(comparerNoeuds()) ; |
|
// si l'arbre n'était pas encore considéré comme instancié |
if (!estInstancie) { |
420,16 → 420,16 |
jour="Inconnue" ; |
} |
|
Node noeudMemeAnnee = donneesDates.getNodeById(""+annee); |
Node noeudMemeAnnee = arbreDonneesDates.getNodeById(""+annee); |
// si la région existe déjà |
if(noeudMemeAnnee != null) |
{ |
// on teste si la localité existe |
Node noeudMemeMois = donneesDates.getNodeById(""+(annee+mois)); |
Node noeudMemeMois = arbreDonneesDates.getNodeById(""+(annee+mois)); |
if(noeudMemeMois != null) |
{ |
// enfin on teste si le lieu dit existe |
Node noeudMemeJour = donneesDates.getNodeById(""+(annee+mois+jour)); |
Node noeudMemeJour = arbreDonneesDates.getNodeById(""+(annee+mois+jour)); |
if(noeudMemeJour != null) |
{ |
// tous les noeuds existent déjà, normalement ça ne devrait pas arriver |
440,7 → 440,7 |
TreeNode node_jour = new TreeNode(); |
node_jour.setId(""+(annee+mois+jour)); |
node_jour.setText(jour); |
String[] usObj = {jour,jour}; |
String[] usObj = {jour,jour,annee+mois+jour}; |
node_jour.setUserObject(usObj); |
noeudMemeMois.appendChild(node_jour) ; |
|
452,16 → 452,14 |
TreeNode node_mois = new TreeNode(); |
node_mois.setId(""+(annee+mois)); |
node_mois.setText(moisLettre); |
String[] usObj = {moisLettre,mois}; |
String[] usObj = {moisLettre,mois,annee+mois}; |
node_mois.setUserObject(usObj); |
noeudMemeAnnee.appendChild(node_mois) ; |
|
Window.alert("on crée on nouveau mois "+node_mois.getId()) ; |
|
TreeNode node_jour = new TreeNode(); |
node_jour.setId(""+(annee+mois+jour)); |
node_jour.setText(jour); |
String[] usObj2 = {jour,jour}; |
String[] usObj2 = {jour,jour,annee+mois+jour}; |
node_jour.setUserObject(usObj2); |
node_mois.appendChild(node_jour) ; |
|
474,7 → 472,7 |
TreeNode node_annee = new TreeNode(); |
node_annee.setId(""+annee); |
node_annee.setText(annee); |
String[] usObj = {annee,annee}; |
String[] usObj = {annee,annee,annee}; |
node_annee.setUserObject(usObj); |
root.appendChild(node_annee) ; |
|
481,7 → 479,7 |
TreeNode node_mois = new TreeNode(); |
node_mois.setId(""+(annee+mois)); |
node_mois.setText(moisLettre); |
String[] usObj2 = {moisLettre,mois}; |
String[] usObj2 = {moisLettre,mois,annee+mois}; |
node_mois.setUserObject(usObj2); |
node_annee.appendChild(node_mois) ; |
|
488,7 → 486,7 |
TreeNode node_jour = new TreeNode(); |
node_jour.setId(""+(annee+mois+jour)); |
node_jour.setText(jour); |
String[] usObj3 = {jour,jour}; |
String[] usObj3 = {jour,jour,annee+mois+jour}; |
node_jour.setUserObject(usObj3); |
node_mois.appendChild(node_jour) ; |
|
550,6 → 548,7 |
String[] usObj = (String[]) ndNodeFils[i].getUserObject(); |
TreeNode child = new TreeNode(usObj[0]); |
child.setUserObject(usObj); |
child.setId(""+usObj[2]); |
ndPereCopie.appendChild(child); |
|
if (!ndNodeFils[i].isLeaf()) { |
632,7 → 631,7 |
|
TreeNode root = new TreeNode("Dates"); |
root.setId("racine_date"); |
String[] usObject = { "Dates" }; |
String[] usObject = { "Dates", "Dates", "racine_date" }; |
root.setUserObject(usObject); |
|
arbreDonneesDates.setRootNode(root); |
654,4 → 653,4 |
} |
|
|
} |
} |