Subversion Repositories eFlore/Applications.coel

Compare Revisions

Ignore whitespace Rev 1471 → Rev 1472

/branches/v1.1-aramon/src/org/tela_botanica/client/vues/structure/StructureForm.java
3,6 → 3,7
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
 
import org.tela_botanica.client.ComposantClass;
792,14 → 793,7
}
String dateFondation = identification.getAnneeOuDateFondation();
if (!dateFondation.equals("")) {
if (dateFondation.endsWith("00-00")) {
dateFondationChp.setValue(dateFondation.substring(0, 4));
} else {
Date date = DateTimeFormat.getFormat("yyyy-MM-dd").parse(dateFondation);
dateFondationChp.setValue(DateTimeFormat.getFormat("dd/MM/yyyy").format(date));
}
}
dateFondationChp.setValue(dateFondation);
descriptionChp.setValue(identification.getDescription());
conditionAccesChp.setValue(identification.getConditionAcces());
2034,7 → 2028,7
public void rafraichir(Object nouvellesDonnees) {
Debug.log("nouvellesDonnees="+nouvellesDonnees.getClass().toString());
try {
if (nouvellesDonnees instanceof Information) {
Information info = (Information) nouvellesDonnees;
2053,15 → 2047,21
}
public void rafraichirInformation(Information info) {
Debug.log("rafraichirInformation");
if (info.getMessages() != null && !info.getMessages().toString().equals("[]")) {
GWT.log("MESSAGES:\n"+info.getMessages().toString(), null);
}
 
Debug.log("ici");
if (info.getType().equals("modif_structure")) {
InfoLogger.display("Modification d'une institution", info.toString());
} else if (info.getType().equals("ajout_structure")) {
Debug.log("1");
if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String) {
Debug.log("2");
String structureId = (String) info.getDonnee(0);
InfoLogger.display("Ajout d'une Institution", "L'intitution '"+structureId+"' a bien été ajoutée");
2081,30 → 2081,46
testerLancementRafraichirPersonnel();
} else if (info.getType().equals("selection_structure")) {
InfoLogger.display("Modification d'une institution", info.toString());
Debug.log("3");
String titre = i18nC.titreModifFormStructurePanneau();
if (info.getDonnee(0) != null) {
identification = (Structure) info.getDonnee(0);
if (onglets.getSelectedItem().equals(identificationOnglet)) {
peuplerStructureIdentification();
Debug.log("3.2");
Debug.log("info.getDonnee(0)="+info.getDonnee(0).toString());
try {
identification = (Structure) info.getDonnee(0);
if (onglets.getSelectedItem().equals(identificationOnglet)) {
Debug.log("3.3");
peuplerStructureIdentification();
}
} catch(Exception e) {
GWT.log("Problème de cast. "+info.getDonnee(0)+" ne peut être casté en Structure", e);
}
// Composition du titre
titre += " - ID : "+identification.getId();
}
if (info.getDonnee(1) != null) {
Debug.log("4");
conservation = (StructureConservation) info.getDonnee(1);
if (onglets.getSelectedItem().equals(conservationOnglet)) {
peuplerStructureConservation();
Debug.log("4.1");
}
}
if (info.getDonnee(2) != null) {
Debug.log("5");
valorisation = (StructureValorisation) info.getDonnee(2);
if (valorisation != null) {
if (onglets.getSelectedItem().equals(valorisationOnglet)) {
peuplerStructureValorisation();
Debug.log("5.1");
}
}
}
} else if (info.getType().equals("liste_structure_a_personne")) {
Debug.log("6");
if (info.getDonnee(0) != null) {
personnel = (StructureAPersonneListe) info.getDonnee(0);
2270,4 → 2286,5
private void initialiserGrillePersonnelEnModification() {
mediateur.selectionnerStructureAPersonne(this, identification.getId(), StructureAPersonne.ROLE_EQUIPE, null);
}
}
/branches/v1.1-aramon/src/org/tela_botanica/client/modeles/structure/Structure.java
214,6 → 214,7
return fondationDate;
}
/*
public String getAnneeOuDateFondation() {
String valeurDateFondation = get("date_fondation");
if (!UtilString.isEmpty(valeurDateFondation) && valeurDateFondation.endsWith("00-00")) {
222,8 → 223,55
valeurDateFondation = "";
}
return valeurDateFondation;
}*/
public String getAnneeOuDateFondation() {
String valeurDateFondation = get("date_fondation");
return getDateSouple(valeurDateFondation);
}
public String getDateSouple(String date) {
String valeurDate = date;
String jour = "";
String mois = "";
String annee = "";
 
// pas de date dans la BD
if (UtilString.isEmpty(valeurDate) || valeurDate.equals("0000-00-00")) {
valeurDate = "";
// YYYY
} else if (valeurDate.endsWith("00-00")) {
valeurDate = valeurDate.substring(0, 4);
if (valeurDate.matches("\\d{4}")) {
jour = "";
mois = "";
annee = valeurDate.substring(0,4);
valeurDate = annee;
}
// YYYY-MM
} else if (valeurDate.endsWith("-00")) {
valeurDate = valeurDate.substring(0, 7);
if (valeurDate.matches("\\d{4}-\\d{2}")) {
jour = "";
mois = valeurDate.substring(5,7);
annee = valeurDate.substring(0,4);
valeurDate = mois+"/"+annee;
}
}
// YYYY-MM-DD
else if (valeurDate.matches("\\d{4}-\\d{2}-\\d{2}")) {
Date objetDate = DateTimeFormat.getFormat("yyyy-MM-dd").parse(valeurDate);
DateTimeFormat fmt = DateTimeFormat.getFormat("dd/MM/yyyy");
valeurDate = fmt.format(objetDate);
}
return valeurDate;
}
public void setDateFondation(Date dateFondation) {
if (dateFondation != null) {
this.set("date_fondation", DateTimeFormat.getFormat("yyyy-MM-dd").format(dateFondation));