51,11 → 51,17 |
private int listeValeurIndexationDureeInt = 1072; |
private String listeValeurIndexationFrequenceId = "frequencesIndexation"; |
private int listeValeurIndexationFrequenceInt = 1073; |
private String listeLanguesId = "langues"; |
private int listeLanguesInt = 1071; |
|
|
private ListStore<Valeur> listeIndexationDuree = null; |
private ListStore<Valeur> listeIndexationFrequence = null; |
private ListStore<Valeur> listeLangue = null; |
|
private ValeurListe valeurListeIndexationDuree = null; |
private ValeurListe valeurListeIndexationFrequence = null; |
private ValeurListe valeurListeLangue = null; |
|
private FieldSet generalitesFieldset = null; |
private TextField<String> nomChp = null; |
private TextField<String> abreviationChp = null; |
67,6 → 73,7 |
private TextField<String> motsClesChp = null; |
private TextField<String> citationChp = null; |
private TextField<String> licenceChp = null; |
private ComboBox<Valeur> langueChp = null; |
private CheckBox markPublicChp = null; |
|
private FieldSet indexationFieldset = null; |
74,9 → 81,6 |
private ComboBox<Valeur> indexationDureeChp = null; |
private ComboBox<Valeur> indexationFrequenceChp = null; |
|
private boolean listeIndexationDureeChargee = false; |
private boolean listeIndexationFrequenceChargee = false; |
|
private boolean formulaireValideOk = false; |
private boolean projetValideOk = false; |
|
120,10 → 124,11 |
|
mediateurCourant.obtenirListeValeurEtRafraichir(this, listeValeurIndexationDureeId); |
mediateurCourant.obtenirListeValeurEtRafraichir(this, listeValeurIndexationFrequenceId); |
mediateurCourant.obtenirListeValeurEtRafraichir(this, listeLanguesId); |
} |
|
private String genererTitreFormulaire() { |
String titre = "Ajout d'une projet"; |
String titre = "Ajout d'un projet"; |
if (mode.equals(Formulaire.MODE_MODIFIER)) { |
titre = "Modification d'un projet - "+i18nC.id()+": "+projet.getId(); |
} |
187,6 → 192,17 |
|
complementFieldset.add(licenceChp); |
|
listeLangue = new ListStore<Valeur>(); |
langueChp = new ComboBox<Valeur>(); |
langueChp.setStore(listeLangue); |
langueChp.setDisplayField("nom"); |
langueChp.setEditable(true); |
langueChp.setForceSelection(true); |
langueChp.setTypeAhead(true); |
langueChp.setFieldLabel("Langue"); |
|
complementFieldset.add(langueChp); |
|
markPublicChp = new CheckBox(); |
markPublicChp.setFieldLabel("Public"); |
|
213,7 → 229,9 |
indexationFrequenceChp = new ComboBox<Valeur>(); |
indexationFrequenceChp.setStore(listeIndexationFrequence); |
indexationFrequenceChp.setDisplayField("nom"); |
indexationFrequenceChp.setEditable(false); |
indexationFrequenceChp.setEditable(true); |
indexationFrequenceChp.setForceSelection(true); |
indexationFrequenceChp.setTypeAhead(true); |
indexationFrequenceChp.setFieldLabel(i18nC.projetIndexationFrequence()); |
|
indexationFieldset.add(indexationFrequenceChp, new FormData(120, 0)); |
223,7 → 241,9 |
indexationDureeChp = new ComboBox<Valeur>(); |
indexationDureeChp.setStore(listeIndexationDuree); |
indexationDureeChp.setDisplayField("nom"); |
indexationDureeChp.setEditable(false); |
indexationDureeChp.setEditable(true); |
indexationDureeChp.setForceSelection(true); |
indexationDureeChp.setTypeAhead(true); |
indexationDureeChp.setFieldLabel(i18nC.projetIndexationDuree()); |
|
indexationFieldset.add(indexationDureeChp, new FormData(80, 0)); |
232,20 → 252,21 |
|
private void creerTabIndex() { |
|
nomChp.setTabIndex(0); |
abreviationChp.setTabIndex(1); |
descriptionChp.setTabIndex(2); |
resumeChp.setTabIndex(3); |
urlChp.setTabIndex(4); |
nomChp.setTabIndex(1); |
abreviationChp.setTabIndex(2); |
descriptionChp.setTabIndex(3); |
resumeChp.setTabIndex(4); |
urlChp.setTabIndex(5); |
|
motsClesChp.setTabIndex(6); |
citationChp.setTabIndex(7); |
licenceChp.setTabIndex(8); |
markPublicChp.setTabIndex(9); |
langueChp.setTabIndex(9); |
markPublicChp.setTabIndex(10); |
|
indexationHeureChp.setTabIndex(10); |
indexationFrequenceChp.setTabIndex(11); |
indexationDureeChp.setTabIndex(12); |
indexationHeureChp.setTabIndex(11); |
indexationFrequenceChp.setTabIndex(12); |
indexationDureeChp.setTabIndex(13); |
|
nomChp.focus(); |
} |
261,23 → 282,56 |
ValeurListe nValeurListe = (ValeurListe)nouvellesDonnees; |
|
if(nValeurListe.getId() == listeValeurIndexationDureeInt) { |
|
valeurListeIndexationDuree = nValeurListe; |
|
for(Iterator<String> it = nValeurListe.keySet().iterator(); it.hasNext();) { |
listeIndexationDuree.add(nValeurListe.get(it.next())); |
listeIndexationDuree.sort("id_valeur", SortDir.ASC); |
listeIndexationDureeChargee = true; |
} |
|
if(mode.equals(MODE_MODIFIER)) { |
indexationDureeChp.setRawValue(valeurListeIndexationDuree.get(projet.getIndexationDuree()).getNom()); |
} |
|
indexationDureeChp.expand(); |
|
} |
|
if(nValeurListe.getId() == listeValeurIndexationFrequenceInt) { |
|
valeurListeIndexationFrequence = nValeurListe; |
|
for(Iterator<String> it = nValeurListe.keySet().iterator(); it.hasNext();) { |
listeIndexationFrequence.add(nValeurListe.get(it.next())); |
listeIndexationFrequence.sort("id_valeur", SortDir.ASC); |
listeIndexationFrequenceChargee = true; |
} |
|
if(mode.equals(MODE_MODIFIER)) { |
indexationFrequenceChp.setRawValue(valeurListeIndexationFrequence.get(projet.getIndexationFreq()).getNom()); |
} |
|
indexationFrequenceChp.expand(); |
} |
|
if(nValeurListe.getId() == listeLanguesInt) { |
|
valeurListeLangue = nValeurListe; |
|
for(Iterator<String> it = nValeurListe.keySet().iterator(); it.hasNext();) { |
listeLangue.add(nValeurListe.get(it.next())); |
listeLangue.sort("id_valeur", SortDir.ASC); |
} |
|
if(mode.equals(MODE_MODIFIER)) { |
langueChp.setRawValue(valeurListeLangue.get(projet.getLangue()).getNom()); |
GWT.log(valeurListeLangue.get(projet.getLangue()).getNom(),null); |
} |
} |
|
GWT.log("une liste de valeurs est arrivée "+nValeurListe.getId(), null); |
} |
|
if (etreValide()) { |
initialiserValidation(); |
repandreRafraichissement(); |
363,9 → 417,13 |
} |
|
String heure = indexationHeureChp.getValue(); |
if (heure != null && ! heure.isEmpty() && ! heure.matches(Pattern.heure)) { |
messages.add("L'heure d'indexation saisie n'est pas valide !"); |
if (heure != null && ! heure.isEmpty() && !heure.matches(Pattern.heureMinute)) { |
messages.add("L'heureMinute d'indexation saisie n'est pas valide !"); |
} else { |
if(heure.matches(Pattern.heureMinute)) { |
heure += ":00"; |
} |
} |
|
if (messages.size() != 0) { |
String[] tableauDeMessages = {}; |
387,26 → 445,53 |
motsClesChp.setValue(projet.getMotsCles()); |
citationChp.setValue(projet.getCitation()); |
licenceChp.setValue(projet.getLicence()); |
markPublicChp.setValue(Boolean.parseBoolean(projet.getMarkPublic())); |
|
indexationHeureChp.setValue(projet.getIndexationHeure()); |
indexationFrequenceChp.select(listeIndexationFrequence.findModel(projet.getIndexationFreq())); |
indexationDureeChp.select(listeIndexationDuree.findModel(projet.getIndexationDuree())); |
if(projet.getMarkPublic().equals("1")) { |
markPublicChp.setValue(true); |
} else { |
markPublicChp.setValue(false); |
} |
|
String[] heureTab = projet.getIndexationHeure().split(":"); |
String heure = heureTab[0]+":"+heureTab[1]; |
if(heure.matches(Pattern.heureMinute)) { |
indexationHeureChp.setValue(heure); |
} |
|
doLayout(true); |
|
} |
|
private Projet collecterProjet() { |
Projet projetARetourner = null; |
Projet projetCollectee = (Projet) projet.cloner(new Projet()); |
Projet projetARetourner = new Projet(); |
Projet projetCollecte = (Projet) projet.cloner(new Projet()); |
|
// TODO : collecter le reste des champs |
projetARetourner.setNom(nomChp.getValue()); |
projetARetourner.setAbreviation(abreviationChp.getValue()); |
projetARetourner.setDescription(descriptionChp.getValue()); |
projetARetourner.setResume(resumeChp.getValue()); |
projetARetourner.setUrl(urlChp.getValue()); |
|
if (!projetCollectee.comparer(projet)) { |
projetARetourner = projet = projetCollectee; |
projetARetourner.setMotsCles(motsClesChp.getValue()); |
projetARetourner.setCitation(citationChp.getValue()); |
projetARetourner.setLicence(licenceChp.getValue()); |
|
if(markPublicChp.getValue()) { |
projetCollecte.setMarkPublic("1"); |
} else { |
projetCollecte.setMarkPublic("0"); |
} |
|
projetARetourner.setIndexationHeure(indexationHeureChp.getValue()); |
projetARetourner.setIndexationDuree(indexationDureeChp.getValue().getId()); |
projetARetourner.setIndexationFreq(indexationFrequenceChp.getValue().getId()); |
|
if (!projetCollecte.comparer(projet)) { |
projetARetourner = projet = projetCollecte; |
} |
|
//GWT.log(projetARetourner.toString()+" "+projetARetourner., null) |
|
return projetARetourner; |
} |
|