Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 262 → Rev 263

/trunk/src/org/tela_botanica/client/vues/observation/filtres/ArbreDateObservationFiltreVue.java
214,6 → 214,7
public void initialiser() {
arbreCharge = false ;
donneesDateEnCours = "";
arbreDonneesDates.collapseAll();
// on vide l'ancien arbre
Node[] rootChild = arbreDonneesDates.getRootNode().getChildNodes();
613,7 → 614,6
arbreCharge = false ;
arbreDonneesDates.collapseAll();
arbreDonneesDates.clear();
 
TreeNode root = new TreeNode("Dates");
root.setId("racine_date");
636,6 → 636,8
this.doLayout() ;
donneesDateEnCours = "";
}
 
 
/trunk/src/org/tela_botanica/client/vues/observation/filtres/ArbreEntiteGeographiqueObservationFiltreVue.java
11,6 → 11,7
import org.tela_botanica.client.observation.ObservationMediateur;
 
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Window;
import com.gwtext.client.data.Node;
import com.gwtext.client.data.NodeTraversalCallback;
import com.gwtext.client.data.Tree;
155,6 → 156,7
entitesGeographiquesEncours = "" ;
String nomPere = "" ;
String nomGrandPere = "" ;
String nomArriereGrandPere = "";
switch(node.getDepth())
{
168,6 → 170,12
observationMediateur.obtenirNombreObservation() ;
}
return ;
case 4: nomFiltre += "station,lieudit,location,id_location";
nomPere = ((String[])node.getParentNode().getUserObject())[0] ;
nomGrandPere = ((String[])node.getParentNode().getParentNode().getUserObject())[0] ;
nomArriereGrandPere = ((String[])node.getParentNode().getParentNode().getParentNode().getUserObject())[0] ;
entitesGeographiquesEncours += node.getText()+","+nomPere+","+nomGrandPere+","+nomArriereGrandPere ;
break;
case 3: nomFiltre += "lieudit,location,id_location";
nomPere = ((String[])node.getParentNode().getUserObject())[0] ;
nomGrandPere = ((String[])node.getParentNode().getParentNode().getUserObject())[0] ;
210,6 → 218,7
public void initialiser() {
arbreCharge = false ;
entitesGeographiquesEncours = "";
arbreEntitesGeographiques.collapseAll();
// on vide l'ancien arbre
Node[] rootChild = arbreEntitesGeographiques.getRootNode().getChildNodes();
240,10 → 249,6
if (nouvelleDonnees instanceof ListeEntiteGeographiqueObservation) {
String id_location=null;
String location=null;
String lieuDit=null;
ListeEntiteGeographiqueObservation data = (ListeEntiteGeographiqueObservation) nouvelleDonnees ;
// on crée un arbre vide
254,120 → 259,27
String[] usObjRoot = { "Localités"};
root.setUserObject(usObjRoot);
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();) {
EntiteGeographiqueObservation ent=(EntiteGeographiqueObservation) data.get(it.next());
id_location=ent.getIdLocation();
id_location = id_location.replaceAll("\"", "");
id_location = id_location.replace('\\',' ');
id_location = id_location.trim();
location=ent.getLocation();
lieuDit=ent.getLieuDit();
if(id_location.contains("000null") || id_location.equals(null) || (id_location.trim()).equals("")) {
id_location="Inconnue" ;
}
if(location.contains("000null") || location.equals(null) || (location.trim().equals(""))) {
location="Inconnue" ;
}
if(lieuDit.contains("000null") || lieuDit.equals(null) || (lieuDit.trim().equals(""))) {
lieuDit="Inconnue" ;
}
Node noeudMemeId = nouvelArbre.getNodeById(""+id_location);
// si la région existe déjà
if(noeudMemeId != null)
{
// on teste si la localité existe
Node noeudMemeLoc = nouvelArbre.getNodeById(""+(id_location+location));
if(noeudMemeLoc != null)
{
// enfin on teste si le lieu dit existe
Node noeudMemeLieu = nouvelArbre.getNodeById(""+(id_location+location+lieuDit));
if(noeudMemeLieu != null)
{
// tous les noeuds existent déjà, normalement ça ne devrait pas arriver
}
else
{
// enfin on ne crée que le noeud du lieu dit
TreeNode node_lieu = new TreeNode();
node_lieu.setId(""+(id_location+location+lieuDit));
node_lieu.setText(lieuDit);
noeudMemeLoc.appendChild(node_lieu) ;
String[] usObj = {lieuDit,id_location+location+lieuDit};
node_lieu.setUserObject(usObj);
}
}
else
{
// on crée le noeud de la location
TreeNode node_loc = new TreeNode();
node_loc.setId(""+(id_location+location));
node_loc.setText(location);
noeudMemeId.appendChild(node_loc) ;
String[] usObj = {location,id_location+location};
node_loc.setUserObject(usObj);
TreeNode node_lieu = new TreeNode();
node_lieu.setId(""+(id_location+location+lieuDit));
node_lieu.setText(lieuDit);
node_loc.appendChild(node_lieu) ;
String[] usObj2 = {lieuDit,id_location+location+lieuDit};
node_lieu.setUserObject(usObj2);
}
}
else
{
// on crée le noeud de l'identifiant location
TreeNode node_id_loc = new TreeNode();
node_id_loc.setId(""+id_location);
node_id_loc.setText(id_location);
root.appendChild(node_id_loc) ;
String[] usObj = {id_location,id_location};
node_id_loc.setUserObject(usObj);
TreeNode node_loc = new TreeNode();
node_loc.setId(""+(id_location+location));
node_loc.setText(location);
node_id_loc.appendChild(node_loc) ;
String[] usObj2 = {location,id_location+location};
node_loc.setUserObject(usObj2);
TreeNode node_lieu = new TreeNode();
node_lieu.setId(""+(id_location+location+lieuDit));
node_lieu.setText(lieuDit);
node_loc.appendChild(node_lieu) ;
String[] usObj3 = {lieuDit,id_location+location+lieuDit};
node_lieu.setUserObject(usObj3);
}
root.sort(comparerNoeuds()) ;
doLayout();
 
}
// on vide tous les noeuds
arbreEntitesGeographiques.getRootNode().eachChild(new NodeTraversalCallback() {
public boolean execute(Node node) {
node.remove();
return true;
}
});
// on la parse et on récupère les informations qui nous interessent
for (Iterator<String> it= data.keySet().iterator(); it.hasNext();) {
EntiteGeographiqueObservation ent=(EntiteGeographiqueObservation) data.get(it.next());
creerHierarchieNoeud(nouvelArbre ,root, ent);
doLayout();
}
copierFilsNoeud(root, arbreEntitesGeographiques.getRootNode());
arbreEntitesGeographiques.getRootNode().sort(comparerNoeuds()) ;
 
// si l'arbre n'était pas encore considéré comme instancié
if (!estInstancie) {
395,108 → 307,12
}
Observation obs = (Observation)nouvelleDonnees ;
EntiteGeographiqueObservation ent = new EntiteGeographiqueObservation(obs.getIdentifiantLocalite(),obs.getLocalite(),obs.getLieudit(),obs.getStation());
String id_location= obs.getIdentifiantLocalite();
id_location = id_location.replaceAll("\"", "");
id_location = id_location.replace('\\',' ');
id_location = id_location.trim();
String location=obs.getLocalite();
String lieuDit=obs.getLieudit();
Node root = arbreEntitesGeographiques.getRootNode() ;
if(id_location.contains("000null") || id_location.equals(null) || (id_location.trim()).equals("")) {
id_location="Inconnue" ;
}
if(location.contains("000null") || location.equals(null) || (location.trim().equals(""))) {
location="Inconnue" ;
}
if(lieuDit.contains("000null") || lieuDit.equals(null) || (lieuDit.trim().equals(""))) {
lieuDit="Inconnue" ;
}
Node noeudMemeId = arbreEntitesGeographiques.getNodeById(""+id_location);
// si la région existe déjà
if(noeudMemeId != null)
{
// on teste si la localité existe
Node noeudMemeLoc = arbreEntitesGeographiques.getNodeById(""+(id_location+location));
if(noeudMemeLoc != null)
{
// enfin on teste si le lieu dit existe
Node noeudMemeLieu = arbreEntitesGeographiques.getNodeById(""+(id_location+location+lieuDit));
if(noeudMemeLieu != null)
{
// tous les noeuds existent déjà, normalement ça ne devrait pas arriver
}
else
{
// enfin on ne crée que le noeud du lieu dit
TreeNode node_lieu = new TreeNode();
node_lieu.setId(""+(id_location+location+lieuDit));
node_lieu.setText(lieuDit);
String[] usObj = {lieuDit,id_location+location+lieuDit};
node_lieu.setUserObject(usObj);
noeudMemeLoc.appendChild(node_lieu) ;
root.sort(comparerNoeuds()) ;
}
}
else
{
// on crée le noeud de la location
TreeNode node_loc = new TreeNode();
node_loc.setId(""+(id_location+location));
node_loc.setText(location);
String[] usObj = {location,id_location+location};
node_loc.setUserObject(usObj);
noeudMemeId.appendChild(node_loc) ;
creerHierarchieNoeud(arbreEntitesGeographiques.getTree(), arbreEntitesGeographiques.getRootNode(), ent);
TreeNode node_lieu = new TreeNode();
node_lieu.setId(""+(id_location+location+lieuDit));
node_lieu.setText(lieuDit);
String[] usObj2 = {lieuDit,id_location+location+lieuDit};
node_lieu.setUserObject(usObj2);
node_loc.appendChild(node_lieu) ;
root.sort(comparerNoeuds()) ;
}
}
else
{
// TODO: Pourquoi l'ajout ne marche que sur la racine ?
// on crée le noeud de l'id location
TreeNode node_id_loc = new TreeNode();
node_id_loc.setId(""+id_location);
node_id_loc.setText(id_location);
String[] usObj = {id_location,id_location};
node_id_loc.setUserObject(usObj);
root.appendChild(node_id_loc) ;
TreeNode node_loc = new TreeNode();
node_loc.setId(""+(id_location+location));
node_loc.setText(location);
String[] usObj2 = {location,id_location+location};
node_loc.setUserObject(usObj2);
node_id_loc.appendChild(node_loc) ;
TreeNode node_lieu = new TreeNode();
node_lieu.setId(""+(id_location+location+lieuDit));
node_lieu.setText(lieuDit);
String[] usObj3 = {lieuDit,id_location+location+lieuDit};
node_lieu.setUserObject(usObj3);
node_loc.appendChild(node_lieu) ;
root.sort(comparerNoeuds()) ;
}
arbreEntitesGeographiques.doLayout() ;
doLayout();
arbreEntitesGeographiques.doLayout() ;
}
}
 
