1 |
package org.tela_botanica.client.vues.projet;
|
1 |
package org.tela_botanica.client.vues.projet;
|
2 |
|
2 |
|
3 |
import java.util.ArrayList;
|
3 |
import java.util.ArrayList;
|
4 |
import java.util.Iterator;
|
4 |
import java.util.Iterator;
|
5 |
|
5 |
|
6 |
import org.tela_botanica.client.ComposantClass;
|
6 |
import org.tela_botanica.client.ComposantClass;
|
7 |
import org.tela_botanica.client.Mediateur;
|
7 |
import org.tela_botanica.client.Mediateur;
|
8 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
8 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
9 |
import org.tela_botanica.client.modeles.Information;
|
9 |
import org.tela_botanica.client.modeles.Information;
|
10 |
import org.tela_botanica.client.modeles.MenuApplicationId;
|
10 |
import org.tela_botanica.client.modeles.MenuApplicationId;
|
11 |
import org.tela_botanica.client.modeles.Valeur;
|
11 |
import org.tela_botanica.client.modeles.Valeur;
|
12 |
import org.tela_botanica.client.modeles.ValeurListe;
|
12 |
import org.tela_botanica.client.modeles.ValeurListe;
|
13 |
import org.tela_botanica.client.modeles.projet.Projet;
|
13 |
import org.tela_botanica.client.modeles.projet.Projet;
|
14 |
import org.tela_botanica.client.util.Debug;
|
14 |
import org.tela_botanica.client.util.Debug;
|
15 |
import org.tela_botanica.client.util.Pattern;
|
15 |
import org.tela_botanica.client.util.Pattern;
|
16 |
import org.tela_botanica.client.util.UtilArray;
|
16 |
import org.tela_botanica.client.util.UtilArray;
|
17 |
import org.tela_botanica.client.util.UtilString;
|
17 |
import org.tela_botanica.client.util.UtilString;
|
18 |
import org.tela_botanica.client.vues.Formulaire;
|
18 |
import org.tela_botanica.client.vues.Formulaire;
|
19 |
|
19 |
|
20 |
import com.extjs.gxt.ui.client.Style.SortDir;
|
20 |
import com.extjs.gxt.ui.client.Style.SortDir;
|
21 |
import com.extjs.gxt.ui.client.event.Events;
|
21 |
import com.extjs.gxt.ui.client.event.Events;
|
22 |
import com.extjs.gxt.ui.client.store.ListStore;
|
22 |
import com.extjs.gxt.ui.client.store.ListStore;
|
23 |
import com.extjs.gxt.ui.client.widget.Info;
|
23 |
import com.extjs.gxt.ui.client.widget.Info;
|
24 |
import com.extjs.gxt.ui.client.widget.MessageBox;
|
24 |
import com.extjs.gxt.ui.client.widget.MessageBox;
|
25 |
import com.extjs.gxt.ui.client.widget.form.CheckBox;
|
25 |
import com.extjs.gxt.ui.client.widget.form.CheckBox;
|
26 |
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
26 |
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
27 |
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
27 |
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
28 |
import com.extjs.gxt.ui.client.widget.form.TextArea;
|
28 |
import com.extjs.gxt.ui.client.widget.form.TextArea;
|
29 |
import com.extjs.gxt.ui.client.widget.form.TextField;
|
29 |
import com.extjs.gxt.ui.client.widget.form.TextField;
|
30 |
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
|
30 |
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
|
31 |
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
31 |
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
32 |
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
32 |
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
33 |
|
33 |
|
34 |
public class ProjetForm extends Formulaire implements Rafraichissable {
|
34 |
public class ProjetForm extends Formulaire implements Rafraichissable {
|
35 |
|
35 |
|
36 |
private Projet projet;
|
36 |
private Projet projet;
|
37 |
|
37 |
|
38 |
private String listeValeurIndexationDureeId = "dureesIndexation";
|
38 |
private String listeValeurIndexationDureeId = "dureesIndexation";
|
39 |
private int listeValeurIndexationDureeInt = 1072;
|
39 |
private int listeValeurIndexationDureeInt = 1072;
|
40 |
private String listeValeurIndexationFrequenceId = "frequencesIndexation";
|
40 |
private String listeValeurIndexationFrequenceId = "frequencesIndexation";
|
41 |
private int listeValeurIndexationFrequenceInt = 1073;
|
41 |
private int listeValeurIndexationFrequenceInt = 1073;
|
42 |
private String listeLanguesId = "langues";
|
42 |
private String listeLanguesId = "langues";
|
43 |
private int listeLanguesInt = 1071;
|
43 |
private int listeLanguesInt = 1071;
|
44 |
|
44 |
|
45 |
private ListStore<Valeur> listeIndexationDuree = null;
|
45 |
private ListStore<Valeur> listeIndexationDuree = null;
|
46 |
private ListStore<Valeur> listeIndexationFrequence = null;
|
46 |
private ListStore<Valeur> listeIndexationFrequence = null;
|
47 |
private ListStore<Valeur> listeLangue = null;
|
47 |
private ListStore<Valeur> listeLangue = null;
|
48 |
|
48 |
|
49 |
private ValeurListe valeurListeIndexationDuree = null;
|
49 |
private ValeurListe valeurListeIndexationDuree = null;
|
50 |
private ValeurListe valeurListeIndexationFrequence = null;
|
50 |
private ValeurListe valeurListeIndexationFrequence = null;
|
51 |
private ValeurListe valeurListeLangue = null;
|
51 |
private ValeurListe valeurListeLangue = null;
|
52 |
|
52 |
|
53 |
private boolean listeIndexationDureeChargee = false;
|
53 |
private boolean listeIndexationDureeChargee = false;
|
54 |
private boolean listeIndexationFrequenceChargee = false;
|
54 |
private boolean listeIndexationFrequenceChargee = false;
|
55 |
private boolean listeLangueChargee = false;
|
55 |
private boolean listeLangueChargee = false;
|
56 |
|
56 |
|
57 |
|
57 |
|
58 |
private FieldSet generalitesFieldset = null;
|
58 |
private FieldSet generalitesFieldset = null;
|
59 |
private TextField<String> nomChp = null;
|
59 |
private TextField<String> nomChp = null;
|
60 |
private TextField<String> abreviationChp = null;
|
60 |
private TextField<String> abreviationChp = null;
|
61 |
private TextArea descriptionChp = null;
|
61 |
private TextArea descriptionChp = null;
|
62 |
private TextArea resumeChp = null;
|
62 |
private TextArea resumeChp = null;
|
63 |
private TextField<String> urlChp = null;
|
63 |
private TextField<String> urlChp = null;
|
64 |
|
64 |
|
65 |
private FieldSet complementFieldset = null;
|
65 |
private FieldSet complementFieldset = null;
|
66 |
private TextField<String> motsClesChp = null;
|
66 |
private TextField<String> motsClesChp = null;
|
67 |
private TextField<String> citationChp = null;
|
67 |
private TextField<String> citationChp = null;
|
68 |
private TextField<String> licenceChp = null;
|
68 |
private TextField<String> licenceChp = null;
|
69 |
private ComboBox<Valeur> langueChp = null;
|
69 |
private ComboBox<Valeur> langueChp = null;
|
70 |
private CheckBox markPublicChp = null;
|
70 |
private CheckBox markPublicChp = null;
|
71 |
|
71 |
|
72 |
private FieldSet indexationFieldset = null;
|
72 |
private FieldSet indexationFieldset = null;
|
73 |
private TextField<String> indexationHeureChp = null;
|
73 |
private TextField<String> indexationHeureChp = null;
|
74 |
private ComboBox<Valeur> indexationDureeChp = null;
|
74 |
private ComboBox<Valeur> indexationDureeChp = null;
|
75 |
private ComboBox<Valeur> indexationFrequenceChp = null;
|
75 |
private ComboBox<Valeur> indexationFrequenceChp = null;
|
76 |
|
76 |
|
77 |
private boolean formulaireValideOk = false;
|
77 |
private boolean formulaireValideOk = false;
|
78 |
private boolean projetValideOk = false;
|
78 |
private boolean projetValideOk = false;
|
79 |
|
79 |
|
80 |
private Rafraichissable vueExterneARafraichirApresValidation = null;
|
80 |
private Rafraichissable vueExterneARafraichirApresValidation = null;
|
81 |
|
81 |
|
82 |
|
82 |
|
83 |
public ProjetForm(Mediateur mediateurCourrant, String projetId) {
|
83 |
public ProjetForm(Mediateur mediateurCourrant, String projetId) {
|
84 |
initialiserProjetForm(mediateurCourrant, projetId);
|
84 |
initialiserProjetForm(mediateurCourrant, projetId);
|
85 |
}
|
85 |
}
|
86 |
|
86 |
|
87 |
public ProjetForm(Mediateur mediateurCourrant, String projetId, Rafraichissable vueARafraichirApresValidation) {
|
87 |
public ProjetForm(Mediateur mediateurCourrant, String projetId, Rafraichissable vueARafraichirApresValidation) {
|
88 |
vueExterneARafraichirApresValidation = vueARafraichirApresValidation;
|
88 |
vueExterneARafraichirApresValidation = vueARafraichirApresValidation;
|
89 |
initialiserProjetForm(mediateurCourrant, projetId);
|
89 |
initialiserProjetForm(mediateurCourrant, projetId);
|
90 |
}
|
90 |
}
|
91 |
|
91 |
|
92 |
private void initialiserProjetForm(Mediateur mediateurCourant, String projetId) {
|
92 |
private void initialiserProjetForm(Mediateur mediateurCourant, String projetId) {
|
93 |
projet = new Projet();
|
93 |
projet = new Projet();
|
94 |
projet.setId(projetId);
|
94 |
projet.setId(projetId);
|
95 |
|
95 |
|
96 |
String modeDeCreation = (projet.getId().isEmpty() ? Formulaire.MODE_AJOUTER : Formulaire.MODE_MODIFIER);
|
96 |
String modeDeCreation = (projet.getId().isEmpty() ? Formulaire.MODE_AJOUTER : Formulaire.MODE_MODIFIER);
|
97 |
initialiserFormulaire(mediateurCourant, modeDeCreation, MenuApplicationId.PROJET);
|
97 |
initialiserFormulaire(mediateurCourant, modeDeCreation, MenuApplicationId.PROJET);
|
98 |
|
98 |
|
99 |
panneauFormulaire.setLayout(new FlowLayout());
|
99 |
panneauFormulaire.setLayout(new FlowLayout());
|
100 |
genererTitreFormulaire();
|
100 |
genererTitreFormulaire();
|
101 |
|
101 |
|
102 |
creerZoneGeneralites();
|
102 |
creerZoneGeneralites();
|
103 |
panneauFormulaire.add(generalitesFieldset);
|
103 |
panneauFormulaire.add(generalitesFieldset);
|
104 |
|
104 |
|
105 |
creerZoneComplement();
|
105 |
creerZoneComplement();
|
106 |
panneauFormulaire.add(complementFieldset);
|
106 |
panneauFormulaire.add(complementFieldset);
|
107 |
|
107 |
|
108 |
creerZoneIndexation();
|
108 |
creerZoneIndexation();
|
109 |
panneauFormulaire.add(indexationFieldset);
|
109 |
panneauFormulaire.add(indexationFieldset);
|
110 |
|
110 |
|
111 |
creerTabIndex();
|
111 |
creerTabIndex();
|
112 |
|
112 |
|
113 |
if (modeDeCreation.equals(Formulaire.MODE_MODIFIER)) {
|
113 |
if (modeDeCreation.equals(Formulaire.MODE_MODIFIER)) {
|
114 |
mediateur.selectionnerProjet(this, projetId);
|
114 |
mediateur.selectionnerProjet(this, projetId);
|
115 |
}
|
115 |
}
|
116 |
|
116 |
|
117 |
mediateur.obtenirListeValeurEtRafraichir(this, listeValeurIndexationDureeId);
|
117 |
mediateur.obtenirListeValeurEtRafraichir(this, listeValeurIndexationDureeId);
|
118 |
mediateur.obtenirListeValeurEtRafraichir(this, listeValeurIndexationFrequenceId);
|
118 |
mediateur.obtenirListeValeurEtRafraichir(this, listeValeurIndexationFrequenceId);
|
119 |
mediateur.obtenirListeValeurEtRafraichir(this, listeLanguesId);
|
119 |
mediateur.obtenirListeValeurEtRafraichir(this, listeLanguesId);
|
120 |
}
|
120 |
}
|
121 |
|
121 |
|
122 |
private void genererTitreFormulaire() {
|
122 |
private void genererTitreFormulaire() {
|
123 |
String titre = i18nC.projetTitreFormAjout();
|
123 |
String titre = i18nC.projetTitreFormAjout();
|
124 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
124 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
125 |
titre = i18nC.projetTitreFormModif();
|
125 |
titre = i18nC.projetTitreFormModif();
|
126 |
if (projet != null) {
|
126 |
if (projet != null) {
|
127 |
titre += " - "+i18nC.id()+": "+projet.getId();
|
127 |
titre += " - "+i18nC.id()+": "+projet.getId();
|
128 |
}
|
128 |
}
|
129 |
}
|
129 |
}
|
130 |
panneauFormulaire.setHeading(titre);
|
130 |
panneauFormulaire.setHeading(titre);
|
131 |
}
|
131 |
}
|
132 |
|
132 |
|
133 |
private void creerZoneGeneralites() {
|
133 |
private void creerZoneGeneralites() {
|
134 |
FormLayout layout = new FormLayout();
|
134 |
FormLayout layout = new FormLayout();
|
135 |
layout.setLabelWidth(100);
|
135 |
layout.setLabelWidth(100);
|
136 |
|
136 |
|
137 |
// Fieldset Infos Générales
|
137 |
// Fieldset Infos Générales
|
138 |
generalitesFieldset = new FieldSet();
|
138 |
generalitesFieldset = new FieldSet();
|
139 |
generalitesFieldset.setHeading(i18nC.projetTitreInfoGenerale());
|
139 |
generalitesFieldset.setHeading(i18nC.projetTitreInfoGenerale());
|
140 |
generalitesFieldset.setCollapsible(true);
|
140 |
generalitesFieldset.setCollapsible(true);
|
141 |
generalitesFieldset.setLayout(layout);
|
141 |
generalitesFieldset.setLayout(layout);
|
142 |
|
142 |
|
143 |
nomChp = new TextField<String>();
|
143 |
nomChp = new TextField<String>();
|
144 |
nomChp.setName("cpu");
|
144 |
nomChp.setName("cpu");
|
145 |
nomChp.setFieldLabel("Nom");
|
145 |
nomChp.setFieldLabel("Nom");
|
146 |
nomChp.addStyleName(ComposantClass.OBLIGATOIRE);
|
146 |
nomChp.addStyleName(ComposantClass.OBLIGATOIRE);
|
147 |
nomChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
|
147 |
nomChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
|
148 |
generalitesFieldset.add(nomChp, new FormData(450, 0));
|
148 |
generalitesFieldset.add(nomChp, new FormData(450, 0));
|
149 |
|
149 |
|
150 |
abreviationChp = new TextField<String>();
|
150 |
abreviationChp = new TextField<String>();
|
151 |
abreviationChp.setFieldLabel("Abréviation");
|
151 |
abreviationChp.setFieldLabel("Abréviation");
|
152 |
abreviationChp.addStyleName(ComposantClass.OBLIGATOIRE);
|
152 |
abreviationChp.addStyleName(ComposantClass.OBLIGATOIRE);
|
153 |
abreviationChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
|
153 |
abreviationChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
|
154 |
generalitesFieldset.add(abreviationChp, new FormData(450, 0));
|
154 |
generalitesFieldset.add(abreviationChp, new FormData(450, 0));
|
155 |
|
155 |
|
156 |
descriptionChp = new TextArea();
|
156 |
descriptionChp = new TextArea();
|
157 |
descriptionChp.setFieldLabel("Description");
|
157 |
descriptionChp.setFieldLabel("Description");
|
158 |
descriptionChp.addStyleName(ComposantClass.OBLIGATOIRE);
|
158 |
descriptionChp.addStyleName(ComposantClass.OBLIGATOIRE);
|
159 |
descriptionChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
|
159 |
descriptionChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
|
160 |
generalitesFieldset.add(descriptionChp, new FormData(450, 0));
|
160 |
generalitesFieldset.add(descriptionChp, new FormData(450, 0));
|
161 |
|
161 |
|
162 |
resumeChp = new TextArea();
|
162 |
resumeChp = new TextArea();
|
163 |
resumeChp.setFieldLabel("Résumé");
|
163 |
resumeChp.setFieldLabel("Résumé");
|
164 |
resumeChp.addStyleName(ComposantClass.OBLIGATOIRE);
|
164 |
resumeChp.addStyleName(ComposantClass.OBLIGATOIRE);
|
165 |
resumeChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
|
165 |
resumeChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
|
166 |
generalitesFieldset.add(resumeChp, new FormData(450, 0));
|
166 |
generalitesFieldset.add(resumeChp, new FormData(450, 0));
|
167 |
|
167 |
|
168 |
urlChp = new TextField<String>();
|
168 |
urlChp = new TextField<String>();
|
169 |
urlChp.setFieldLabel("URL du projet");
|
169 |
urlChp.setFieldLabel("URL du projet");
|
170 |
generalitesFieldset.add(urlChp, new FormData(450, 0));
|
170 |
generalitesFieldset.add(urlChp, new FormData(450, 0));
|
171 |
}
|
171 |
}
|
172 |
|
172 |
|
173 |
private void creerZoneComplement() {
|
173 |
private void creerZoneComplement() {
|
174 |
FormLayout layout = new FormLayout();
|
174 |
FormLayout layout = new FormLayout();
|
175 |
layout.setLabelWidth(100);
|
175 |
layout.setLabelWidth(100);
|
176 |
|
176 |
|
177 |
// Fieldset Complément
|
177 |
// Fieldset Complément
|
178 |
complementFieldset = new FieldSet();
|
178 |
complementFieldset = new FieldSet();
|
179 |
complementFieldset.setHeading(i18nC.projetTitreComplement());
|
179 |
complementFieldset.setHeading(i18nC.projetTitreComplement());
|
180 |
complementFieldset.setCollapsible(true);
|
180 |
complementFieldset.setCollapsible(true);
|
181 |
complementFieldset.setLayout(layout);
|
181 |
complementFieldset.setLayout(layout);
|
182 |
|
182 |
|
183 |
motsClesChp = new TextField<String>();
|
183 |
motsClesChp = new TextField<String>();
|
184 |
motsClesChp.setFieldLabel("Mots Clés");
|
184 |
motsClesChp.setFieldLabel("Mots Clés");
|
185 |
complementFieldset.add(motsClesChp);
|
185 |
complementFieldset.add(motsClesChp);
|
186 |
|
186 |
|
187 |
citationChp = new TextField<String>();
|
187 |
citationChp = new TextField<String>();
|
188 |
citationChp.setFieldLabel("Citation");
|
188 |
citationChp.setFieldLabel("Citation");
|
189 |
complementFieldset.add(citationChp);
|
189 |
complementFieldset.add(citationChp);
|
190 |
|
190 |
|
191 |
licenceChp = new TextField<String>();
|
191 |
licenceChp = new TextField<String>();
|
192 |
licenceChp.setFieldLabel("Licence");
|
192 |
licenceChp.setFieldLabel("Licence");
|
193 |
complementFieldset.add(licenceChp);
|
193 |
complementFieldset.add(licenceChp);
|
194 |
|
194 |
|
195 |
listeLangue = new ListStore<Valeur>();
|
195 |
listeLangue = new ListStore<Valeur>();
|
196 |
langueChp = new ComboBox<Valeur>();
|
196 |
langueChp = new ComboBox<Valeur>();
|
197 |
langueChp.setStore(listeLangue);
|
197 |
langueChp.setStore(listeLangue);
|
198 |
langueChp.setDisplayField("nom");
|
198 |
langueChp.setDisplayField("nom");
|
199 |
langueChp.setEditable(true);
|
199 |
langueChp.setEditable(true);
|
200 |
langueChp.setForceSelection(true);
|
200 |
langueChp.setForceSelection(true);
|
201 |
langueChp.setTypeAhead(true);
|
201 |
langueChp.setTypeAhead(true);
|
202 |
langueChp.setFieldLabel("Langue");
|
202 |
langueChp.setFieldLabel("Langue");
|
203 |
complementFieldset.add(langueChp);
|
203 |
complementFieldset.add(langueChp);
|
204 |
|
204 |
|
205 |
markPublicChp = new CheckBox();
|
205 |
markPublicChp = new CheckBox();
|
206 |
markPublicChp.setFieldLabel("Public");
|
206 |
markPublicChp.setFieldLabel("Public");
|
207 |
complementFieldset.add(markPublicChp);
|
207 |
complementFieldset.add(markPublicChp);
|
208 |
}
|
208 |
}
|
209 |
|
209 |
|
210 |
private void creerZoneIndexation() {
|
210 |
private void creerZoneIndexation() {
|
211 |
FormLayout layout = new FormLayout();
|
211 |
FormLayout layout = new FormLayout();
|
212 |
layout.setLabelWidth(100);
|
212 |
layout.setLabelWidth(100);
|
213 |
|
213 |
|
214 |
// Fieldset Indexation
|
214 |
// Fieldset Indexation
|
215 |
indexationFieldset = new FieldSet();
|
215 |
indexationFieldset = new FieldSet();
|
216 |
indexationFieldset.setHeading(i18nC.projetTitreIndexation());
|
216 |
indexationFieldset.setHeading(i18nC.projetTitreIndexation());
|
217 |
indexationFieldset.setCollapsible(true);
|
217 |
indexationFieldset.setCollapsible(true);
|
218 |
indexationFieldset.setLayout(layout);
|
218 |
indexationFieldset.setLayout(layout);
|
219 |
|
219 |
|
220 |
indexationHeureChp = new TextField<String>();
|
220 |
indexationHeureChp = new TextField<String>();
|
221 |
indexationHeureChp.setFieldLabel(i18nC.projetIndexationHeure());
|
221 |
indexationHeureChp.setFieldLabel(i18nC.projetIndexationHeure());
|
222 |
indexationFieldset.add(indexationHeureChp, new FormData(80, 0));
|
222 |
indexationFieldset.add(indexationHeureChp, new FormData(80, 0));
|
223 |
|
223 |
|
224 |
// liste 1073
|
224 |
// liste 1073
|
225 |
listeIndexationFrequence = new ListStore<Valeur>();
|
225 |
listeIndexationFrequence = new ListStore<Valeur>();
|
226 |
indexationFrequenceChp = new ComboBox<Valeur>();
|
226 |
indexationFrequenceChp = new ComboBox<Valeur>();
|
227 |
indexationFrequenceChp.setStore(listeIndexationFrequence);
|
227 |
indexationFrequenceChp.setStore(listeIndexationFrequence);
|
228 |
indexationFrequenceChp.setDisplayField("nom");
|
228 |
indexationFrequenceChp.setDisplayField("nom");
|
229 |
indexationFrequenceChp.setEditable(true);
|
229 |
indexationFrequenceChp.setEditable(true);
|
230 |
indexationFrequenceChp.setForceSelection(true);
|
230 |
indexationFrequenceChp.setForceSelection(true);
|
231 |
indexationFrequenceChp.setTypeAhead(true);
|
231 |
indexationFrequenceChp.setTypeAhead(true);
|
232 |
indexationFrequenceChp.setFieldLabel(i18nC.projetIndexationFrequence());
|
232 |
indexationFrequenceChp.setFieldLabel(i18nC.projetIndexationFrequence());
|
233 |
indexationFieldset.add(indexationFrequenceChp, new FormData(120, 0));
|
233 |
indexationFieldset.add(indexationFrequenceChp, new FormData(120, 0));
|
234 |
|
234 |
|
235 |
// liste 1072
|
235 |
// liste 1072
|
236 |
listeIndexationDuree = new ListStore<Valeur>();
|
236 |
listeIndexationDuree = new ListStore<Valeur>();
|
237 |
indexationDureeChp = new ComboBox<Valeur>();
|
237 |
indexationDureeChp = new ComboBox<Valeur>();
|
238 |
indexationDureeChp.setStore(listeIndexationDuree);
|
238 |
indexationDureeChp.setStore(listeIndexationDuree);
|
239 |
indexationDureeChp.setDisplayField("nom");
|
239 |
indexationDureeChp.setDisplayField("nom");
|
240 |
indexationDureeChp.setEditable(true);
|
240 |
indexationDureeChp.setEditable(true);
|
241 |
indexationDureeChp.setForceSelection(true);
|
241 |
indexationDureeChp.setForceSelection(true);
|
242 |
indexationDureeChp.setTypeAhead(true);
|
242 |
indexationDureeChp.setTypeAhead(true);
|
243 |
indexationDureeChp.setFieldLabel(i18nC.projetIndexationDuree());
|
243 |
indexationDureeChp.setFieldLabel(i18nC.projetIndexationDuree());
|
244 |
indexationFieldset.add(indexationDureeChp, new FormData(80, 0));
|
244 |
indexationFieldset.add(indexationDureeChp, new FormData(80, 0));
|
245 |
|
245 |
|
246 |
}
|
246 |
}
|
247 |
|
247 |
|
248 |
private void creerTabIndex() {
|
248 |
private void creerTabIndex() {
|
249 |
nomChp.setTabIndex(1);
|
249 |
nomChp.setTabIndex(1);
|
250 |
abreviationChp.setTabIndex(2);
|
250 |
abreviationChp.setTabIndex(2);
|
251 |
descriptionChp.setTabIndex(3);
|
251 |
descriptionChp.setTabIndex(3);
|
252 |
resumeChp.setTabIndex(4);
|
252 |
resumeChp.setTabIndex(4);
|
253 |
urlChp.setTabIndex(5);
|
253 |
urlChp.setTabIndex(5);
|
254 |
|
254 |
|
255 |
motsClesChp.setTabIndex(6);
|
255 |
motsClesChp.setTabIndex(6);
|
256 |
citationChp.setTabIndex(7);
|
256 |
citationChp.setTabIndex(7);
|
257 |
licenceChp.setTabIndex(8);
|
257 |
licenceChp.setTabIndex(8);
|
258 |
langueChp.setTabIndex(9);
|
258 |
langueChp.setTabIndex(9);
|
259 |
markPublicChp.setTabIndex(10);
|
259 |
markPublicChp.setTabIndex(10);
|
260 |
|
260 |
|
261 |
indexationHeureChp.setTabIndex(11);
|
261 |
indexationHeureChp.setTabIndex(11);
|
262 |
indexationFrequenceChp.setTabIndex(12);
|
262 |
indexationFrequenceChp.setTabIndex(12);
|
263 |
indexationDureeChp.setTabIndex(13);
|
263 |
indexationDureeChp.setTabIndex(13);
|
264 |
|
264 |
|
265 |
nomChp.focus();
|
265 |
nomChp.focus();
|
266 |
}
|
266 |
}
|
267 |
|
267 |
|
268 |
public void rafraichir(Object nouvellesDonnees) {
|
268 |
public void rafraichir(Object nouvellesDonnees) {
|
269 |
if (nouvellesDonnees instanceof Information) {
|
269 |
if (nouvellesDonnees instanceof Information) {
|
270 |
Information info = (Information) nouvellesDonnees;
|
270 |
Information info = (Information) nouvellesDonnees;
|
271 |
rafraichirInformation(info);
|
271 |
rafraichirInformation(info);
|
272 |
} else if (nouvellesDonnees instanceof ValeurListe) {
|
272 |
} else if (nouvellesDonnees instanceof ValeurListe) {
|
273 |
ValeurListe valeursListe = (ValeurListe) nouvellesDonnees;
|
273 |
ValeurListe valeursListe = (ValeurListe) nouvellesDonnees;
|
274 |
rafraichirValeurListe(valeursListe);
|
274 |
rafraichirValeurListe(valeursListe);
|
275 |
}
|
275 |
}
|
276 |
|
276 |
|
277 |
if (etreValide()) {
|
277 |
if (etreValide()) {
|
278 |
initialiserValidation();
|
278 |
initialiserValidation();
|
279 |
repandreRafraichissement();
|
279 |
repandreRafraichissement();
|
280 |
controlerFermetureApresRafraichissement();
|
280 |
controlerFermetureApresRafraichissement();
|
281 |
}
|
281 |
}
|
282 |
}
|
282 |
}
|
283 |
|
283 |
|
284 |
private void rafraichirInformation(Information info) {
|
284 |
private void rafraichirInformation(Information info) {
|
285 |
final String type = info.getType();
|
285 |
final String type = info.getType();
|
286 |
|
286 |
|
287 |
// Gestion des problèmes
|
287 |
// Gestion des problèmes
|
288 |
if (info.getMessages() != null && !info.getMessages().toString().equals("[]")) {
|
288 |
if (info.getMessages() != null && !info.getMessages().toString().equals("[]")) {
|
289 |
Debug.log("MESSAGES:\n"+info.getMessages().toString());
|
289 |
Debug.log("MESSAGES:\n"+info.getMessages().toString());
|
290 |
}
|
290 |
}
|
291 |
|
291 |
|
292 |
// Gestion des actions
|
292 |
// Gestion des actions
|
293 |
if (type.equals("selection_projet")) {
|
293 |
if (type.equals("selection_projet")) {
|
294 |
if (info.getDonnee(0) != null) {
|
294 |
if (info.getDonnee(0) != null) {
|
295 |
projet = (Projet) info.getDonnee(0);
|
295 |
projet = (Projet) info.getDonnee(0);
|
296 |
}
|
296 |
}
|
297 |
peuplerFormulaire();
|
297 |
peuplerFormulaire();
|
298 |
genererTitreFormulaire();
|
298 |
genererTitreFormulaire();
|
- |
|
299 |
}
|
299 |
} else if (type.equals("ajout_projet") ) {
|
300 |
if (type.equals("ajout_projet") || type.equals("modif_projet")) {
|
300 |
if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String) {
|
301 |
if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String) {
|
301 |
projetValideOk = true;
|
302 |
projetValideOk = true;
|
302 |
String projetId = (String) info.getDonnee(0);
|
303 |
String projetId = (String) info.getDonnee(0);
|
303 |
if (vueExterneARafraichirApresValidation != null) {
|
304 |
if (vueExterneARafraichirApresValidation != null) {
|
304 |
projet.setId(projetId);
|
305 |
projet.setId(projetId);
|
305 |
}
|
306 |
}
|
306 |
}
|
307 |
}
|
307 |
}
|
308 |
}
|
308 |
|
309 |
|
309 |
// Gestion des messages
|
310 |
// Gestion des messages
|
310 |
if (type.equals("selection_projet")) {
|
311 |
if (type.equals("selection_projet")) {
|
311 |
Info.display(i18nC.projetTitreFormModif(), info.toString());
|
312 |
Info.display(i18nC.projetTitreFormModif(), info.toString());
|
312 |
} else if (type.equals("modif_projet")) {
|
313 |
} else if (type.equals("modif_projet")) {
|
313 |
Info.display(i18nC.projetTitreFormModif(), info.toString());
|
314 |
Info.display(i18nC.projetTitreFormModif(), info.toString());
|
314 |
} else if (type.equals("ajout_projet")) {
|
315 |
} else if (type.equals("ajout_projet")) {
|
315 |
if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String) {
|
316 |
if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String) {
|
316 |
String projetId = (String) info.getDonnee(0);
|
317 |
String projetId = (String) info.getDonnee(0);
|
317 |
Info.display(i18nC.projetTitreFormAjout(), "Le projet '"+projetId+"' a bien été ajouté");
|
318 |
Info.display(i18nC.projetTitreFormAjout(), "Le projet '"+projetId+"' a bien été ajouté");
|
318 |
} else {
|
319 |
} else {
|
319 |
Info.display(i18nC.projetTitreFormAjout(), info.toString());
|
320 |
Info.display(i18nC.projetTitreFormAjout(), info.toString());
|
320 |
}
|
321 |
}
|
321 |
}
|
322 |
}
|
322 |
}
|
323 |
}
|
323 |
|
324 |
|
324 |
private void rafraichirValeurListe(ValeurListe valeursListe) {
|
325 |
private void rafraichirValeurListe(ValeurListe valeursListe) {
|
325 |
if (valeursListe.getId() == listeValeurIndexationDureeInt) {
|
326 |
if (valeursListe.getId() == listeValeurIndexationDureeInt) {
|
326 |
valeurListeIndexationDuree = valeursListe;
|
327 |
valeurListeIndexationDuree = valeursListe;
|
327 |
for (Iterator<String> it = valeursListe.keySet().iterator(); it.hasNext();) {
|
328 |
for (Iterator<String> it = valeursListe.keySet().iterator(); it.hasNext();) {
|
328 |
listeIndexationDuree.add(valeursListe.get(it.next()));
|
329 |
listeIndexationDuree.add(valeursListe.get(it.next()));
|
329 |
listeIndexationDuree.sort("id_valeur", SortDir.ASC);
|
330 |
listeIndexationDuree.sort("id_valeur", SortDir.ASC);
|
330 |
}
|
331 |
}
|
331 |
listeIndexationDureeChargee = true;
|
332 |
listeIndexationDureeChargee = true;
|
332 |
|
333 |
|
333 |
if (mode.equals(MODE_MODIFIER)) {
|
334 |
if (mode.equals(MODE_MODIFIER)) {
|
334 |
if (valeurListeIndexationDuree.get(projet.getIndexationDuree()) != null) {
|
335 |
if (valeurListeIndexationDuree.get(projet.getIndexationDuree()) != null) {
|
335 |
indexationDureeChp.setValue(valeurListeIndexationDuree.get(projet.getIndexationDuree()));
|
336 |
indexationDureeChp.setValue(valeurListeIndexationDuree.get(projet.getIndexationDuree()));
|
336 |
indexationDureeChp.validate();
|
337 |
indexationDureeChp.validate();
|
337 |
}
|
338 |
}
|
338 |
}
|
339 |
}
|
339 |
indexationDureeChp.expand();
|
340 |
indexationDureeChp.expand();
|
340 |
} else if (valeursListe.getId() == listeValeurIndexationFrequenceInt) {
|
341 |
} else if (valeursListe.getId() == listeValeurIndexationFrequenceInt) {
|
341 |
valeurListeIndexationFrequence = valeursListe;
|
342 |
valeurListeIndexationFrequence = valeursListe;
|
342 |
for (Iterator<String> it = valeursListe.keySet().iterator(); it.hasNext();) {
|
343 |
for (Iterator<String> it = valeursListe.keySet().iterator(); it.hasNext();) {
|
343 |
listeIndexationFrequence.add(valeursListe.get(it.next()));
|
344 |
listeIndexationFrequence.add(valeursListe.get(it.next()));
|
344 |
listeIndexationFrequence.sort("id_valeur", SortDir.ASC);
|
345 |
listeIndexationFrequence.sort("id_valeur", SortDir.ASC);
|
345 |
}
|
346 |
}
|
346 |
listeIndexationFrequenceChargee = true;
|
347 |
listeIndexationFrequenceChargee = true;
|
347 |
|
348 |
|
348 |
if (mode.equals(MODE_MODIFIER)) {
|
349 |
if (mode.equals(MODE_MODIFIER)) {
|
349 |
if (valeurListeIndexationFrequence.get(projet.getIndexationFreq()) != null) {
|
350 |
if (valeurListeIndexationFrequence.get(projet.getIndexationFreq()) != null) {
|
350 |
indexationFrequenceChp.setValue(valeurListeIndexationFrequence.get(projet.getIndexationFreq()));
|
351 |
indexationFrequenceChp.setValue(valeurListeIndexationFrequence.get(projet.getIndexationFreq()));
|
351 |
indexationFrequenceChp.validate();
|
352 |
indexationFrequenceChp.validate();
|
352 |
}
|
353 |
}
|
353 |
}
|
354 |
}
|
354 |
indexationFrequenceChp.expand();
|
355 |
indexationFrequenceChp.expand();
|
355 |
} else if (valeursListe.getId() == listeLanguesInt) {
|
356 |
} else if (valeursListe.getId() == listeLanguesInt) {
|
356 |
valeurListeLangue = valeursListe;
|
357 |
valeurListeLangue = valeursListe;
|
357 |
for (Iterator<String> it = valeursListe.keySet().iterator(); it.hasNext();) {
|
358 |
for (Iterator<String> it = valeursListe.keySet().iterator(); it.hasNext();) {
|
358 |
listeLangue.add(valeursListe.get(it.next()));
|
359 |
listeLangue.add(valeursListe.get(it.next()));
|
359 |
listeLangue.sort("id_valeur", SortDir.ASC);
|
360 |
listeLangue.sort("id_valeur", SortDir.ASC);
|
360 |
}
|
361 |
}
|
361 |
listeLangueChargee = true;
|
362 |
listeLangueChargee = true;
|
362 |
|
363 |
|
363 |
if (mode.equals(MODE_MODIFIER)) {
|
364 |
if (mode.equals(MODE_MODIFIER)) {
|
364 |
if (valeurListeLangue.get(projet.getLangue()) != null) {
|
365 |
if (valeurListeLangue.get(projet.getLangue()) != null) {
|
365 |
langueChp.setValue(valeurListeLangue.get(projet.getLangue()));
|
366 |
langueChp.setValue(valeurListeLangue.get(projet.getLangue()));
|
366 |
langueChp.validate();
|
367 |
langueChp.validate();
|
367 |
}
|
368 |
}
|
368 |
}
|
369 |
}
|
369 |
}
|
370 |
}
|
370 |
}
|
371 |
}
|
371 |
|
372 |
|
372 |
private Boolean etreValide() {
|
373 |
private Boolean etreValide() {
|
373 |
Boolean valide = false;
|
374 |
Boolean valide = false;
|
374 |
if (formulaireValideOk && projetValideOk) {
|
375 |
if (formulaireValideOk && projetValideOk) {
|
375 |
valide = true;
|
376 |
valide = true;
|
376 |
}
|
377 |
}
|
377 |
return valide;
|
378 |
return valide;
|
378 |
}
|
379 |
}
|
379 |
|
380 |
|
380 |
private void initialiserValidation() {
|
381 |
private void initialiserValidation() {
|
381 |
formulaireValideOk = false;
|
382 |
formulaireValideOk = false;
|
382 |
projetValideOk = false;
|
383 |
projetValideOk = false;
|
383 |
}
|
384 |
}
|
384 |
|
385 |
|
385 |
private void repandreRafraichissement() {
|
386 |
private void repandreRafraichissement() {
|
386 |
if (vueExterneARafraichirApresValidation != null) {
|
387 |
if (vueExterneARafraichirApresValidation != null) {
|
387 |
String type = "projet_modifie";
|
388 |
String type = "projet_modifie";
|
388 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
389 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
389 |
type = "projet_ajoute";
|
390 |
type = "projet_ajoute";
|
390 |
}
|
391 |
}
|
391 |
Information info = new Information(type);
|
392 |
Information info = new Information(type);
|
392 |
info.setDonnee(0, projet);
|
393 |
info.setDonnee(0, projet);
|
393 |
vueExterneARafraichirApresValidation.rafraichir(info);
|
394 |
vueExterneARafraichirApresValidation.rafraichir(info);
|
394 |
}
|
395 |
}
|
395 |
}
|
396 |
}
|
396 |
|
397 |
|
397 |
public boolean soumettreFormulaire() {
|
398 |
public boolean soumettreFormulaire() {
|
398 |
formulaireValideOk = verifierFormulaire();
|
399 |
formulaireValideOk = verifierFormulaire();
|
399 |
if (formulaireValideOk) {
|
400 |
if (formulaireValideOk) {
|
400 |
Projet projetCollecte = collecterProjet();
|
401 |
Projet projetCollecte = collecterProjet();
|
401 |
if (projetCollecte != null) {
|
402 |
if (projetCollecte != null) {
|
402 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
403 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
403 |
mediateur.ajouterProjet(this, projetCollecte);
|
404 |
mediateur.ajouterProjet(this, projetCollecte);
|
404 |
} else if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
405 |
} else if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
405 |
mediateur.modifierProjet(this, projetCollecte);
|
406 |
mediateur.modifierProjet(this, projetCollecte);
|
406 |
}
|
407 |
}
|
407 |
}
|
408 |
}
|
408 |
}
|
409 |
}
|
409 |
return formulaireValideOk;
|
410 |
return formulaireValideOk;
|
410 |
}
|
411 |
}
|
411 |
|
412 |
|
412 |
public boolean verifierFormulaire() {
|
413 |
public boolean verifierFormulaire() {
|
413 |
boolean valide = true;
|
414 |
boolean valide = true;
|
414 |
ArrayList<String> messages = new ArrayList<String>();
|
415 |
ArrayList<String> messages = new ArrayList<String>();
|
415 |
|
416 |
|
416 |
String titre = nomChp.getValue();
|
417 |
String titre = nomChp.getValue();
|
417 |
if (titre == null || titre.equals("")) {
|
418 |
if (titre == null || titre.equals("")) {
|
418 |
messages.add("Veuillez saisir le nom du projet !");
|
419 |
messages.add("Veuillez saisir le nom du projet !");
|
419 |
}
|
420 |
}
|
420 |
|
421 |
|
421 |
String abr = abreviationChp.getValue();
|
422 |
String abr = abreviationChp.getValue();
|
422 |
if (abr == null || abr.equals("")) {
|
423 |
if (abr == null || abr.equals("")) {
|
423 |
messages.add("Veuillez saisir l'abréviation du projet !");
|
424 |
messages.add("Veuillez saisir l'abréviation du projet !");
|
424 |
}
|
425 |
}
|
425 |
|
426 |
|
426 |
String desc = descriptionChp.getValue();
|
427 |
String desc = descriptionChp.getValue();
|
427 |
if (desc == null || desc.equals("")) {
|
428 |
if (desc == null || desc.equals("")) {
|
428 |
messages.add("Veuillez saisir la description du projet !");
|
429 |
messages.add("Veuillez saisir la description du projet !");
|
429 |
}
|
430 |
}
|
430 |
|
431 |
|
431 |
String resume = resumeChp.getValue();
|
432 |
String resume = resumeChp.getValue();
|
432 |
if (resume == null || resume.equals("")) {
|
433 |
if (resume == null || resume.equals("")) {
|
433 |
messages.add("Veuillez saisir le résumé du projet !");
|
434 |
messages.add("Veuillez saisir le résumé du projet !");
|
434 |
}
|
435 |
}
|
435 |
|
436 |
|
436 |
String uri = urlChp.getValue();
|
437 |
String uri = urlChp.getValue();
|
437 |
if (uri != null && ! uri.trim().isEmpty() && ! uri.matches(Pattern.url)) {
|
438 |
if (uri != null && ! uri.trim().isEmpty() && ! uri.matches(Pattern.url)) {
|
438 |
messages.add("L'URL saisie n'est pas valide !");
|
439 |
messages.add("L'URL saisie n'est pas valide !");
|
439 |
}
|
440 |
}
|
440 |
|
441 |
|
441 |
String heure = indexationHeureChp.getValue();
|
442 |
String heure = indexationHeureChp.getValue();
|
442 |
if (!UtilString.isEmpty(heure)) {
|
443 |
if (!UtilString.isEmpty(heure)) {
|
443 |
if (!heure.matches(Pattern.heureMinute)) {
|
444 |
if (!heure.matches(Pattern.heureMinute)) {
|
444 |
messages.add("L'heureMinute d'indexation saisie n'est pas valide !");
|
445 |
messages.add("L'heureMinute d'indexation saisie n'est pas valide !");
|
445 |
}
|
446 |
}
|
446 |
}
|
447 |
}
|
447 |
|
448 |
|
448 |
if (messages.size() != 0) {
|
449 |
if (messages.size() != 0) {
|
449 |
String[] tableauDeMessages = {};
|
450 |
String[] tableauDeMessages = {};
|
450 |
tableauDeMessages = messages.toArray(tableauDeMessages);
|
451 |
tableauDeMessages = messages.toArray(tableauDeMessages);
|
451 |
MessageBox.alert("Erreurs de saisies", UtilArray.implode(tableauDeMessages, "<br />"), null);
|
452 |
MessageBox.alert("Erreurs de saisies", UtilArray.implode(tableauDeMessages, "<br />"), null);
|
452 |
valide = false;
|
453 |
valide = false;
|
453 |
}
|
454 |
}
|
454 |
return valide;
|
455 |
return valide;
|
455 |
}
|
456 |
}
|
456 |
|
457 |
|
457 |
private void peuplerFormulaire() {
|
458 |
private void peuplerFormulaire() {
|
458 |
nomChp.setValue(projet.getNom());
|
459 |
nomChp.setValue(projet.getNom());
|
459 |
abreviationChp.setValue(projet.getAbreviation());
|
460 |
abreviationChp.setValue(projet.getAbreviation());
|
460 |
descriptionChp.setValue(projet.getDescription());
|
461 |
descriptionChp.setValue(projet.getDescription());
|
461 |
resumeChp.setValue(projet.getResume());
|
462 |
resumeChp.setValue(projet.getResume());
|
462 |
urlChp.setValue(projet.getUrl());
|
463 |
urlChp.setValue(projet.getUrl());
|
463 |
|
464 |
|
464 |
motsClesChp.setValue(projet.getMotsCles());
|
465 |
motsClesChp.setValue(projet.getMotsCles());
|
465 |
citationChp.setValue(projet.getCitation());
|
466 |
citationChp.setValue(projet.getCitation());
|
466 |
licenceChp.setValue(projet.getLicence());
|
467 |
licenceChp.setValue(projet.getLicence());
|
467 |
|
468 |
|
468 |
if (projet.getMarkPublic().equals("1")) {
|
469 |
if (projet.getMarkPublic().equals("1")) {
|
469 |
markPublicChp.setValue(true);
|
470 |
markPublicChp.setValue(true);
|
470 |
} else {
|
471 |
} else {
|
471 |
markPublicChp.setValue(false);
|
472 |
markPublicChp.setValue(false);
|
472 |
}
|
473 |
}
|
473 |
|
474 |
|
474 |
if (listeLangueChargee) {
|
475 |
if (listeLangueChargee) {
|
475 |
if(valeurListeLangue.get(projet.getLangue()) != null) {
|
476 |
if(valeurListeLangue.get(projet.getLangue()) != null) {
|
476 |
langueChp.setValue(valeurListeLangue.get(projet.getLangue()));
|
477 |
langueChp.setValue(valeurListeLangue.get(projet.getLangue()));
|
477 |
langueChp.validate();
|
478 |
langueChp.validate();
|
478 |
}
|
479 |
}
|
479 |
}
|
480 |
}
|
480 |
|
481 |
|
481 |
if (listeIndexationFrequenceChargee) {
|
482 |
if (listeIndexationFrequenceChargee) {
|
482 |
if (valeurListeIndexationFrequence.get(projet.getIndexationFreq()) != null) {
|
483 |
if (valeurListeIndexationFrequence.get(projet.getIndexationFreq()) != null) {
|
483 |
indexationFrequenceChp.setValue(valeurListeIndexationFrequence.get(projet.getIndexationFreq()));
|
484 |
indexationFrequenceChp.setValue(valeurListeIndexationFrequence.get(projet.getIndexationFreq()));
|
484 |
indexationFrequenceChp.validate();
|
485 |
indexationFrequenceChp.validate();
|
485 |
}
|
486 |
}
|
486 |
}
|
487 |
}
|
487 |
|
488 |
|
488 |
if (listeIndexationDureeChargee) {
|
489 |
if (listeIndexationDureeChargee) {
|
489 |
if (valeurListeIndexationDuree.get(projet.getIndexationDuree()) != null) {
|
490 |
if (valeurListeIndexationDuree.get(projet.getIndexationDuree()) != null) {
|
490 |
indexationDureeChp.setValue(valeurListeIndexationDuree.get(projet.getIndexationDuree()));
|
491 |
indexationDureeChp.setValue(valeurListeIndexationDuree.get(projet.getIndexationDuree()));
|
491 |
indexationDureeChp.validate();
|
492 |
indexationDureeChp.validate();
|
492 |
}
|
493 |
}
|
493 |
}
|
494 |
}
|
494 |
|
495 |
|
495 |
String[] heureTab = projet.getIndexationHeure().split(":");
|
496 |
String[] heureTab = projet.getIndexationHeure().split(":");
|
496 |
if (heureTab.length > 1) {
|
497 |
if (heureTab.length > 1) {
|
497 |
String heure = heureTab[0]+":"+heureTab[1];
|
498 |
String heure = heureTab[0]+":"+heureTab[1];
|
498 |
if (heure.matches(Pattern.heureMinute)) {
|
499 |
if (heure.matches(Pattern.heureMinute)) {
|
499 |
indexationHeureChp.setValue(heure);
|
500 |
indexationHeureChp.setValue(heure);
|
500 |
}
|
501 |
}
|
501 |
}
|
502 |
}
|
502 |
|
503 |
|
503 |
doLayout(true);
|
504 |
doLayout(true);
|
504 |
}
|
505 |
}
|
505 |
|
506 |
|
506 |
private Projet collecterProjet() {
|
507 |
private Projet collecterProjet() {
|
507 |
Projet projetCollecte = (Projet) projet.cloner(new Projet());
|
508 |
Projet projetCollecte = (Projet) projet.cloner(new Projet());
|
508 |
|
509 |
|
509 |
projetCollecte.setNom(nomChp.getValue());
|
510 |
projetCollecte.setNom(nomChp.getValue());
|
510 |
projetCollecte.setAbreviation(abreviationChp.getValue());
|
511 |
projetCollecte.setAbreviation(abreviationChp.getValue());
|
511 |
projetCollecte.setDescription(descriptionChp.getValue());
|
512 |
projetCollecte.setDescription(descriptionChp.getValue());
|
512 |
projetCollecte.setResume(resumeChp.getValue());
|
513 |
projetCollecte.setResume(resumeChp.getValue());
|
513 |
projetCollecte.setUrl(urlChp.getValue());
|
514 |
projetCollecte.setUrl(urlChp.getValue());
|
514 |
|
515 |
|
515 |
projetCollecte.setMotsCles(motsClesChp.getValue());
|
516 |
projetCollecte.setMotsCles(motsClesChp.getValue());
|
516 |
projetCollecte.setCitation(citationChp.getValue());
|
517 |
projetCollecte.setCitation(citationChp.getValue());
|
517 |
projetCollecte.setLicence(licenceChp.getValue());
|
518 |
projetCollecte.setLicence(licenceChp.getValue());
|
518 |
if (langueChp.getValue() != null) {
|
519 |
if (langueChp.getValue() != null) {
|
519 |
projetCollecte.setLangue(langueChp.getValue().getId());
|
520 |
projetCollecte.setLangue(langueChp.getValue().getId());
|
520 |
}
|
521 |
}
|
521 |
String markPublic = (markPublicChp.getValue()) ? "1" : "0";
|
522 |
String markPublic = (markPublicChp.getValue()) ? "1" : "0";
|
522 |
projetCollecte.setMarkPublic(markPublic);
|
523 |
projetCollecte.setMarkPublic(markPublic);
|
523 |
|
524 |
|
524 |
projetCollecte.setIndexationHeure(indexationHeureChp.getValue());
|
525 |
projetCollecte.setIndexationHeure(indexationHeureChp.getValue());
|
525 |
if (indexationFrequenceChp.getValue() != null) {
|
526 |
if (indexationFrequenceChp.getValue() != null) {
|
526 |
projetCollecte.setIndexationFreq(indexationFrequenceChp.getValue().getId());
|
527 |
projetCollecte.setIndexationFreq(indexationFrequenceChp.getValue().getId());
|
527 |
}
|
528 |
}
|
528 |
if (indexationDureeChp.getValue() != null) {
|
529 |
if (indexationDureeChp.getValue() != null) {
|
529 |
projetCollecte.setIndexationDuree(indexationDureeChp.getValue().getId());
|
530 |
projetCollecte.setIndexationDuree(indexationDureeChp.getValue().getId());
|
530 |
}
|
531 |
}
|
531 |
|
532 |
|
532 |
Projet projetARetourner = null;
|
533 |
Projet projetARetourner = null;
|
533 |
if (!projetCollecte.comparer(projet)) {
|
534 |
if (!projetCollecte.comparer(projet)) {
|
534 |
projetARetourner = projet = projetCollecte;
|
535 |
projetARetourner = projet = projetCollecte;
|
535 |
Debug.log(projetARetourner.toString());
|
536 |
Debug.log(projetARetourner.toString());
|
536 |
}
|
537 |
}
|
537 |
return projetARetourner;
|
538 |
return projetARetourner;
|
538 |
}
|
539 |
}
|
539 |
|
540 |
|
540 |
public void reinitialiserFormulaire() {
|
541 |
public void reinitialiserFormulaire() {
|
541 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
542 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
542 |
mediateur.afficherFormProjet(projet.getId());
|
543 |
mediateur.afficherFormProjet(projet.getId());
|
543 |
} else {
|
544 |
} else {
|
544 |
mediateur.afficherFormProjet(null);
|
545 |
mediateur.afficherFormProjet(null);
|
545 |
}
|
546 |
}
|
546 |
}
|
547 |
}
|
547 |
|
548 |
|
548 |
}
|
549 |
}
|