Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 2621 → Rev 2622

/trunk/src/org/tela_botanica/client/vues/observation/filtres/ArbreMotsClesObservationVue.java
1,4 → 1,5
package org.tela_botanica.client.vues.observation.filtres;
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.observation.ObservationMediateur;
116,7 → 117,7
*/
public ArbreMotsClesObservationVue(ObservationMediateur om) {
// on crée le panel
super("Projets");
super(Msg.get("projets"));
this.setLayout(new VerticalLayout());
oMediateur = om;
155,9 → 156,9
arbreMotsCles.setSelectionModel(msModel);
 
// on crée une racine pour l'arbre
TreeNode root = new TreeNode("Projets");
TreeNode root = new TreeNode(Msg.get("projets"));
root.setId("racine_obs");
String[] usObject = { "Projets", "racine_obs" };
String[] usObject = { Msg.get("projets"), "racine_obs" };
root.setUserObject(usObject);
root.setExpandable(true);
166,7 → 167,7
// on crée l'éditeur pour l'arbre
tfEdit = new TextField();
te = new TreeEditor(arbreMotsCles, tfEdit);
ajouterMotCle = new Button("Ajouter un projet");
ajouterMotCle = new Button(Msg.get("ajouter-projet"));
arbreMotsCles.add(te);
arbreMotsCles.getRootNode().addListener(new TreeNodeListenerAdapter() {
288,13 → 289,14
if(!MotsClesUtilitaire.estUnMotCleAutorise(text)) {
te.startEdit(node);
Window.alert("Un mot clé ne peut pas être vide ou contenir les caractères suivants : "+MotsClesUtilitaire.getChaineCaracteresInterdits());
String[] params = { MotsClesUtilitaire.getChaineCaracteresInterdits() };
Window.alert(Msg.get("mot-cle-non-vide", params));
return;
}
if(!MotsClesUtilitaire.estUnePositionAutorisee(node, node.getParentNode(), text)) {
te.startEdit(node);
Window.alert("Un mot clé de même nom existe déjà à cette position");
Window.alert(Msg.get("mot-cle-existe-deja"));
return;
}
 
324,7 → 326,7
boolean ok = true;
if(!MotsClesUtilitaire.estUnePositionAutorisee(node, newParent, node.getText())) {
ok = false;
Window.alert("Un mot clé de même nom existe déjà à cette position");
Window.alert(Msg.get("mot-cle-existe-deja"));
}
return ok;
}
456,7 → 458,7
// si ça n'est pas la racine (qu'on ne peut pas supprimer)
if (!n.getId().equals(getArbreMotsCles().getRootNode().getId())) {
if(Window.confirm("Etes vous sur de vouloir supprimer ce projet ?")) {
if(Window.confirm(Msg.get("confirmer-suppression-projet"))) {
// on détache le noeud et on le détruit
n.getParentNode().removeChild(n);
n.destroy();
468,7 → 470,7
} else {
// si l'utilisateur tente de supprimer la racine, on l'avertit de
// son erreur
Window.alert("Impossible de supprimer la racine de l'arbre");
Window.alert(Msg.get("impossible-supprimer-racine"));
}
}
 
682,9 → 684,9
arbreMotsCles.clear() ;
// on crée une racine pour l'arbre
TreeNode root = new TreeNode("Projets");
TreeNode root = new TreeNode(Msg.get("projets"));
root.setId("racine_obs");
String[] usObject = { "Projets", "racine_obs" };
String[] usObject = { Msg.get("projets"), "racine_obs" };
root.setUserObject(usObject);
root.setExpandable(true);
 
752,9 → 754,9
TreeEditor te) {
Menu mn = new Menu();
final com.gwtext.client.widgets.menu.Item ajoutN = new Item(
"Ajouter un projet");
Msg.get("ajouter-projet"));
final com.gwtext.client.widgets.menu.Item suppN = new Item(
"Supprimer projet");
Msg.get("supprimer-projet"));
 
mn.addItem(ajoutN);
mn.addItem(suppN);
/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;
}
 
}
/trunk/src/org/tela_botanica/client/vues/observation/filtres/ArbreDateObservationFiltreVue.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.DateObservation;
83,7 → 84,7
public ArbreDateObservationFiltreVue(ObservationMediateur obs) {
 
// on crée le panel
super("Dates");
super(Msg.get("dates"));
this.observationMediateur = obs;
 
119,9 → 120,9
arbreDonneesDates.setBorder(false);
 
// on crée une racine pour l'arbre
TreeNode root = new TreeNode("Dates");
TreeNode root = new TreeNode(Msg.get("dates"));
root.setId("racine_date");
String[] usObject = { "Dates", "Dates", "racine_date" };
String[] usObject = { Msg.get("dates"), "Dates", "racine_date" };
root.setUserObject(usObject);
 
arbreDonneesDates.setRootNode(root);
259,8 → 260,8
// on crée un arbre vide
TreeNode root = new TreeNode();
root.setId("racine_date");
root.setText("Dates");
String[] usObjRoot = { "Dates", "Dates", "racine_date"};
root.setText(Msg.get("dates"));
String[] usObjRoot = { Msg.get("dates"), Msg.get("dates"), "racine_date"};
root.setUserObject(usObjRoot);
Tree nouvelArbre = new Tree();
nouvelArbre.setRootNode(root);
508,7 → 509,7
@Override
public String renvoyerNomFiltre() {
 
return "Dates";
return Msg.get("dates");
}
 
/**
594,9 → 595,9
arbreDonneesDates.collapseAll();
arbreDonneesDates.clear();
TreeNode root = new TreeNode("Dates");
TreeNode root = new TreeNode(Msg.get("dates"));
root.setId("racine_date");
String[] usObject = { "Dates", "Dates", "racine_date" };
String[] usObject = { Msg.get("dates"), Msg.get("dates"), "racine_date" };
root.setUserObject(usObject);
 
arbreDonneesDates.setRootNode(root);