Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 2621 → Rev 2622

/trunk/src/org/tela_botanica/client/vues/observation/filtres/ArbreEntiteGeographiqueObservationFiltreVue.java
3,6 → 3,7
import java.util.Comparator;
import java.util.Iterator;
 
import org.tela_botanica.client.i18n.Msg;
import org.tela_botanica.client.interfaces.Filtrable;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.objets.EntiteGeographiqueObservation;
81,7 → 82,7
public ArbreEntiteGeographiqueObservationFiltreVue(ObservationMediateur obs) {
 
// on crée le panel
super("Localités");
super(Msg.get("localites"));
this.observationMediateur = obs;
 
116,9 → 117,9
arbreEntitesGeographiques.setId("x-view-tree-filter-entity");
 
// on crée une racine pour l'arbre
TreeNode root = new TreeNode("Localités");
TreeNode root = new TreeNode(Msg.get("localites"));
root.setId("racine_entite");
String[] usObject = { "Localités" };
String[] usObject = { Msg.get("localites") };
root.setUserObject(usObject);
 
arbreEntitesGeographiques.setRootNode(root);
245,8 → 246,8
Tree nouvelArbre = new Tree() ;
TreeNode root = new TreeNode();
root.setId("racine_entite");
root.setText("Localités");
String[] usObjRoot = { "Localités"};
root.setText(Msg.get("localites"));
String[] usObjRoot = { Msg.get("localites") };
root.setUserObject(usObjRoot);
nouvelArbre.setRootNode(root);
285,7 → 286,7
arbreEntitesGeographiques.doLayout();
 
}
 
if(nouvelleDonnees instanceof Observation)
{
// Cas d'ajout unitaire d'une observation
296,14 → 297,14
if(!arbreCharge) {
return;
}
 
Observation obs = (Observation)nouvelleDonnees ;
EntiteGeographiqueObservation ent = new EntiteGeographiqueObservation(obs.getIdentifiantLocalite(),obs.getLocalite(),obs.getLieudit(),obs.getStation());
ent.setPays(obs.getPays());
 
creerHierarchieNoeud(arbreEntitesGeographiques.getTree(), arbreEntitesGeographiques.getRootNode(), ent);
doLayout();
 
doLayout();
arbreEntitesGeographiques.doLayout() ;
}
}
324,7 → 325,7
@Override
public String renvoyerNomFiltre() {
 
return "Localités";
return Msg.get("localites");
}
 
/**
387,7 → 388,7
}
}
 
public Comparator<TreeNode> comparerNoeuds()
{
return new Comparator<TreeNode>() {
447,9 → 448,9
arbreEntitesGeographiques.clear() ;
// on crée une racine pour l'arbre
TreeNode root = new TreeNode("Localités");
TreeNode root = new TreeNode(Msg.get("localites"));
root.setId("racine_entite");
String[] usObject = { "Localités" };
String[] usObject = { Msg.get("localites") };
root.setUserObject(usObject);
 
arbreEntitesGeographiques.setRootNode(root);
537,25 → 538,25
Node noeudMemeId = null;
String idNoeud = "";
String locNiveau = "";
 
Node noeudParent = root;
 
for(int i = 0; i < idLocalites.length; i++) {
// Recherche des noeuds correspondant à chacun des niveaux de la hierarchie
locNiveau = idLocalites[i];
idNoeud += idLocalites[i];
 
noeudMemeId = arbre.getNodeById(idNoeud);
 
// Si le noeud n'existe pas on le crée
if(noeudMemeId == null) {
noeudMemeId = creerNoeud(idNoeud, locNiveau);
noeudParent.appendChild(noeudMemeId) ;
}
 
noeudParent = noeudMemeId;
}
 
root.sort(comparerNoeuds()) ;
}
 
589,41 → 590,41
arbreEntitesGeographiques.getSelectionModel().select(noeudArbreEncours);
mettreAJourValeurEnCours(noeudArbreEncours);
 
continuer = false;
}
 
return continuer;
}
 
});
}
 
private int calculerProfondeurPourNomFiltre(String nom) {
 
int profondeur = 0;
 
if(nom.equals("pays")) {
profondeur = 1;
}
 
if(nom.equals("departement")) {
profondeur = 2;
}
 
if(nom.equals("localite")) {
profondeur = 3;
}
 
if(nom.equals("lieudit")) {
profondeur = 4;
}
 
if(nom.equals("station")) {
profondeur = 5;
}
 
return profondeur;
}
 
}