Line 28... |
Line 28... |
28 |
|
28 |
|
29 |
import com.extjs.gxt.ui.client.Events;
|
29 |
import com.extjs.gxt.ui.client.Events;
|
30 |
import com.extjs.gxt.ui.client.Registry;
|
30 |
import com.extjs.gxt.ui.client.Registry;
|
31 |
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
|
31 |
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
|
32 |
import com.extjs.gxt.ui.client.Style.Scroll;
|
32 |
import com.extjs.gxt.ui.client.Style.Scroll;
|
33 |
import com.extjs.gxt.ui.client.data.BaseModelData;
|
33 |
import com.extjs.gxt.ui.client.event.BaseEvent;
|
34 |
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
34 |
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
35 |
import com.extjs.gxt.ui.client.event.GridEvent;
|
35 |
import com.extjs.gxt.ui.client.event.GridEvent;
|
36 |
import com.extjs.gxt.ui.client.event.KeyListener;
|
36 |
import com.extjs.gxt.ui.client.event.KeyListener;
|
37 |
import com.extjs.gxt.ui.client.event.Listener;
|
37 |
import com.extjs.gxt.ui.client.event.Listener;
|
Line 86... |
Line 86... |
86 |
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
86 |
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
87 |
import com.google.gwt.core.client.GWT;
|
87 |
import com.google.gwt.core.client.GWT;
|
88 |
import com.google.gwt.i18n.client.DateTimeFormat;
|
88 |
import com.google.gwt.i18n.client.DateTimeFormat;
|
89 |
import com.google.gwt.i18n.client.NumberFormat;
|
89 |
import com.google.gwt.i18n.client.NumberFormat;
|
90 |
import com.google.gwt.user.client.Window;
|
90 |
import com.google.gwt.user.client.Window;
|
91 |
import com.google.gwt.user.client.ui.ListBox;
|
- |
|
Line 92... |
Line 91... |
92 |
|
91 |
|
Line -... |
Line 92... |
- |
|
92 |
public class FormStructureVue extends LayoutContainer implements Rafraichissable {
|
- |
|
93 |
|
- |
|
94 |
private static final String MODE_AJOUTER = "AJOUT";
|
93 |
public class FormStructureVue extends LayoutContainer implements Rafraichissable {
|
95 |
private static final String MODE_MODIFIER = "MODIF";
|
94 |
|
96 |
|
95 |
private Constantes i18nC = null;
|
97 |
private Constantes i18nC = null;
|
Line 96... |
Line 98... |
96 |
private Mediateur mediateur = null;
|
98 |
private Mediateur mediateur = null;
|
Line 114... |
Line 116... |
114 |
private ComboBox<Valeur> comboLstpr = null;
|
116 |
private ComboBox<Valeur> comboLstpr = null;
|
115 |
private ListStore<Valeur> magazinLstpu = null;
|
117 |
private ListStore<Valeur> magazinLstpu = null;
|
116 |
private ComboBox<Valeur> comboLstpu = null;
|
118 |
private ComboBox<Valeur> comboLstpu = null;
|
117 |
private ListStore<Valeur> magazinLiStatut = null;
|
119 |
private ListStore<Valeur> magazinLiStatut = null;
|
118 |
private ComboBox<Valeur> comboLiStatut = null;
|
120 |
private ComboBox<Valeur> comboLiStatut = null;
|
119 |
private ListStore<Valeur> magazinLiFonction = null;
|
121 |
private ListStore<Valeur> fonctionsMagazin = null;
|
120 |
private ComboBox<Valeur> comboLiFonction = null;
|
122 |
private ComboBox<Valeur> fonctionsCombo = null;
|
121 |
private ComboBox<InterneValeur> comboAcronyme = null;
|
123 |
private ComboBox<InterneValeur> comboAcronyme = null;
|
122 |
private TextField<String> ihChp = null;
|
124 |
private TextField<String> ihChp = null;
|
123 |
private TextField<String> mnhnChp = null;
|
125 |
private TextField<String> mnhnChp = null;
|
124 |
private ComboBox<InterneValeur> comboTypeStructure = null;
|
126 |
private ComboBox<InterneValeur> comboTypeStructure = null;
|
125 |
private TextField<String> nomStructureChp;
|
127 |
private TextField<String> nomStructureChp;
|
Line 211... |
Line 213... |
211 |
private TextField<String> publicationChp;
|
213 |
private TextField<String> publicationChp;
|
212 |
private ContentPanel materielConservationCp;
|
214 |
private ContentPanel materielConservationCp;
|
213 |
private ListStore<Personne> personneExistanteMagazin;
|
215 |
private ListStore<Personne> personneExistanteMagazin;
|
214 |
private ComboBox<Personne> personneExistanteCombo;
|
216 |
private ComboBox<Personne> personneExistanteCombo;
|
215 |
private TextToolItem supprimerPersonnelBtn;
|
217 |
private TextToolItem supprimerPersonnelBtn;
|
216 |
private ListBox projetChp;
|
- |
|
217 |
private ListStore<Projet> projetsMagazin;
|
218 |
private ListStore<Projet> projetsMagazin;
|
218 |
private ComboBox<Projet> projetsCombo;
|
219 |
private ComboBox<Projet> projetsCombo;
|
- |
|
220 |
private CellEditor fonctionEditor;
|
- |
|
221 |
private List<Valeur> fonctionsListe;
|
Line 219... |
Line 222... |
219 |
|
222 |
|
220 |
|
223 |
|
221 |
public FormStructureVue() {
|
224 |
public FormStructureVue() {
|
Line 327... |
Line 330... |
327 |
}
|
330 |
}
|
Line 328... |
Line 331... |
328 |
|
331 |
|
329 |
private Boolean verifierFormulaire() {
|
332 |
private Boolean verifierFormulaire() {
|
Line 330... |
Line 333... |
330 |
ArrayList<String> messages = new ArrayList<String>();
|
333 |
ArrayList<String> messages = new ArrayList<String>();
|
331 |
|
334 |
|
332 |
// Vérification des infos sur la structure
|
335 |
// Vérification des infos sur le nom de la structure
|
333 |
if ( (identificationOnglet.getData("acces").equals(true) && nomStructureChp.getValue() == null) ||
|
336 |
if ( (identificationOnglet.getData("acces").equals(true) && nomStructureChp.getValue() == null) ||
|
334 |
(identificationOnglet.getData("acces").equals(true) && nomStructureChp.getValue().equals("")) ||
|
337 |
(identificationOnglet.getData("acces").equals(true) && nomStructureChp.getValue().equals("")) ||
|
335 |
(identificationOnglet.getData("acces").equals(false) && identification.getNom().equals(""))) {
|
338 |
(identificationOnglet.getData("acces").equals(false) && identification.getNom().equals(""))) {
|
Line -... |
Line 339... |
- |
|
339 |
messages.add("Veuillez indiquez un nom à l'institution.");
|
- |
|
340 |
}
|
- |
|
341 |
|
- |
|
342 |
// Vérification des infos sur le projet de la structure
|
- |
|
343 |
if ( (identificationOnglet.getData("acces").equals(true) && projetsCombo.getValue() == null) ||
|
- |
|
344 |
(identificationOnglet.getData("acces").equals(true) && projetsCombo.getValue().equals("")) ||
|
- |
|
345 |
(identificationOnglet.getData("acces").equals(false) && identification.getIdProjet().equals(""))) {
|
336 |
messages.add("Veuillez indiquez un nom à l'institution.");
|
346 |
messages.add("Veuillez sélectionner un projet pour l'institution.");
|
337 |
}
|
347 |
}
|
338 |
|
348 |
|
339 |
// Vérification du Personnel
|
349 |
// Vérification du Personnel
|
340 |
if (personnelOnglet.getData("acces").equals(true)) {
|
350 |
if (personnelOnglet.getData("acces").equals(true)) {
|
Line 678... |
Line 688... |
678 |
return structure;
|
688 |
return structure;
|
679 |
}
|
689 |
}
|
680 |
}
|
690 |
}
|
Line 681... |
Line 691... |
681 |
|
691 |
|
682 |
private void peuplerStructureIdentification() {
|
692 |
private void peuplerStructureIdentification() {
|
683 |
if (mode.equals("AJOUT")) {
|
693 |
if (mode.equals(MODE_AJOUTER)) {
|
684 |
// Indique que l'ongleta pu être modifié pour la méthode collecter...
|
694 |
// Indique que l'ongleta pu être modifié pour la méthode collecter...
|
685 |
identificationOnglet.setData("acces", true);
|
695 |
identificationOnglet.setData("acces", true);
|
686 |
// Indication du projet sélectionné par défaut
|
696 |
// Indication du projet sélectionné par défaut
|
687 |
String projetCourantId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getProjetId();
|
697 |
String projetCourantId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getProjetId();
|
688 |
if (!projetCourantId.equals("0")) {
|
698 |
if (projetCourantId != null && !projetCourantId.equals("0")) {
|
689 |
projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", projetCourantId));
|
699 |
projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", projetCourantId));
|
690 |
}
|
700 |
}
|
691 |
}
|
701 |
}
|
692 |
if (mode.equals("MODIF") && identification != null && identificationOnglet.getData("acces").equals(false)) {
|
702 |
if (mode.equals(MODE_MODIFIER) && identification != null && identificationOnglet.getData("acces").equals(false)) {
|
693 |
idStructureChp.setValue(identification.getId());
|
703 |
idStructureChp.setValue(identification.getId());
|
694 |
nomStructureChp.setValue(identification.getNom());
|
704 |
nomStructureChp.setValue(identification.getNom());
|
695 |
if (!identification.getIdProjet().equals("0")) {
|
705 |
if (!identification.getIdProjet().equals("0")) {
|
696 |
projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", identification.getIdProjet()));
|
706 |
projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", identification.getIdProjet()));
|
Line 958... |
Line 968... |
958 |
}
|
968 |
}
|
Line 959... |
Line 969... |
959 |
|
969 |
|
960 |
// Gestion de la fonction
|
970 |
// Gestion de la fonction
|
961 |
String fonction = personne.get("fonction");
|
971 |
String fonction = personne.get("fonction");
|
962 |
if (fonction != null && !fonction.equals("")) {
|
972 |
if (fonction != null && !fonction.equals("")) {
|
963 |
Valeur valeurRecherche = comboLiFonction.getStore().findModel("nom", fonction);
|
973 |
Valeur valeurRecherche = fonctionsCombo.getStore().findModel("nom", fonction);
|
964 |
if (valeurRecherche != null) {
|
974 |
if (valeurRecherche != null) {
|
965 |
personne.setFonction(valeurRecherche.getId());
|
975 |
personne.setFonction(valeurRecherche.getId());
|
966 |
} else {
|
976 |
} else {
|
967 |
personne.setFonction("AUTRE", fonction);
|
977 |
personne.setFonction("AUTRE", fonction);
|
Line 1026... |
Line 1036... |
1026 |
}
|
1036 |
}
|
1027 |
}
|
1037 |
}
|
1028 |
}
|
1038 |
}
|
Line 1029... |
Line 1039... |
1029 |
|
1039 |
|
1030 |
private void peuplerStructurePersonnel() {
|
1040 |
private void peuplerStructurePersonnel() {
|
1031 |
if (personnel != null) {
|
1041 |
if (mode.equals(MODE_MODIFIER) && personnel != null) {
|
1032 |
ArrayList<StructureAPersonne> personnes = new ArrayList<StructureAPersonne>();
|
1042 |
ArrayList<StructureAPersonne> personnes = new ArrayList<StructureAPersonne>();
|
1033 |
for (Iterator<String> it = personnel.keySet().iterator(); it.hasNext();) {
|
1043 |
for (Iterator<String> it = personnel.keySet().iterator(); it.hasNext();) {
|
Line 1034... |
Line 1044... |
1034 |
String index = it.next();
|
1044 |
String index = it.next();
|
1035 |
|
1045 |
|
1036 |
// Gestion de la fonction
|
1046 |
// Gestion de la fonction
|
1037 |
if (magazinLiFonction != null && !((String) personnel.get(index).getFonction()).startsWith("AUTRE##")) {
|
1047 |
if (fonctionsMagazin != null && !((String) personnel.get(index).getFonction()).startsWith("AUTRE##")) {
|
1038 |
GWT.log(personnel.get(index).getFonction(), null);
|
1048 |
GWT.log(personnel.get(index).getFonction(), null);
|
1039 |
if (magazinLiFonction.findModel("id_valeur", personnel.get(index).getFonction()) != null) {
|
1049 |
if (fonctionsMagazin.findModel("id_valeur", personnel.get(index).getFonction()) != null) {
|
1040 |
personnel.get(index).set("fonction", magazinLiFonction.findModel("id_valeur", personnel.get(index).getFonction()).getNom());
|
1050 |
personnel.get(index).set("fonction", fonctionsMagazin.findModel("id_valeur", personnel.get(index).getFonction()).getNom());
|
1041 |
}
|
1051 |
}
|
1042 |
} else {
|
1052 |
} else {
|
Line 1093... |
Line 1103... |
1093 |
cp.setLayout(new FitLayout());
|
1103 |
cp.setLayout(new FitLayout());
|
1094 |
cp.setWidth(1250);
|
1104 |
cp.setWidth(1250);
|
1095 |
cp.setHeight("100%");
|
1105 |
cp.setHeight("100%");
|
1096 |
cp.setFrame(true);
|
1106 |
cp.setFrame(true);
|
Line 1097... |
Line -... |
1097 |
|
- |
|
1098 |
List<StructureAPersonne> personnes = new ArrayList<StructureAPersonne>();
|
- |
|
1099 |
personnes.add(new StructureAPersonne(StructureAPersonne.FONCTION_DIRECTEUR, StructureAPersonne.ROLE_EQUIPE));
|
- |
|
1100 |
personnes.add(new StructureAPersonne(StructureAPersonne.FONCTION_CONSERVATEUR, StructureAPersonne.ROLE_EQUIPE));
|
- |
|
1101 |
|
1107 |
|
1102 |
personnelGrilleMagazin = new ListStore<StructureAPersonne>();
|
- |
|
1103 |
personnelGrilleMagazin.add(personnes);
|
1108 |
personnelGrilleMagazin = new ListStore<StructureAPersonne>();
|
Line 1104... |
Line 1109... |
1104 |
personnelGrilleMagazin.addListener(Store.Add, new Listener<StoreEvent<StructureAPersonne>>() {
|
1109 |
personnelGrilleMagazin.addListener(Store.Add, new Listener<StoreEvent<StructureAPersonne>>() {
|
1105 |
|
1110 |
|
1106 |
public void handleEvent(StoreEvent<StructureAPersonne> ce) {
|
1111 |
public void handleEvent(StoreEvent<StructureAPersonne> ce) {
|
Line 1119... |
Line 1124... |
1119 |
GridSelectionModel<StructureAPersonne> sm = new GridSelectionModel<StructureAPersonne>();
|
1124 |
GridSelectionModel<StructureAPersonne> sm = new GridSelectionModel<StructureAPersonne>();
|
1120 |
configs.add(r);
|
1125 |
configs.add(r);
|
Line 1121... |
Line 1126... |
1121 |
|
1126 |
|
1122 |
ColumnConfig column = new ColumnConfig("fonction", "Fonction", 150);
|
1127 |
ColumnConfig column = new ColumnConfig("fonction", "Fonction", 150);
|
1123 |
modele.obtenirListeValeurs(this, ((Configuration) Registry.get(RegistreId.CONFIG)).getListeId("fonction"));
|
1128 |
modele.obtenirListeValeurs(this, ((Configuration) Registry.get(RegistreId.CONFIG)).getListeId("fonction"));
|
1124 |
magazinLiFonction = new ListStore<Valeur>();
|
- |
|
Line 1125... |
Line 1129... |
1125 |
magazinLiFonction.add(new ArrayList<Valeur>());
|
1129 |
fonctionsMagazin = new ListStore<Valeur>();
|
1126 |
|
1130 |
|
1127 |
comboLiFonction = new ComboBox<Valeur>();
|
1131 |
fonctionsCombo = new ComboBox<Valeur>();
|
1128 |
comboLiFonction.setTriggerAction(TriggerAction.ALL);
|
1132 |
fonctionsCombo.setTriggerAction(TriggerAction.ALL);
|
1129 |
comboLiFonction.setEditable(true);
|
1133 |
fonctionsCombo.setEditable(true);
|
Line 1130... |
Line 1134... |
1130 |
comboLiFonction.setDisplayField("nom");
|
1134 |
fonctionsCombo.setDisplayField("nom");
|
1131 |
comboLiFonction.setStore(magazinLiFonction);
|
1135 |
fonctionsCombo.setStore(fonctionsMagazin);
|
1132 |
|
1136 |
|
- |
|
1137 |
fonctionEditor = new CellEditor(fonctionsCombo) {
|
- |
|
1138 |
@Override
|
1133 |
CellEditor fonctionEditor = new CellEditor(comboLiFonction) {
|
1139 |
public Object preProcessValue(Object valeur) {
|
- |
|
1140 |
Valeur retour = null;
|
1134 |
@Override
|
1141 |
|
- |
|
1142 |
if (valeur != null) {
|
1135 |
public Object preProcessValue(Object valeur) {
|
1143 |
String chaineTransmise = (String) valeur;
|
1136 |
if (valeur == null) {
|
1144 |
GWT.log("ici:"+fonctionsMagazin.getCount(), null);
|
1137 |
//GWT.log("pre null :"+this.getValue()+"-"+this.row, null);
|
- |
|
1138 |
return null;
|
- |
|
1139 |
}
|
1145 |
if (fonctionsMagazin.getCount() == 0 && fonctionsListe != null) {
|
1140 |
//GWT.log("pre : "+valeur.toString(), null);
|
1146 |
fonctionsMagazin.add(fonctionsListe);
|
1141 |
Object retour = null;
|
1147 |
}
|
1142 |
if (((String) valeur).matches("^[0-9]+$")) {
|
- |
|
1143 |
Valeur valeurRecherche = comboLiFonction.getStore().findModel("id_valeur", (String) valeur);
|
1148 |
if (fonctionsMagazin.findModel("id_valeur", chaineTransmise) != null) {
|
1144 |
if (valeurRecherche != null) {
|
1149 |
retour = fonctionsMagazin.findModel("id_valeur", chaineTransmise);
|
1145 |
retour = valeurRecherche;
|
1150 |
} else if (fonctionsMagazin.findModel("nom", chaineTransmise) != null) {
|
1146 |
//GWT.log("pre - retour valeur par chiffre : \n"+retour.toString(), null);
|
- |
|
1147 |
} else {
|
1151 |
retour = fonctionsMagazin.findModel("nom", chaineTransmise);
|
1148 |
this.getField().setRawValue((String) valeur);
|
- |
|
1149 |
retour = null;
|
- |
|
1150 |
}
|
- |
|
1151 |
} else if (valeur instanceof String) {
|
- |
|
1152 |
this.getField().setRawValue((String) valeur);
|
- |
|
1153 |
retour = new Valeur("", (String) valeur, "", "");
|
- |
|
1154 |
} else {
|
1152 |
} else {
|
Line 1155... |
Line 1153... |
1155 |
retour = comboLiFonction.getStore().findModel("nom", (String) valeur);
|
1153 |
retour = new Valeur("", chaineTransmise, "", "");
|
1156 |
//GWT.log("pre - retour valeur par chaine : \n"+retour.toString(), null);
|
1154 |
}
|
Line 1157... |
Line 1155... |
1157 |
}
|
1155 |
}
|
1158 |
|
1156 |
|
- |
|
1157 |
return retour;
|
- |
|
1158 |
}
|
- |
|
1159 |
|
1159 |
return retour;
|
1160 |
@Override
|
1160 |
}
|
- |
|
1161 |
|
1161 |
public Object postProcessValue(Object valeur) {
|
1162 |
@Override
|
1162 |
String retour = "";
|
1163 |
public Object postProcessValue(Object valeur) {
|
- |
|
1164 |
if (valeur == null) {
|
- |
|
1165 |
// Si la combobox n'a pas été utilisé, nous renvoyons la valeur brute saisie par l'utilisateur
|
- |
|
1166 |
//GWT.log("post raw : \n"+this.getField().getRawValue(), null);
|
1163 |
Valeur fonctionTrouvee = null;
|
1167 |
String retour = this.getField().getRawValue();
|
1164 |
GWT.log("ICI ", null);
|
1168 |
if (retour.matches("^[0-9]+$")) {
|
- |
|
1169 |
//GWT.log("ici", null);
|
1165 |
if (valeur == null) {
|
- |
|
1166 |
GWT.log(this.getField().getRawValue(), null);
|
1170 |
Valeur valeurRecherche = comboLiFonction.getStore().findModel("id_valeur", (String) retour);
|
1167 |
String valeurBrute = this.getField().getRawValue();
|
1171 |
if (valeurRecherche != null) {
|
1168 |
if (fonctionsMagazin.getCount() == 0 && fonctionsListe != null) {
|
1172 |
retour = valeurRecherche.getNom();
|
- |
|
1173 |
}
|
- |
|
1174 |
}
|
- |
|
1175 |
return retour;
|
1169 |
fonctionsMagazin.add(fonctionsListe);
|
1176 |
} else {
|
- |
|
1177 |
//GWT.log("post : \n"+valeur.toString(), null);
|
1170 |
}
|
1178 |
String nom = "";
|
- |
|
- |
|
1171 |
if (valeurBrute.matches("^[0-9]+$") && fonctionsMagazin.findModel("id_valeur", valeurBrute) != null) {
|
1179 |
if (valeur instanceof Valeur) {
|
1172 |
fonctionTrouvee = fonctionsMagazin.findModel("id_valeur", valeurBrute);
|
1180 |
nom = (((Valeur) valeur).getNom());
|
1173 |
} else {
|
- |
|
1174 |
retour = valeurBrute;
|
- |
|
1175 |
}
|
- |
|
1176 |
} else if (valeur instanceof Valeur) {
|
- |
|
1177 |
fonctionTrouvee = (Valeur) valeur;
|
- |
|
1178 |
}
|
- |
|
1179 |
|
1181 |
//GWT.log("la "+nom, null);
|
1180 |
if (fonctionTrouvee != null) {
|
1182 |
}
|
1181 |
retour = fonctionTrouvee.getNom();
|
1183 |
|
1182 |
}
|
1184 |
return nom;
|
1183 |
|
Line 1273... |
Line 1272... |
1273 |
|
1272 |
|
1274 |
TextToolItem ajouterPersonnelBtn = new TextToolItem("Ajouter", "icone-vcard-ajouter");
|
1273 |
TextToolItem ajouterPersonnelBtn = new TextToolItem("Ajouter", "icone-vcard-ajouter");
|
1275 |
ajouterPersonnelBtn.addSelectionListener(new SelectionListener<ToolBarEvent>() {
|
1274 |
ajouterPersonnelBtn.addSelectionListener(new SelectionListener<ToolBarEvent>() {
|
1276 |
@Override
|
1275 |
@Override
|
1277 |
public void componentSelected(ToolBarEvent ce) {
|
1276 |
public void componentSelected(ToolBarEvent ce) {
|
1278 |
StructureAPersonne personne = new StructureAPersonne("", StructureAPersonne.ROLE_EQUIPE);
|
- |
|
1279 |
personne.set("etat", "A");
|
- |
|
1280 |
grillePersonnel.stopEditing();
|
- |
|
1281 |
int numNouveau = grillePersonnel.getData("nouveau");
|
- |
|
1282 |
grillePersonnel.setData("nouveau", ++numNouveau);
|
1277 |
StructureAPersonne membreDuPersonnel = new StructureAPersonne("", StructureAPersonne.ROLE_EQUIPE, StructureAPersonne.ETAT_AJOUTE);
|
1283 |
personnelGrilleMagazin.insert(personne, 0);
|
- |
|
1284 |
grillePersonnel.startEditing(0, 0);
|
1278 |
ajouterMembreAGrillePersonnel(membreDuPersonnel);
|
1285 |
}
|
1279 |
}
|
1286 |
});
|
1280 |
});
|
Line 1287... |
Line 1281... |
1287 |
toolBar.add(ajouterPersonnelBtn);
|
1281 |
toolBar.add(ajouterPersonnelBtn);
|
Line 1351... |
Line 1345... |
1351 |
ajouterPersonneExistanteBtn.addSelectionListener(new SelectionListener<ToolBarEvent>() {
|
1345 |
ajouterPersonneExistanteBtn.addSelectionListener(new SelectionListener<ToolBarEvent>() {
|
1352 |
@Override
|
1346 |
@Override
|
1353 |
public void componentSelected(ToolBarEvent ce) {
|
1347 |
public void componentSelected(ToolBarEvent ce) {
|
1354 |
Personne personneExistante = personneExistanteCombo.getValue();
|
1348 |
Personne personneExistante = personneExistanteCombo.getValue();
|
Line -... |
Line 1349... |
- |
|
1349 |
|
1355 |
|
1350 |
if (personneExistante != null) {
|
1356 |
StructureAPersonne personne = new StructureAPersonne("", StructureAPersonne.ROLE_EQUIPE);
|
1351 |
StructureAPersonne membreDuPersonnel = new StructureAPersonne("", StructureAPersonne.ROLE_EQUIPE, StructureAPersonne.ETAT_AJOUTE);
|
1357 |
personne.setIdPersonne(personneExistante.getId());
|
- |
|
1358 |
|
- |
|
1359 |
grillePersonnel.stopEditing();
|
- |
|
1360 |
|
- |
|
1361 |
// Ajout au magazin de la grille
|
- |
|
1362 |
int numNouveau = grillePersonnel.getData("nouveau");
|
- |
|
1363 |
grillePersonnel.setData("nouveau", ++numNouveau);
|
- |
|
1364 |
personnelGrilleMagazin.insert(personne, 0);
|
- |
|
1365 |
|
- |
|
1366 |
// Nous modifions l'enregistrement pour que le modèle soit pris en compte lors de la collecte.
|
- |
|
1367 |
Record record = personnelGrilleMagazin.getRecord(personnelGrilleMagazin.getAt(0));
|
- |
|
1368 |
record.beginEdit();
|
1352 |
membreDuPersonnel.setIdPersonne(personneExistante.getId());
|
1369 |
record.set("nom", personneExistante.getNom());
|
1353 |
membreDuPersonnel.setNom(personneExistante.getNom());
|
1370 |
record.set("prenom", personneExistante.getPrenom());
|
1354 |
membreDuPersonnel.setPrenom(personneExistante.getPrenom());
|
1371 |
record.set("telephone", personneExistante.selectionnerTelephone(Personne.TELEPHONE_FIXE));
|
1355 |
membreDuPersonnel.setTelephone(personneExistante.getTelephone());
|
1372 |
record.set("fax", personneExistante.selectionnerFax(1));
|
1356 |
membreDuPersonnel.setFax(personneExistante.getFax());
|
1373 |
record.set("courriel", personneExistante.selectionnerCourriel(1));
|
1357 |
membreDuPersonnel.setCourriel(personneExistante.getCourriel());
|
1374 |
record.set("specialite", personneExistante.afficherSpecialite());
|
- |
|
1375 |
record.set("etat", "A");
|
- |
|
1376 |
record.endEdit();
|
- |
|
1377 |
grillePersonnel.startEditing(0, 0);
|
1358 |
membreDuPersonnel.setSpecialite(personneExistante.getSpecialite());
|
1378 |
|
1359 |
|
1379 |
//GWT.log("Ajout : "+personnelGrilleMagazin.getModifiedRecords()., null);
|
- |
|
- |
|
1360 |
ajouterMembreAGrillePersonnel(membreDuPersonnel);
|
1380 |
GWT.log("ici : "+personnelGrilleMagazin.getModifiedRecords().contains(record), null);
|
1361 |
}
|
1381 |
}
|
1362 |
}
|
1382 |
});
|
1363 |
});
|
Line 1383... |
Line 1364... |
1383 |
toolBar.add(ajouterPersonneExistanteBtn);
|
1364 |
toolBar.add(ajouterPersonneExistanteBtn);
|
Line 1384... |
Line 1365... |
1384 |
|
1365 |
|
Line 1385... |
Line 1366... |
1385 |
cp.setTopComponent(toolBar);
|
1366 |
cp.setTopComponent(toolBar);
|
1386 |
|
- |
|
1387 |
ColumnModel cm = new ColumnModel(configs);
|
1367 |
|
1388 |
|
1368 |
ColumnModel cm = new ColumnModel(configs);
|
1389 |
grillePersonnel = new EditorGrid<StructureAPersonne>(personnelGrilleMagazin, cm);
|
1369 |
|
1390 |
grillePersonnel.setData("nouveau", 0);
|
1370 |
grillePersonnel = new EditorGrid<StructureAPersonne>(personnelGrilleMagazin, cm);
|
1391 |
grillePersonnel.setBorders(true);
|
1371 |
grillePersonnel.setBorders(true);
|
Line 1403... |
Line 1383... |
1403 |
personnelGrilleMagazin.commitChanges();
|
1383 |
personnelGrilleMagazin.commitChanges();
|
1404 |
}
|
1384 |
}
|
Line 1405... |
Line 1385... |
1405 |
|
1385 |
|
Line 1406... |
Line 1386... |
1406 |
});
|
1386 |
});
|
1407 |
|
1387 |
|
1408 |
cp.add(grillePersonnel);
|
1388 |
cp.add(grillePersonnel);
|
1409 |
personnelOnglet.add(cp);
|
1389 |
personnelOnglet.add(cp);
|
1410 |
|
1390 |
|
Line 1411... |
Line 1391... |
1411 |
return personnelOnglet;
|
1391 |
return personnelOnglet;
|
1412 |
}
|
1392 |
}
|
1413 |
|
1393 |
|
1414 |
private TabItem creerOngletIdentification() {
|
1394 |
private TabItem creerOngletIdentification() {
|
1415 |
//+-----------------------------------------------------------------------------------------------------------+
|
1395 |
//+-----------------------------------------------------------------------------------------------------------+
|
1416 |
// Onlget formulaire IDENTIFICATION
|
1396 |
// Onlget formulaire IDENTIFICATION
|
1417 |
identificationOnglet = new TabItem();
|
1397 |
identificationOnglet = new TabItem();
|
- |
|
1398 |
identificationOnglet.setId("identification");
|
1418 |
identificationOnglet.setId("identification");
|
1399 |
identificationOnglet.setText("Identification");
|
1419 |
identificationOnglet.setText("Identification");
|
1400 |
identificationOnglet.setLayout(new FormLayout());
|
1420 |
identificationOnglet.setLayout(new FormLayout());
|
1401 |
identificationOnglet.setScrollMode(Scroll.AUTO);
|
1421 |
identificationOnglet.setData("acces", false);
|
1402 |
identificationOnglet.setData("acces", false);
|
1422 |
identificationOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {
|
1403 |
identificationOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {
|
Line 1873... |
Line 1854... |
1873 |
if (radioBtn.getValue() == true) {
|
1854 |
if (radioBtn.getValue() == true) {
|
1874 |
if (type.equals(valeurPourAfficher)) {
|
1855 |
if (type.equals(valeurPourAfficher)) {
|
1875 |
((Component) composants.get(i)).show();
|
1856 |
((Component) composants.get(i)).show();
|
1876 |
} else {
|
1857 |
} else {
|
1877 |
((Component) composants.get(i)).hide();
|
1858 |
((Component) composants.get(i)).hide();
|
- |
|
1859 |
|
- |
|
1860 |
|
- |
|
1861 |
|
1878 |
}
|
1862 |
}
|
1879 |
}
|
1863 |
}
|
1880 |
// Si on a à faire à un ContentPanel, on l'actualise pour déclencher l'affichage
|
1864 |
// Si on a à faire à un ContentPanel, on l'actualise pour déclencher l'affichage
|
1881 |
if (composants.get(i) instanceof ContentPanel) {
|
1865 |
if (composants.get(i) instanceof ContentPanel) {
|
1882 |
((ContentPanel) composants.get(i)).layout();
|
1866 |
((ContentPanel) composants.get(i)).layout();
|
Line 1909... |
Line 1893... |
1909 |
* @param listeValeurs la liste de valeurs à transformer en case à cocher
|
1893 |
* @param listeValeurs la liste de valeurs à transformer en case à cocher
|
1910 |
* @param boolAutreChp booléen indiquant si oui ou non le champ autre doit apparaître
|
1894 |
* @param boolAutreChp booléen indiquant si oui ou non le champ autre doit apparaître
|
1911 |
* @return
|
1895 |
* @return
|
1912 |
*/
|
1896 |
*/
|
1913 |
private void creerChoixMultipleCac(ContentPanel cp, CheckBoxGroup cacGroupe, ValeurListe listeValeurs, Field<String> autreChp) {
|
1897 |
private void creerChoixMultipleCac(ContentPanel cp, CheckBoxGroup cacGroupe, ValeurListe listeValeurs, Field<String> autreChp) {
|
- |
|
1898 |
cp.addListener(Events.Hide, new Listener<BaseEvent>() {
|
- |
|
1899 |
|
- |
|
1900 |
public void handleEvent(BaseEvent be) {
|
- |
|
1901 |
ContentPanel cp = (ContentPanel) be.source;
|
- |
|
1902 |
List<Component> composants = cp.getItems();
|
- |
|
1903 |
for (Iterator<Component> it = composants.iterator(); it.hasNext();) {
|
- |
|
1904 |
Object composant = it.next();
|
- |
|
1905 |
if (composant instanceof CheckBoxGroup) {
|
- |
|
1906 |
GWT.log("Classe : groupedecac", null);
|
- |
|
1907 |
CheckBoxGroup caseACocherGroupe = (CheckBoxGroup) composant;
|
- |
|
1908 |
caseACocherGroupe.reset();
|
- |
|
1909 |
|
- |
|
1910 |
}
|
- |
|
1911 |
}
|
- |
|
1912 |
}
|
- |
|
1913 |
|
- |
|
1914 |
});
|
1914 |
cacGroupe.setAutoWidth(true);
|
1915 |
cacGroupe.setAutoWidth(true);
|
1915 |
cacGroupe.setData("liste_id", listeValeurs.getId());
|
1916 |
cacGroupe.setData("liste_id", listeValeurs.getId());
|
1916 |
for (Iterator<String> it = listeValeurs.keySet().iterator(); it.hasNext();) {
|
1917 |
for (Iterator<String> it = listeValeurs.keySet().iterator(); it.hasNext();) {
|
1917 |
Valeur val = listeValeurs.get(it.next());
|
1918 |
Valeur val = listeValeurs.get(it.next());
|
1918 |
String nom = val.get("nom");
|
1919 |
String nom = val.get("nom");
|
Line 2050... |
Line 2051... |
2050 |
magazinLiStatut.removeAll();
|
2051 |
magazinLiStatut.removeAll();
|
2051 |
magazinLiStatut.add(liste);
|
2052 |
magazinLiStatut.add(liste);
|
2052 |
comboLiStatut.setStore(magazinLiStatut);
|
2053 |
comboLiStatut.setStore(magazinLiStatut);
|
2053 |
}
|
2054 |
}
|
2054 |
if (listeValeurs.getId().equals(config.getListeId("fonction"))) {
|
2055 |
if (listeValeurs.getId().equals(config.getListeId("fonction"))) {
|
- |
|
2056 |
// FIXME : le store ne contient pas tout le temps les données, chose étrange.
|
- |
|
2057 |
// On stocke donc les données dans une variables de la classe pour recharger le store si besoin.
|
- |
|
2058 |
fonctionsListe = liste;
|
2055 |
magazinLiFonction.removeAll();
|
2059 |
fonctionsMagazin.removeAll();
|
2056 |
magazinLiFonction.add(liste);
|
2060 |
fonctionsMagazin.add(liste);
|
2057 |
comboLiFonction.setStore(magazinLiFonction);
|
2061 |
fonctionsCombo.setStore(fonctionsMagazin);
|
- |
|
2062 |
rafraichirPersonnel();
|
2058 |
}
|
2063 |
}
|
2059 |
if (listeValeurs.getId().equals(config.getListeId("pays"))) {
|
2064 |
if (listeValeurs.getId().equals(config.getListeId("pays"))) {
|
2060 |
magazinPays.removeAll();
|
2065 |
magazinPays.removeAll();
|
2061 |
magazinPays.add(liste);
|
2066 |
magazinPays.add(liste);
|
2062 |
comboPays.setStore(magazinPays);
|
2067 |
comboPays.setStore(magazinPays);
|
Line 2147... |
Line 2152... |
2147 |
GWT.log("rafraichir()", e);
|
2152 |
GWT.log("rafraichir()", e);
|
2148 |
}
|
2153 |
}
|
2149 |
}
|
2154 |
}
|
Line 2150... |
Line 2155... |
2150 |
|
2155 |
|
- |
|
2156 |
private void rafraichirPersonnel() {
|
2151 |
private void rafraichirPersonnel() {
|
2157 |
if (mode.equals(MODE_MODIFIER)) {
|
- |
|
2158 |
initialiserGrillePersonnelEnModifcation();
|
- |
|
2159 |
} else if (mode.equals(MODE_AJOUTER)) {
|
- |
|
2160 |
initialiserGrillePersonnelEnAjout();
|
2152 |
mediateur.selectionnerStructureAPersonne(this, identification.getId(), StructureAPersonne.ROLE_EQUIPE);
|
2161 |
}
|
Line 2153... |
Line 2162... |
2153 |
}
|
2162 |
}
|
2154 |
|
2163 |
|
2155 |
private void rafraichirPersonneExistante(String nom) {
|
2164 |
private void rafraichirPersonneExistante(String nom) {
|
- |
|
2165 |
mediateur.selectionnerPersonneParNomComplet(this, null, nom+"%");
|
- |
|
2166 |
}
|
- |
|
2167 |
|
- |
|
2168 |
private void ajouterMembreAGrillePersonnel(StructureAPersonne personnel) {
|
- |
|
2169 |
grillePersonnel.stopEditing();
|
- |
|
2170 |
personnelGrilleMagazin.insert(new StructureAPersonne(), 0);
|
- |
|
2171 |
|
- |
|
2172 |
// Nous modifions l'enregistrement pour que le modèle soit pris en compte lors de la collecte.
|
- |
|
2173 |
Record record = personnelGrilleMagazin.getRecord(personnelGrilleMagazin.getAt(0));
|
- |
|
2174 |
record.beginEdit();
|
- |
|
2175 |
if (!personnel.getFonction().equals("")) {
|
- |
|
2176 |
Object fonction = fonctionEditor.preProcessValue(personnel.getFonction());
|
- |
|
2177 |
if (fonction != null && fonction instanceof Valeur) {
|
- |
|
2178 |
record.set("fonction", ((Valeur)fonction).getNom());
|
- |
|
2179 |
}
|
- |
|
2180 |
}
|
- |
|
2181 |
if (!personnel.getPrenom().equals("")) {
|
- |
|
2182 |
record.set("prenom", personnel.getPrenom());
|
- |
|
2183 |
}
|
- |
|
2184 |
if (!personnel.getNom().equals("")) {
|
- |
|
2185 |
record.set("nom", personnel.getNom());
|
- |
|
2186 |
}
|
- |
|
2187 |
if (!personnel.getTelephone().equals("")) {
|
- |
|
2188 |
record.set("telephone", personnel.selectionnerTelephone(Personne.TELEPHONE_FIXE));
|
- |
|
2189 |
}
|
- |
|
2190 |
if (!personnel.getFax().equals("")) {
|
- |
|
2191 |
record.set("fax", personnel.selectionnerFax(1));
|
- |
|
2192 |
}
|
- |
|
2193 |
if (!personnel.getCourriel().equals("")) {
|
- |
|
2194 |
record.set("courriel", personnel.selectionnerCourriel(1));
|
- |
|
2195 |
}
|
- |
|
2196 |
if (!personnel.getStatut().equals("")) {
|
- |
|
2197 |
record.set("statut", personnel.getStatut());
|
- |
|
2198 |
}
|
- |
|
2199 |
String tempsDeTravail = personnel.getBotaTravailHebdoTps();
|
- |
|
2200 |
record.set("travail", (tempsDeTravail.matches("^[0-9]+$") ? Integer.parseInt(tempsDeTravail) : 0));
|
- |
|
2201 |
if (!personnel.getSpecialite().equals("")) {
|
- |
|
2202 |
record.set("specialite", personnel.afficherSpecialite());
|
- |
|
2203 |
}
|
- |
|
2204 |
record.set("contact", (personnel.getContact().equals("1") ? true : false));
|
- |
|
2205 |
record.set("etat", personnel.get("etat"));
|
- |
|
2206 |
record.endEdit();
|
- |
|
2207 |
|
- |
|
2208 |
grillePersonnel.startEditing(0, 0);
|
- |
|
2209 |
}
|
- |
|
2210 |
|
- |
|
2211 |
private void initialiserGrillePersonnelEnAjout() {
|
- |
|
2212 |
personnelGrilleMagazin.removeAll();
|
- |
|
2213 |
StructureAPersonne conservateurDesCollections = new StructureAPersonne(StructureAPersonne.FONCTION_CONSERVATEUR, StructureAPersonne.ROLE_EQUIPE, StructureAPersonne.ETAT_AJOUTE);
|
- |
|
2214 |
ajouterMembreAGrillePersonnel(conservateurDesCollections);
|
- |
|
2215 |
StructureAPersonne directeurDuPersonnel = new StructureAPersonne(StructureAPersonne.FONCTION_DIRECTEUR, StructureAPersonne.ROLE_EQUIPE, StructureAPersonne.ETAT_AJOUTE);
|
- |
|
2216 |
ajouterMembreAGrillePersonnel(directeurDuPersonnel);
|
- |
|
2217 |
}
|
- |
|
2218 |
|
- |
|
2219 |
private void initialiserGrillePersonnelEnModifcation() {
|
2156 |
mediateur.selectionnerPersonneParNomComplet(this, null, nom+"%");
|
2220 |
mediateur.selectionnerStructureAPersonne(this, identification.getId(), StructureAPersonne.ROLE_EQUIPE);
|
2157 |
}
|
2221 |
}
|