616,11 → 432,12
return n1.compareTo(n2) ;
}
else
{
String n1 = o1.getText() ;
String n2 = o2.getText() ;
{
String n1 = o1.getId() ;
String n2 = o2.getId() ;
return n1.compareTo(n2) ;
return n1.compareToIgnoreCase(n2);
}
}
} ;
627,7 → 444,7
}
 
public void raz() {
arbreCharge = false ;
arbreEntitesGeographiques.collapseAll();
arbreEntitesGeographiques.clear() ;
652,10 → 469,94
}) ;
arbreCharge = false ;
entitesGeographiquesEncours = "";
this.doLayout() ;
}
private TreeNode creerNoeud(String id, String texte) {
TreeNode nouveauNoeud = new TreeNode();
nouveauNoeud.setId(""+(id));
nouveauNoeud.setText(texte);
String[] usObj = {texte,id+""};
nouveauNoeud.setUserObject(usObj);
return nouveauNoeud;
}
/**
*
* @param arbre l'arbre dans lequel on recherche s'il faut créer les noeuds
* @param root le noeud racine auquel on concatène la hierarchie crée
* @param ent l'entité géographique qui doit être décomposée en arborescence
* @return
*/
private void creerHierarchieNoeud(Tree arbre, TreeNode root, EntiteGeographiqueObservation ent) {
String idLocation=null;
String location=null;
String lieuDit=null;
String station=null;
idLocation=ent.getIdLocalite();
idLocation = idLocation.replaceAll("\"", "");
idLocation = idLocation.replace('\\',' ');
idLocation = idLocation.trim();
location=ent.getCommune();
lieuDit=ent.getLieuDit();
station=ent.getStation();
if(idLocation.contains("000null") || idLocation.equals(null) || (idLocation.trim()).equals("")) {
idLocation="Inconnue" ;
}
if(location.contains("000null") || location.equals(null) || (location.trim().equals(""))) {
location="Inconnue" ;
}
if(lieuDit.contains("000null") || lieuDit.equals(null) || (lieuDit.trim().equals(""))) {
lieuDit="Inconnue" ;
}
if(station.contains("000null") || station.equals(null) || (station.trim().equals(""))) {
station="Inconnue" ;
}
Node noeudMemeId = arbre.getNodeById(""+idLocation);
if(noeudMemeId == null) {
// on crée le noeud de l'identifiant location
noeudMemeId = creerNoeud(""+idLocation,idLocation);
root.appendChild(noeudMemeId) ;
}
// on teste si la localité existe
Node noeudMemeLoc = arbre.getNodeById(""+(idLocation+location));
if(noeudMemeLoc == null)
{
// on crée le noeud de la location
noeudMemeLoc = creerNoeud(""+idLocation+location, location);
noeudMemeId.appendChild(noeudMemeLoc) ;
}
// on teste si le lieu dit existe
Node noeudMemeLieu = arbre.getNodeById(""+(idLocation+location+lieuDit));
if(noeudMemeLieu == null)
{
// on crée le noeud du lieu dit
noeudMemeLieu = creerNoeud(idLocation+location+lieuDit, lieuDit);
noeudMemeLoc.appendChild(noeudMemeLieu) ;
}
// on teste si la station existe
Node noeudMemeStation = arbre.getNodeById(""+(idLocation+location+lieuDit+station));
if(noeudMemeStation == null) {
// on crée le noeud de la station
noeudMemeStation = creerNoeud(idLocation+location+lieuDit+station,station);
noeudMemeLieu.appendChild(noeudMemeStation);
}
root.sort(comparerNoeuds()) ;
}
}
/trunk/src/org/tela_botanica/client/vues/observation/PanneauFiltresObservationVues.java
4,7 → 4,7
import org.tela_botanica.client.vues.ArbreMotsClesFiltreVue;
import org.tela_botanica.client.vues.observation.filtres.ArbreDateObservationFiltreVue;
import org.tela_botanica.client.vues.observation.filtres.ArbreEntiteGeographiqueObservationFiltreVue;
import org.tela_botanica.client.vues.observation.filtres.RechercheTaxonVue;
import org.tela_botanica.client.vues.observation.filtres.RechercheLibreVue;
 
