7,6 → 7,7 |
import org.tela_botanica.client.ComposantClass; |
import org.tela_botanica.client.Mediateur; |
import org.tela_botanica.client.RegistreId; |
import org.tela_botanica.client.composants.InfoLogger; |
import org.tela_botanica.client.images.Images; |
import org.tela_botanica.client.interfaces.Rafraichissable; |
import org.tela_botanica.client.modeles.Information; |
24,6 → 25,7 |
import org.tela_botanica.client.modeles.structure.StructureAPersonneListe; |
import org.tela_botanica.client.modeles.structure.StructureConservation; |
import org.tela_botanica.client.modeles.structure.StructureValorisation; |
import org.tela_botanica.client.util.Debug; |
import org.tela_botanica.client.util.Pattern; |
import org.tela_botanica.client.util.UtilArray; |
import org.tela_botanica.client.util.UtilString; |
34,6 → 36,7 |
import com.extjs.gxt.ui.client.event.BaseEvent; |
import com.extjs.gxt.ui.client.event.ButtonEvent; |
import com.extjs.gxt.ui.client.event.ComponentEvent; |
import com.extjs.gxt.ui.client.event.EventType; |
import com.extjs.gxt.ui.client.event.KeyListener; |
import com.extjs.gxt.ui.client.event.Listener; |
import com.extjs.gxt.ui.client.event.SelectionChangedEvent; |
257,6 → 260,9 |
} |
|
public boolean soumettreFormulaire() { |
|
Debug.log("===> BEGIN StructureForm.soumettreFormulaire()"); |
|
// Vérification de la validité des champs du formulaire |
boolean fomulaireValide = verifierFormulaire(); |
if (fomulaireValide) { |
272,14 → 278,20 |
// L'ajout des relations StructureAPersonne se fait quand la structure a été ajoutée |
// Voir la méthode rafraichir(). |
} else if (mode.equals(MODE_MODIFIER)) { |
|
Debug.log("===> StructureForm.soumettreFormulaire(), mode="+mode); |
|
// Modification des informations sur la Structure |
if (structure == null && conservation == null && valorisation == null) { |
Info.display("Modification d'une institution", "Rien n'a été enregistré car le formulaire n'a pas été modifié."); |
InfoLogger.display("Modification d'une institution", "Rien n'a été enregistré car le formulaire n'a pas été modifié."); |
} else { |
mediateur.modifierStructure(this, identification.getId(), structure, conservation, valorisation); |
} |
|
Debug.log("===> StructureForm.soumettreFormulaire(), personnelModifie.size="+personnelModifie.size() + ", personnelAjoute.size()="+personnelAjoute.size()); |
|
if (personnelModifie.size() == 0 && personnelAjoute.size() == 0 && personnelSupprime.size() == 0) { |
Info.display("Modification du personnel", "Rien n'a été enregistré car le formulaire n'a pas été modifié."); |
InfoLogger.display("Modification du personnel", "Rien n'a été enregistré car le formulaire n'a pas été modifié."); |
} else { |
if (personnelModifie.size() != 0) { |
decompteRafraichissementPersonnel++; |
298,6 → 310,9 |
} |
} |
} |
|
Debug.log("===> END StructureForm.soumettreFormulaire()"); |
|
return fomulaireValide; |
} |
|
1027,11 → 1042,14 |
int nbrePersonne = personnelGrilleMagazin.getCount(); |
for (int i = 0; i < nbrePersonne; i++) { |
StructureAPersonne personne = personnelGrilleMagazin.getAt(i); |
|
Debug.log(":::> StructureForm.collecterStructurePersonnel()"); |
Debug.log(":::> etat="+personne.get("etat")); |
|
// Seules les lignes ajoutées ou modifiées sont prises en compte. |
Record record = personnelGrilleMagazin.getRecord(personne); |
if (personnelGrilleMagazin.getModifiedRecords().contains(record) == true |
|| (personne.get("etat") != null && personne.get("etat").equals(StructureAPersonne.ETAT_AJOUTE) )) { |
|| (personne.get("etat") != null && (personne.get("etat").equals(StructureAPersonne.ETAT_AJOUTE) || personne.get("etat").equals(StructureAPersonne.ETAT_MODIFIE)) )) { |
|
// Gestion de l'id de la structure |
if (mode.equals("MODIF")) { |
1055,6 → 1073,10 |
} else { |
personne.setFonction(""); |
} |
|
// Gestion du nom complet |
String nomComplet = personne.getPrenom()+" "+personne.getNom(); |
personne.setNomComplet(nomComplet); |
|
// Gestion de la notion de "contact" |
personne.setContact(false); |
1132,6 → 1154,16 |
personnel.get(index).set("statut", personnel.get(index).getStatut().replaceFirst("AUTRE##", "")); |
} |
|
// Gestion de la specialite |
if (((String) personnel.get(index).getSpecialite()).matches("^[0-9]+$")) { |
// Author : Cyprien |
// TODO |
// Ici faire un combobox ? |
// ... |
} else { |
personnel.get(index).set("specialite", personnel.get(index).getSpecialite().replaceFirst("AUTRE##", "")); |
} |
|
// Gestion du temps de travail |
String tps = personnel.get(index).getBotaTravailHebdoTps(); |
personnel.get(index).set("travail", (tps.matches("^[0-9]+$") ? Integer.parseInt(tps) : 0)); |
1157,6 → 1189,9 |
personnelOnglet.setStyleAttribute("padding", "0"); |
personnelOnglet.addListener(Events.Select, new Listener<ComponentEvent>() { |
public void handleEvent(ComponentEvent be) { |
|
Debug.log(":::> StructureForm.creerOngletPersonnel.HandleEvent()"); |
|
// Indique que l'onglet a été rempli et a pu être modifié pour la méthode collecter... |
personnelOnglet.setData("acces", true); |
|
1164,6 → 1199,9 |
if (mode.equals(MODE_AJOUTER)) { |
rafraichirPersonnel(); |
} |
else { |
initialiserGrillePersonnelEnModification(); |
} |
} |
}); |
|
1177,8 → 1215,9 |
cp.setFrame(true); |
|
personnelGrilleMagazin = new ListStore<StructureAPersonne>(); |
personnelGrilleMagazin.setMonitorChanges(true); |
|
personnelGrilleMagazin.addListener(Store.Add, new Listener<StoreEvent<StructureAPersonne>>() { |
|
public void handleEvent(StoreEvent<StructureAPersonne> ce) { |
// Activation du bouton supprimer si la grille contient un élément |
if (grillePersonnel.getStore().getCount() > 0) { |
1188,6 → 1227,17 |
} |
}); |
|
/* TODELETE |
personnelGrilleMagazin.addListener(Store.Update, new Listener<StoreEvent<StructureAPersonne>>() { |
public void handleEvent(StoreEvent<StructureAPersonne> ce) { |
|
personnelGrilleMagazin.getAt(ce.getIndex()).set("etat", StructureAPersonne.ETAT_MODIFIE); |
Debug.log("Modification de : "+personnelGrilleMagazin.getAt(ce.getIndex()).getNom()); |
} |
}); |
*/ |
|
|
RowNumberer r = new RowNumberer(); |
|
List<ColumnConfig> configs = new ArrayList<ColumnConfig>(); |
1452,6 → 1502,9 |
grillePersonnel.setAutoExpandColumn("specialite"); |
grillePersonnel.setStripeRows(true); |
grillePersonnel.setTrackMouseOver(true); |
|
grillePersonnel.addListener(null, sm); |
|
cp.add(grillePersonnel); |
personnelOnglet.add(cp); |
|
1950,6 → 2003,9 |
} |
|
public void rafraichir(Object nouvellesDonnees) { |
|
Debug.log("|0> StructureForm.rafraichir, nouvellesDonnees.getClass() = "+nouvellesDonnees.getClass()); |
|
try { |
if (nouvellesDonnees instanceof Information) { |
Information info = (Information) nouvellesDonnees; |
1974,33 → 2030,35 |
if (info.getMessages() != null && !info.getMessages().toString().equals("[]")) { |
GWT.log("MESSAGES:\n"+info.getMessages().toString(), null); |
} |
|
Debug.log("|0> StructureForm.rafraichirInformation, info.getType() = "+info.getType()); |
|
if (info.getType().equals("modif_structure")) { |
Info.display("Modification d'une institution", info.toString()); |
InfoLogger.display("Modification d'une institution", info.toString()); |
} else if (info.getType().equals("ajout_structure")) { |
if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String) { |
String structureId = (String) info.getDonnee(0); |
Info.display("Ajout d'une Institution", "L'intitution '"+structureId+"' a bien été ajoutée"); |
InfoLogger.display("Ajout d'une Institution", "L'intitution '"+structureId+"' a bien été ajoutée"); |
|
// Suite à la récupération de l'id de l'institution nouvellement ajoutée nous ajoutons le personnel |
mediateur.ajouterStructureAPersonne(this, structureId, personnelAjoute); |
} else { |
Info.display("Ajout d'une Institution", info.toString()); |
InfoLogger.display("Ajout d'une Institution", info.toString()); |
} |
} else if (info.getType().equals("modif_structure_a_personne")) { |
Info.display("Modification du Personnel", info.toString()); |
InfoLogger.display("Modification du Personnel", info.toString()); |
GWT.log("Decompte:"+decompteRafraichissementPersonnel, null); |
testerLancementRafraichirPersonnel(); |
} else if (info.getType().equals("suppression_structure_a_personne")) { |
Info.display("Suppression du Personnel", info.toString()); |
InfoLogger.display("Suppression du Personnel", info.toString()); |
GWT.log("Decompte:"+decompteRafraichissementPersonnel, null); |
testerLancementRafraichirPersonnel(); |
} else if (info.getType().equals("ajout_structure_a_personne")) { |
Info.display("Ajout du Personnel", info.toString()); |
InfoLogger.display("Ajout du Personnel", info.toString()); |
GWT.log("Decompte:"+decompteRafraichissementPersonnel, null); |
testerLancementRafraichirPersonnel(); |
} else if (info.getType().equals("selection_structure")) { |
Info.display("Modification d'une institution", info.toString()); |
InfoLogger.display("Modification d'une institution", info.toString()); |
String titre = i18nC.titreModifFormStructurePanneau(); |
if (info.getDonnee(0) != null) { |
identification = (Structure) info.getDonnee(0); |
2024,14 → 2082,23 |
} |
} |
} |
panneauFormulaire.setHeading(titre); |
} else if (info.getType().equals("liste_structure_a_personne")) { |
Debug.log("==> StructureForm.rafraichirInformation, typeInfo=liste_structure_a_personne"); |
if (info.getDonnee(0) != null) { |
personnel = (StructureAPersonneListe) info.getDonnee(0); |
|
|
peuplerStructurePersonnel(); |
|
/* TODELETE |
int nbPersonnel = this.personnelGrilleMagazin.getCount(); |
for (int i=0; i<nbPersonnel; i++){ |
Debug.log("==> setEtat(ETAT_MODIFIE) : personne="+this.personnelGrilleMagazin.getAt(i).getId()); |
this.personnelGrilleMagazin.getAt(i).set("etat", StructureAPersonne.ETAT_MODIFIE); |
} |
*/ |
|
personnelOnglet.layout(); |
Info.display("Chargement du Personnel", "ok"); |
InfoLogger.display("Chargement du Personnel", "ok"); |
|
// Remise à zéro des modification dans la liste du personnel |
personnelModifie = new StructureAPersonneListe(); |
2173,14 → 2240,19 |
} |
|
private void testerLancementRafraichirPersonnel() { |
Debug.log("==> BEGIN StructureForm.testerLancementRafraichirPersonnel()"); |
|
decompteRafraichissementPersonnel--; |
if (decompteRafraichissementPersonnel == 0) { |
// Nous rechargeons la liste du Personnel |
rafraichirPersonnel(); |
} |
} |
Debug.log("==> END StructureForm.testerLancementRafraichirPersonnel()"); |
} |
|
private void rafraichirPersonnel() { |
Debug.log("==> BEGIN StructureForm.rafraichirPersonnel()"); |
|
decompteRafraichissementPersonnel = 0; |
if (mode.equals(MODE_MODIFIER)) { |
initialiserGrillePersonnelEnModification(); |
2187,6 → 2259,7 |
} else if (mode.equals(MODE_AJOUTER)) { |
initialiserGrillePersonnelEnAjout(); |
} |
Debug.log("==> END StructureForm.rafraichirPersonnel()"); |
} |
|
private void rafraichirPersonneExistante(String nom) { |
2208,7 → 2281,7 |
personnelOnglet.layout(); |
} |
|
private void initialiserGrillePersonnelEnModification() { |
mediateur.selectionnerStructureAPersonne(this, identification.getId(), StructureAPersonne.ROLE_EQUIPE); |
private void initialiserGrillePersonnelEnModification() { |
mediateur.selectionnerStructureAPersonne(this, identification.getId(), StructureAPersonne.ROLE_EQUIPE); |
} |
} |
} |