Rev 1637 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
package org.tela_botanica.client.vues.structure;import java.util.ArrayList;import java.util.Collection;import java.util.Iterator;import java.util.List;import org.tela_botanica.client.ComposantClass;import org.tela_botanica.client.Mediateur;import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;import org.tela_botanica.client.composants.ChampComboBoxRechercheTempsReelPaginable;import org.tela_botanica.client.composants.InfoLogger;import org.tela_botanica.client.composants.pagination.ProxyPersonnes;import org.tela_botanica.client.images.Images;import org.tela_botanica.client.interfaces.Rafraichissable;import org.tela_botanica.client.modeles.Information;import org.tela_botanica.client.modeles.Valeur;import org.tela_botanica.client.modeles.ValeurListe;import org.tela_botanica.client.modeles.aDonnee;import org.tela_botanica.client.modeles.personne.Personne;import org.tela_botanica.client.modeles.projet.Projet;import org.tela_botanica.client.modeles.structure.StructureAPersonne;import org.tela_botanica.client.modeles.structure.StructureAPersonneListe;import org.tela_botanica.client.synchronisation.Sequenceur;import org.tela_botanica.client.util.Debug;import org.tela_botanica.client.util.UtilString;import org.tela_botanica.client.vues.Formulaire;import org.tela_botanica.client.vues.FormulaireOnglet;import com.extjs.gxt.ui.client.Style.Scroll;import com.extjs.gxt.ui.client.data.ModelData;import com.extjs.gxt.ui.client.data.ModelType;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.Events;import com.extjs.gxt.ui.client.event.Listener;import com.extjs.gxt.ui.client.event.SelectionListener;import com.extjs.gxt.ui.client.store.ListStore;import com.extjs.gxt.ui.client.store.Record;import com.extjs.gxt.ui.client.store.Store;import com.extjs.gxt.ui.client.store.StoreEvent;import com.extjs.gxt.ui.client.widget.ContentPanel;import com.extjs.gxt.ui.client.widget.TabItem;import com.extjs.gxt.ui.client.widget.button.Button;import com.extjs.gxt.ui.client.widget.form.ComboBox;import com.extjs.gxt.ui.client.widget.form.Field;import com.extjs.gxt.ui.client.widget.form.NumberField;import com.extjs.gxt.ui.client.widget.form.TextArea;import com.extjs.gxt.ui.client.widget.form.TextField;import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;import com.extjs.gxt.ui.client.widget.grid.CellEditor;import com.extjs.gxt.ui.client.widget.grid.CheckColumnConfig;import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;import com.extjs.gxt.ui.client.widget.grid.ColumnModel;import com.extjs.gxt.ui.client.widget.grid.EditorGrid;import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;import com.extjs.gxt.ui.client.widget.grid.RowNumberer;import com.extjs.gxt.ui.client.widget.layout.FitLayout;import com.extjs.gxt.ui.client.widget.layout.FormLayout;import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;import com.google.gwt.core.client.GWT;import com.google.gwt.i18n.client.NumberFormat;public class StructureFormPersonne extends FormulaireOnglet implements Rafraichissable {private StructureAPersonneListe personnel = null;private StructureAPersonneListe personnelAjoute = null;private StructureAPersonneListe personnelModifie = null;private StructureAPersonneListe personnelSupprime = null;private NumberField nbreTotalPersonneStructureChp = null;private EditorGrid<StructureAPersonne> grillePersonnel = null;private ListStore<StructureAPersonne> personnelGrilleMagazin = null;public ListStore<Valeur> fonctionsMagazin;public ComboBox<Valeur> fonctionsCombo;public ListStore<Valeur> magazinLiStatut;public ComboBox<Valeur> comboLiStatut;private ListStore<Personne> personneExistanteMagazin = null;private ChampComboBoxRechercheTempsReelPaginable personneExistanteCombo = null;private Button supprimerPersonnelBtn = null;private ListStore<Projet> projetsMagazin = null;private CellEditor fonctionEditor = null;private List<Valeur> fonctionsListe = null;private String ID = "personnel";private Formulaire formulaireCourant = null;private int decompteRafraichissementPersonnel;private Sequenceur sequenceur = null;final class EtatPersonnelStructure {public StructureAPersonneListe personnelModifie;public StructureAPersonneListe personnelAjoute;public StructureAPersonneListe personnelSupprime;public StructureAPersonneListe personnel;}public StructureFormPersonne(Formulaire formulaireCourant, Mediateur mediateur) {initialiserOnglet(formulaireCourant);this.formulaireCourant = formulaireCourant;// Création des objets contenant les manipulations de la grillepersonnelModifie = new StructureAPersonneListe();personnelAjoute = new StructureAPersonneListe();personnelSupprime = new StructureAPersonneListe();setId(ID);setText(Mediateur.i18nC.personneSingulier());FormulaireOnglet.parametrer(this);this.setLayout(Formulaire.creerFormLayout(400, LabelAlign.LEFT));this.setStyleAttribute("padding", "0");this.addListener(Events.Select, new Listener<ComponentEvent>() {public void handleEvent(ComponentEvent be) {// Indique que l'onglet a été rempli et a pu être modifié pour la méthode collecter...setData("acces", true);// Rafraichissement du contenu de la grille du personnelif (StructureFormPersonne.this.formulaireCourant.mode.equals(Formulaire.MODE_AJOUTER)) {rafraichirPersonnel();}}});ContentPanel cp = new ContentPanel();cp.setHeadingHtml("Personnes travaillant sur les collections");cp.setIcon(Images.ICONES.table());cp.setScrollMode(Scroll.AUTO);cp.setLayout(new FitLayout());//cp.setWidth(1250);//cp.setHeight("100%");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émentif (grillePersonnel.getStore().getCount() > 0) {supprimerPersonnelBtn.enable();}}});RowNumberer r = new RowNumberer();List<ColumnConfig> configs = new ArrayList<ColumnConfig>();GridSelectionModel<StructureAPersonne> sm = new GridSelectionModel<StructureAPersonne>();configs.add(r);ColumnConfig column = new ColumnConfig("fonction", "Fonction", 150);fonctionsMagazin = new ListStore<Valeur>();fonctionsCombo = new ComboBox<Valeur>();fonctionsCombo.setTriggerAction(TriggerAction.ALL);fonctionsCombo.setEditable(true);fonctionsCombo.setDisplayField("nom");fonctionsCombo.setStore(fonctionsMagazin);mediateur.obtenirListeValeurEtRafraichir(this, "fonction", sequenceur);fonctionEditor = new CellEditor(fonctionsCombo) {@Overridepublic Object preProcessValue(Object valeur) {Valeur retour = null;if (valeur != null) {String chaineTransmise = (String) valeur;if (fonctionsMagazin.getCount() == 0 && fonctionsListe != null) {fonctionsMagazin.add(fonctionsListe);}if (fonctionsMagazin.findModel("id_valeur", chaineTransmise) != null) {retour = fonctionsMagazin.findModel("id_valeur", chaineTransmise);} else if (fonctionsMagazin.findModel("nom", chaineTransmise) != null) {retour = fonctionsMagazin.findModel("nom", chaineTransmise);} else {retour = new Valeur("", chaineTransmise, "", "");}}return retour;}@Overridepublic Object postProcessValue(Object valeur) {String retour = "";Valeur fonctionTrouvee = null;if (valeur == null) {String valeurBrute = this.getField().getRawValue();if (fonctionsMagazin.getCount() == 0 && fonctionsListe != null) {fonctionsMagazin.add(fonctionsListe);}if (valeurBrute.matches("^[0-9]+$") && fonctionsMagazin.findModel("id_valeur", valeurBrute) != null) {fonctionTrouvee = fonctionsMagazin.findModel("id_valeur", valeurBrute);} else {retour = valeurBrute;}} else if (valeur instanceof Valeur) {fonctionTrouvee = (Valeur) valeur;}if (fonctionTrouvee != null) {retour = fonctionTrouvee.getNom();}return retour;}};column.setEditor(fonctionEditor);configs.add(column);column = new ColumnConfig("prenom", "Prénom", 100);TextField<String> prenomChp = new TextField<String>();prenomChp.setAllowBlank(false);prenomChp.getMessages().setBlankText("Ce champ est obligatoire.");prenomChp.setAutoValidate(true);prenomChp.addStyleName(ComposantClass.OBLIGATOIRE);prenomChp.addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire());column.setEditor(new CellEditor(prenomChp));configs.add(column);column = new ColumnConfig("nom", "Nom", 100);TextField<String> nomChp = new TextField<String>();nomChp.setAllowBlank(false);nomChp.getMessages().setBlankText("Ce champ est obligatoire.");nomChp.setAutoValidate(true);nomChp.addStyleName(ComposantClass.OBLIGATOIRE);nomChp.addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire());column.setEditor(new CellEditor(nomChp));configs.add(column);column = new ColumnConfig("tel_fix", "Téléphone fixe", 100);TextField<String> telChp = new TextField<String>();column.setEditor(new CellEditor(telChp));configs.add(column);column = new ColumnConfig("tel_fax", "Fax", 100);TextField<String> faxChp = new TextField<String>();column.setEditor(new CellEditor(faxChp));configs.add(column);column = new ColumnConfig("courriel", "Courriel principal", 200);TextField<String> emailChp = new TextField<String>();column.setEditor(new CellEditor(emailChp));configs.add(column);magazinLiStatut = new ListStore<Valeur>();magazinLiStatut.add(new ArrayList<Valeur>());comboLiStatut = new ComboBox<Valeur>();comboLiStatut.setTriggerAction(TriggerAction.ALL);comboLiStatut.setEditable(false);comboLiStatut.disableTextSelection(true);comboLiStatut.setDisplayField("nom");comboLiStatut.setStore(magazinLiStatut);mediateur.obtenirListeValeurEtRafraichir(this, "statut", sequenceur);CellEditor statutEditor = new CellEditor(comboLiStatut) {@Overridepublic Object preProcessValue(Object value) {if (value == null) {return value;}return comboLiStatut.getStore().findModel("nom", (String) value);}@Overridepublic Object postProcessValue(Object value) {if (value == null) {return value;}return ((Valeur) value).get("nom");}};column = new ColumnConfig("statut", "Statut", 100);column.setEditor(statutEditor);configs.add(column);column = new ColumnConfig("travail", "Travail hebdo (%)", 100);column.setNumberFormat(NumberFormat.getFormat("##"));NumberField tpsWChp = new NumberField();tpsWChp.setFormat(NumberFormat.getFormat("##"));tpsWChp.setToolTip("Ce champ doit contenir un nombre");column.setEditor(new CellEditor(tpsWChp));configs.add(column);column = new ColumnConfig("specialite", "Spécialité principale", 150);TextField<String> speChp = new TextField<String>();column.setEditor(new CellEditor(speChp));configs.add(column);CheckColumnConfig checkColumn = new CheckColumnConfig("contact", "Contact ?", 60);configs.add(checkColumn);ToolBar toolBar = new ToolBar();Button ajouterPersonnelBtn = new Button("Ajouter");ajouterPersonnelBtn.setIcon(Images.ICONES.vcardAjouter());ajouterPersonnelBtn.addSelectionListener(new SelectionListener<ButtonEvent>() {@Overridepublic void componentSelected(ButtonEvent ce) {StructureAPersonne membreDuPersonnel = new StructureAPersonne("", StructureAPersonne.ROLE_EQUIPE, StructureAPersonne.ETAT_AJOUTE);ajouterMembreAGrillePersonnel(membreDuPersonnel);}});toolBar.add(ajouterPersonnelBtn);toolBar.add(new SeparatorToolItem());supprimerPersonnelBtn = new Button("Supprimer");supprimerPersonnelBtn.setIcon(Images.ICONES.vcardSupprimer());supprimerPersonnelBtn.addSelectionListener(new SelectionListener<ButtonEvent>() {@Overridepublic void componentSelected(ButtonEvent ce) {StructureAPersonne personne = grillePersonnel.getSelectionModel().getSelectedItem();if (personne != null) {// Ajout de la personne supprimée à la listeif (personne.getIdPersonne() != null && !personne.getIdPersonne().equals("")) {personnelSupprime.put(personne.getId(), personne);}// Suppression de l'enregistrement de la grillegrillePersonnel.getStore().remove(personne);// Désactivation du bouton supprimer si la grille contient plus d'élémentif (grillePersonnel.getStore().getCount() == 0) {//TODO : check : Item -> componentce.getComponent().disable();}}}});toolBar.add(supprimerPersonnelBtn);toolBar.add(new SeparatorToolItem());Button rafraichirPersonnelBtn = new Button("Rafraichir");rafraichirPersonnelBtn.setIcon(Images.ICONES.rafraichir());rafraichirPersonnelBtn.addSelectionListener(new SelectionListener<ButtonEvent>() {@Overridepublic void componentSelected(ButtonEvent ce) {rafraichirPersonnel();}});toolBar.add(rafraichirPersonnelBtn);toolBar.add(new SeparatorToolItem());personneExistanteMagazin = new ListStore<Personne>();personneExistanteMagazin.add(new ArrayList<Personne>());ModelType modelTypePersonnes = new ModelType();modelTypePersonnes.setRoot("personnes");modelTypePersonnes.setTotalName("nbElements");modelTypePersonnes.addField("cp_fmt_nom_complet");modelTypePersonnes.addField("cp_nom");modelTypePersonnes.addField("cp_prenom");modelTypePersonnes.addField("cp_truk_courriel");modelTypePersonnes.addField("cp_truk_telephone");modelTypePersonnes.addField("cp_ce_truk_specialite");modelTypePersonnes.addField("cp_id_personne");String displayNamePersonnes = "cp_fmt_nom_complet";ProxyPersonnes<ModelData> proxyPersonnes = new ProxyPersonnes<ModelData>(null);personneExistanteCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyPersonnes, modelTypePersonnes, displayNamePersonnes);// TODO : dans GXT 2.0 plus besoin de l'adaptateur, on peut ajouter la combobox directement sur la toolbar//> CHECKtoolBar.add(personneExistanteCombo);Button ajouterPersonneExistanteBtn = new Button("Ajouter à la grille");ajouterPersonneExistanteBtn.addSelectionListener(new SelectionListener<ButtonEvent>() {@Overridepublic void componentSelected(ButtonEvent ce) {Personne personneExistante = new Personne(personneExistanteCombo.getValeur());if (personneExistante != null) {StructureAPersonne membreDuPersonnel = new StructureAPersonne(personneExistante, "", StructureAPersonne.ROLE_EQUIPE, StructureAPersonne.ETAT_AJOUTE);ajouterMembreAGrillePersonnel(membreDuPersonnel);}}});toolBar.add(ajouterPersonneExistanteBtn);cp.setTopComponent(toolBar);ColumnModel cm = new ColumnModel(configs);grillePersonnel = new EditorGrid<StructureAPersonne>(personnelGrilleMagazin, cm);grillePersonnel.setHeight("100%");grillePersonnel.setBorders(true);grillePersonnel.setSelectionModel(sm);grillePersonnel.addPlugin(checkColumn);grillePersonnel.addPlugin(r);grillePersonnel.getView().setForceFit(true);grillePersonnel.setAutoExpandColumn("specialite");grillePersonnel.setStripeRows(true);grillePersonnel.setTrackMouseOver(true);personnelGrilleMagazin.addListener(Store.Update, new Listener<StoreEvent<StructureAPersonne>>() {public void handleEvent(StoreEvent<StructureAPersonne> ce) {StructureAPersonne structureAPersonne = ce.getModel();String etat = structureAPersonne.get("etat");if ((etat==null || !etat.equals(aDonnee.ETAT_AJOUTE)) && structureAPersonne!=null && !UtilString.isEmpty(structureAPersonne.getId())) {ce.getModel().set("etat", aDonnee.ETAT_MODIFIE);}}});cp.add(grillePersonnel);this.add(cp);}public Collection<? extends String> verifier() {ArrayList<String> messages = new ArrayList<String>();// Vérification du Personnelif (getData("acces").equals(true)) {String personnelNumero = "";int nbrePersonne = personnelGrilleMagazin.getCount();for (int i = 0; i < nbrePersonne; i++) {StructureAPersonne personne = personnelGrilleMagazin.getAt(i);if (personne.getNom().equals("") || personne.getPrenom().equals("")) {personnelNumero += (i != 0 ? ", " : "")+(i+1);}}if (!personnelNumero.equals("")) {messages.add("Veuillez indiquez un prénom et un nom au personnel numéro : "+personnelNumero);}}return messages;}@Overridepublic void rafraichir(Object nouvellesDonnees) {if (nouvellesDonnees instanceof ValeurListe) {ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;rafraichirValeurListe(listeValeurs);} else if (nouvellesDonnees instanceof Information) {Information info = (Information) nouvellesDonnees;rafraichirInformation(info);} else {Debug.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()));}}public void rafraichirInformation(Information info) {if (info.getType().equals("ajout_structure")) {if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String) {String structureId = (String) info.getDonnee(0);// Suite à la récupération de l'id de l'institution nouvellement ajoutée nous ajoutons le personnelmediateur.ajouterStructureAPersonne(this, structureId, getPersonnelAjoute());}} else if (info.getType().equals("modif_structure_a_personne")) {InfoLogger.display("Modification du Personnel", info.toString());testerLancementRafraichirPersonnel();} else if (info.getType().equals("suppression_structure_a_personne")) {InfoLogger.display("Suppression du Personnel", info.toString());testerLancementRafraichirPersonnel();} else if (info.getType().equals("ajout_structure_a_personne")) {InfoLogger.display("Ajout du Personnel", info.toString());testerLancementRafraichirPersonnel();} else if (info.getType().equals("liste_structure_a_personne")) {if (info.getDonnee(0) != null) {StructureAPersonneListe personnel = (StructureAPersonneListe) info.getDonnee(0);peupler(personnel);layout();InfoLogger.display("Chargement du Personnel", "ok");}}}public void rafraichirValeurListe(ValeurListe listeValeurs) {List<Valeur> liste = listeValeurs.toList();if (listeValeurs.getId().equals(config.getListeId("statut"))) {magazinLiStatut.removeAll();magazinLiStatut.add(liste);comboLiStatut.setStore(magazinLiStatut);}if (listeValeurs.getId().equals(config.getListeId("fonction"))) {// FIXME : le store ne contient pas tout le temps les données, chose étrange.// On stocke donc les données dans une variables de la classe pour recharger le store si besoin.fonctionsListe = liste;fonctionsMagazin.removeAll();fonctionsMagazin.add(liste);fonctionsCombo.setStore(fonctionsMagazin);}}public EtatPersonnelStructure collecter() {StructureForm formulaire = (StructureForm)formulaireCourant;if (getData("acces").equals(true)) {personnelGrilleMagazin.commitChanges();int nbrePersonne = personnelGrilleMagazin.getCount();for (int i = 0; i < nbrePersonne; i++) {StructureAPersonne personne = personnelGrilleMagazin.getAt(i);// 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").equals(StructureAPersonne.ETAT_MODIFIE)) )) {// Gestion de l'id de la structureif (mode.equals("MODIF")) {personne.setIdStructure(getIdIdentification());}// Récupération de l'id du projet de la structure qui servira aussi pour les Personnes crées dans ce formulaireif (personne.getIdPersonne().equals("") && formulaire.getValeurProjetCombo() != null) {personne.setIdProjetPersonne(new Projet(formulaire.getValeurProjet()).getId());}// Gestion de la fonctionString fonction = personne.get("fonction");if (fonction != null && !fonction.equals("")) {Valeur valeurRecherche = fonctionsCombo.getStore().findModel("nom", fonction);if (valeurRecherche != null) {personne.setFonction(valeurRecherche.getId());} else {personne.setFonction("AUTRE", fonction);}} else {personne.setFonction("");}// Gestion du nom completString nomComplet = personne.getPrenom()+" "+personne.getNom();personne.setNomComplet(nomComplet);// Gestion de la notion de "contact"personne.setContact(false);if (personne.get("contact").equals(true)) {personne.setContact(true);}// Gestion du statutString statut = personne.get("statut");if (statut != null && !statut.equals("")) {Valeur valeurRecherche = comboLiStatut.getStore().findModel("nom", statut);if (valeurRecherche != null) {personne.setStatut(valeurRecherche.getId());} else {personne.setStatut("AUTRE", statut);}} else {personne.setStatut("");}// Gestion du temps de travailString personneTravail = "";if(personne.get("travail") != null) {personneTravail = personne.get("travail").toString();}personne.setBotaTravailHebdoTps(personneTravail);// Gestion du téléphoneString telephoneFixe = personne.get("tel_fix");personne.setTelephoneFixe(telephoneFixe);// Gestion du faxString fax = personne.get("tel_fax");personne.setFax(fax);// Gestion du courrielString courriel = personne.get("courriel");personne.setCourriel(courriel);// Gestion de la spécialitéString specialite = personne.get("specialite");personne.setSpecialite(specialite);// On met à faux le décèspersonne.setDeces(Personne.ETRE_VIVANT);// Ajout de la personne dans la liste correspondant à son état (ajouté ou modifié)if (personne.get("etat") != null && personne.get("etat").equals(StructureAPersonne.ETAT_AJOUTE)) { // Une personne ajoutéepersonnelAjoute.put(""+i, personne);} else {// Une personne modifiéepersonnelModifie.put(personne.getId(), personne);}} else {GWT.log("Personne non modifiées : "+personne.getPrenom()+" "+personne.getNom(), null);}}}EtatPersonnelStructure etatPersonnel = new EtatPersonnelStructure();etatPersonnel.personnelAjoute = personnelAjoute;etatPersonnel.personnelModifie = personnelModifie;etatPersonnel.personnelSupprime = personnelSupprime;// Remise à zéro des modification dans la liste du personnelpersonnelModifie = new StructureAPersonneListe();personnelAjoute = new StructureAPersonneListe();personnelSupprime = new StructureAPersonneListe();return etatPersonnel;}public void peupler(StructureAPersonneListe personnel) {//this.personnel = personnel;if (formulaireCourant.mode.equals(Formulaire.MODE_MODIFIER) && personnel != null) {ArrayList<StructureAPersonne> personnes = new ArrayList<StructureAPersonne>();for (Iterator<String> it = personnel.keySet().iterator(); it.hasNext();) {String index = it.next();// Gestion de la fonctionif (fonctionsMagazin != null && !((String) personnel.get(index).getFonction()).startsWith("AUTRE##")) {if (fonctionsMagazin.findModel("id_valeur", personnel.get(index).getFonction()) != null) {personnel.get(index).set("fonction", fonctionsMagazin.findModel("id_valeur", personnel.get(index).getFonction()).getNom());}} else {personnel.get(index).set("fonction", personnel.get(index).getFonction().replaceFirst("AUTRE##", ""));}// Gestion de la notion de "contact"personnel.get(index).set("contact", (personnel.get(index).getContact().equals("1") ? true : false));// Gestion du statutif (magazinLiStatut != null && ((String) personnel.get(index).getStatut()).matches("^[0-9]+$")) {personnel.get(index).set("statut", magazinLiStatut.findModel("id_valeur", personnel.get(index).getStatut()).getNom());} else {personnel.get(index).set("statut", personnel.get(index).getStatut().replaceFirst("AUTRE##", ""));}// Gestion de la specialiteif (((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 travailString tps = personnel.get(index).getBotaTravailHebdoTps();personnel.get(index).set("travail", (tps.matches("^[0-9]+$") ? Integer.parseInt(tps) : 0));personnes.add(personnel.get(index));}personnelGrilleMagazin.removeAll();personnelGrilleMagazin.add(personnes);// Remise à zéro des modification dans la liste du personnelpersonnelModifie = new StructureAPersonneListe();personnelAjoute = new StructureAPersonneListe();personnelSupprime = new StructureAPersonneListe();// Nous vidons la variable personnel une fois qu'elle a remplie la grillepersonnel = null;}}public StructureAPersonneListe getPersonnelAjoute() {return personnelAjoute;}private void ajouterMembreAGrillePersonnel(StructureAPersonne personnel) {grillePersonnel.stopEditing();personnelGrilleMagazin.insert(personnel, 0);grillePersonnel.startEditing(0, 0);}public void testerLancementRafraichirPersonnel() {decompteRafraichissementPersonnel--;if (decompteRafraichissementPersonnel <= 0) {// Nous rechargeons la liste du PersonnelrafraichirPersonnel();}}private void rafraichirPersonnel() {decompteRafraichissementPersonnel = 0;if (formulaireCourant.mode.equals(Formulaire.MODE_MODIFIER)) {initialiserGrillePersonnelEnModification();} else if (formulaireCourant.mode.equals(Formulaire.MODE_AJOUTER)) {initialiserGrillePersonnelEnAjout();}}private void rafraichirPersonneExistante(String nom) {mediateur.selectionnerPersonneParNomComplet(this, null, nom+"%", null);}public void incrementerDecompteRafraichissementPersonnel() {decompteRafraichissementPersonnel++;}private void initialiserGrillePersonnelEnAjout() {personnelGrilleMagazin.removeAll();layout();}private String getIdIdentification() {return ((StructureForm)formulaireCourant).getIdIdentification();}private void initialiserGrillePersonnelEnModification() {mediateur.selectionnerStructureAPersonne(this, getIdIdentification(), StructureAPersonne.ROLE_EQUIPE, null);}}