import com.gwtext.client.widgets.Panel;
import com.gwtext.client.widgets.layout.RowLayout;
37,7 → 37,7
private ArbreMotsClesFiltreVue arbreMotsClesFiltreVue = null ;
private RechercheTaxonVue rechercheTaxonVue = null;
private RechercheLibreVue rechercheLibreVue = null;
66,10 → 66,10
//this.setLayout(new AnchorLayout()) ;
this.setLayout(new RowLayout());
rechercheTaxonVue = new RechercheTaxonVue(observationMediateur);
add(rechercheTaxonVue,new RowLayoutData(75));
rechercheTaxonVue.setWidth("100%") ;
rechercheTaxonVue.setBorder(false);
rechercheLibreVue = new RechercheLibreVue(observationMediateur);
add(rechercheLibreVue,new RowLayoutData(75));
rechercheLibreVue.setWidth("100%") ;
rechercheLibreVue.setBorder(false);
arbreEntiteGeographiqueObservationFiltreVue = new ArbreEntiteGeographiqueObservationFiltreVue(observationMediateur);
add(arbreEntiteGeographiqueObservationFiltreVue,new RowLayoutData());
112,8 → 112,8
return arbreMotsClesFiltreVue;
}
public RechercheTaxonVue getRechercheTaxonVue() {
return rechercheTaxonVue;
public RechercheLibreVue getRechercheLibreVue() {
return rechercheLibreVue;
}
/**
123,7 → 123,7
*/
public boolean renvoyerEtatFiltre() {
 
return (arbreEntiteGeographiqueObservationFiltreVue.renvoyerEtatFiltre() || arbreDateObservationFiltreVue.renvoyerEtatFiltre() || rechercheTaxonVue.renvoyerEtatFiltre());
return (arbreEntiteGeographiqueObservationFiltreVue.renvoyerEtatFiltre() || arbreDateObservationFiltreVue.renvoyerEtatFiltre() || rechercheLibreVue.renvoyerEtatFiltre());
}
 
137,7 → 137,7
String[][] filtres = { arbreEntiteGeographiqueObservationFiltreVue.renvoyerValeursAFiltrer(),
arbreDateObservationFiltreVue.renvoyerValeursAFiltrer(),
arbreMotsClesFiltreVue.renvoyerValeursAFiltrer(),
rechercheTaxonVue.renvoyerValeursAFiltrer()
rechercheLibreVue.renvoyerValeursAFiltrer()
};
return filtres;