| Line 10... |
Line 10... |
| 10 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
10 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
| 11 |
import org.tela_botanica.client.modeles.Information;
|
11 |
import org.tela_botanica.client.modeles.Information;
|
| 12 |
import org.tela_botanica.client.modeles.MenuApplicationId;
|
12 |
import org.tela_botanica.client.modeles.MenuApplicationId;
|
| 13 |
import org.tela_botanica.client.modeles.personne.Personne;
|
13 |
import org.tela_botanica.client.modeles.personne.Personne;
|
| 14 |
import org.tela_botanica.client.modeles.personne.PersonneListe;
|
14 |
import org.tela_botanica.client.modeles.personne.PersonneListe;
|
| - |
|
15 |
import org.tela_botanica.client.modeles.projet.Projet;
|
| - |
|
16 |
import org.tela_botanica.client.modeles.projet.ProjetListe;
|
| 15 |
import org.tela_botanica.client.modeles.publication.Publication;
|
17 |
import org.tela_botanica.client.modeles.publication.Publication;
|
| 16 |
import org.tela_botanica.client.modeles.publication.PublicationAPersonne;
|
18 |
import org.tela_botanica.client.modeles.publication.PublicationAPersonne;
|
| 17 |
import org.tela_botanica.client.modeles.publication.PublicationAPersonneListe;
|
19 |
import org.tela_botanica.client.modeles.publication.PublicationAPersonneListe;
|
| 18 |
import org.tela_botanica.client.modeles.structure.Structure;
|
20 |
import org.tela_botanica.client.modeles.structure.Structure;
|
| 19 |
import org.tela_botanica.client.modeles.structure.StructureListe;
|
21 |
import org.tela_botanica.client.modeles.structure.StructureListe;
|
| Line 29... |
Line 31... |
| 29 |
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
|
31 |
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
|
| 30 |
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
32 |
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
| 31 |
import com.extjs.gxt.ui.client.widget.MessageBox;
|
33 |
import com.extjs.gxt.ui.client.widget.MessageBox;
|
| 32 |
import com.extjs.gxt.ui.client.widget.button.Button;
|
34 |
import com.extjs.gxt.ui.client.widget.button.Button;
|
| 33 |
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
35 |
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
| - |
|
36 |
import com.extjs.gxt.ui.client.widget.form.Field;
|
| 34 |
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
37 |
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
| 35 |
import com.extjs.gxt.ui.client.widget.form.TextField;
|
38 |
import com.extjs.gxt.ui.client.widget.form.TextField;
|
| - |
|
39 |
import com.extjs.gxt.ui.client.widget.form.Validator;
|
| 36 |
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
|
40 |
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
|
| 37 |
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
|
41 |
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
|
| 38 |
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
42 |
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
| 39 |
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
43 |
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
| 40 |
import com.google.gwt.core.client.GWT;
|
44 |
import com.google.gwt.core.client.GWT;
|
| Line 47... |
Line 51... |
| 47 |
private static boolean publicationAPersonneListeChargementOk = false;
|
51 |
private static boolean publicationAPersonneListeChargementOk = false;
|
| 48 |
private PublicationAPersonneListe auteursAjoutes = null;
|
52 |
private PublicationAPersonneListe auteursAjoutes = null;
|
| 49 |
private PublicationAPersonneListe auteursSupprimes = null;
|
53 |
private PublicationAPersonneListe auteursSupprimes = null;
|
| Line 50... |
Line 54... |
| 50 |
|
54 |
|
| - |
|
55 |
private FieldSet auteursFieldset = null;
|
| 51 |
private FieldSet auteursFieldset = null;
|
56 |
private ComboBox<Projet> projetsCombo = null;
|
| 52 |
private ArrayList<ComboBox<Personne>> auteurComboboxListe = null;
|
57 |
private ArrayList<ComboBox<Personne>> auteurComboboxListe = null;
|
| 53 |
private LayoutContainer conteneurChamps;
|
58 |
private LayoutContainer conteneurChamps;
|
| 54 |
private ListStore<Personne> auteursStorePartage = null;
|
59 |
private ListStore<Personne> auteursStorePartage = null;
|
| Line 138... |
Line 143... |
| 138 |
creerChampsAuteur();
|
143 |
creerChampsAuteur();
|
| 139 |
}
|
144 |
}
|
| Line 140... |
Line 145... |
| 140 |
|
145 |
|
| 141 |
private void creerChampsAuteur() {
|
146 |
private void creerChampsAuteur() {
|
| 142 |
auteursFieldset.removeAll();
|
- |
|
| 143 |
|
147 |
auteursFieldset.removeAll();
|
| Line 144... |
Line 148... |
| 144 |
conteneurChamps = new LayoutContainer();
|
148 |
conteneurChamps = new LayoutContainer();
|
| 145 |
|
149 |
|
| 146 |
Button ajouterAuteurBouton = new Button(i18nC.publicationAuteurBoutonAjouter());
|
150 |
Button ajouterAuteurBouton = new Button(i18nC.publicationAuteurBoutonAjouter());
|
| Line 224... |
Line 228... |
| 224 |
generalitesFieldset = new FieldSet();
|
228 |
generalitesFieldset = new FieldSet();
|
| 225 |
generalitesFieldset.setHeading("Informations générales");
|
229 |
generalitesFieldset.setHeading("Informations générales");
|
| 226 |
generalitesFieldset.setCollapsible(true);
|
230 |
generalitesFieldset.setCollapsible(true);
|
| 227 |
generalitesFieldset.setLayout(layout);
|
231 |
generalitesFieldset.setLayout(layout);
|
| Line -... |
Line 232... |
| - |
|
232 |
|
| - |
|
233 |
projetsCombo = new ComboBox<Projet>();
|
| - |
|
234 |
projetsCombo.setTabIndex(tabIndex++);
|
| - |
|
235 |
projetsCombo.setFieldLabel(i18nC.projetChamp());
|
| - |
|
236 |
projetsCombo.setDisplayField("nom");
|
| - |
|
237 |
projetsCombo.setForceSelection(true);
|
| - |
|
238 |
projetsCombo.setValidator(new Validator() {
|
| - |
|
239 |
@Override
|
| - |
|
240 |
public String validate(Field<?> field, String value) {
|
| - |
|
241 |
String retour = null;
|
| - |
|
242 |
if (field.getRawValue().equals("")) {
|
| - |
|
243 |
field.setValue(null);
|
| - |
|
244 |
} else if (projetsCombo.getStore().findModel("nom", field.getRawValue()) == null) {
|
| - |
|
245 |
String contenuBrut = field.getRawValue();
|
| - |
|
246 |
field.setValue(null);
|
| - |
|
247 |
field.setRawValue(contenuBrut);
|
| - |
|
248 |
retour = "Veuillez sélectionner une valeur ou laisser le champ vide";
|
| - |
|
249 |
}
|
| - |
|
250 |
return retour;
|
| - |
|
251 |
}
|
| - |
|
252 |
});
|
| - |
|
253 |
projetsCombo.setTriggerAction(TriggerAction.ALL);
|
| - |
|
254 |
projetsCombo.setStore(new ListStore<Projet>());
|
| - |
|
255 |
projetsCombo.addStyleName(ComposantClass.OBLIGATOIRE);
|
| - |
|
256 |
projetsCombo.addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire());
|
| - |
|
257 |
generalitesFieldset.add(projetsCombo, new FormData(450, 0));
|
| - |
|
258 |
mediateur.selectionnerProjet(this, null);
|
| 228 |
|
259 |
|
| 229 |
titreChp = new TextField<String>();
|
260 |
titreChp = new TextField<String>();
|
| 230 |
titreChp.setName("cpu");
|
261 |
titreChp.setName("cpu");
|
| 231 |
titreChp.setFieldLabel("Titre de l'article ou de l'ouvrage");
|
262 |
titreChp.setFieldLabel("Titre de l'article ou de l'ouvrage");
|
| 232 |
titreChp.addStyleName(ComposantClass.OBLIGATOIRE);
|
263 |
titreChp.addStyleName(ComposantClass.OBLIGATOIRE);
|
| Line 294... |
Line 325... |
| 294 |
rafraichirListeEditeurs((StructureListe) nouvellesDonnees);
|
325 |
rafraichirListeEditeurs((StructureListe) nouvellesDonnees);
|
| 295 |
} else if (nouvellesDonnees instanceof PublicationAPersonneListe) {
|
326 |
} else if (nouvellesDonnees instanceof PublicationAPersonneListe) {
|
| 296 |
rafraichirListeAuteurs((PublicationAPersonneListe) nouvellesDonnees);
|
327 |
rafraichirListeAuteurs((PublicationAPersonneListe) nouvellesDonnees);
|
| 297 |
} else if (nouvellesDonnees instanceof Information) {
|
328 |
} else if (nouvellesDonnees instanceof Information) {
|
| 298 |
rafraichirInformation((Information) nouvellesDonnees);
|
329 |
rafraichirInformation((Information) nouvellesDonnees);
|
| - |
|
330 |
} else if (nouvellesDonnees instanceof ProjetListe) {
|
| - |
|
331 |
ProjetListe projets = (ProjetListe) nouvellesDonnees;
|
| - |
|
332 |
Formulaire.rafraichirComboBox(projets, projetsCombo);
|
| - |
|
333 |
setValeurComboProjets();
|
| 299 |
} else {
|
334 |
} else {
|
| 300 |
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
|
335 |
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
|
| 301 |
}
|
336 |
}
|
| Line 302... |
Line 337... |
| 302 |
|
337 |
|
| Line 577... |
Line 612... |
| 577 |
return valide;
|
612 |
return valide;
|
| 578 |
}
|
613 |
}
|
| Line 579... |
Line 614... |
| 579 |
|
614 |
|
| 580 |
private void peuplerFormulaire() {
|
615 |
private void peuplerFormulaire() {
|
| - |
|
616 |
creerChampsAuteur();
|
| 581 |
creerChampsAuteur();
|
617 |
setValeurComboProjets();
|
| 582 |
titreChp.setValue(publication.getTitre());
|
618 |
titreChp.setValue(publication.getTitre());
|
| 583 |
collectionChp.setValue(publication.getCollection());
|
619 |
collectionChp.setValue(publication.getCollection());
|
| 584 |
uriChp.setValue(publication.getURI());
|
620 |
uriChp.setValue(publication.getURI());
|
| 585 |
datePublicationChp.setRawValue(reduireDateParAnnee(publication.getDateParution()));
|
621 |
datePublicationChp.setValue(reduireDateParAnnee(publication.getDateParution()));
|
| 586 |
tomeChp.setValue(publication.getIndicationNvt());
|
622 |
tomeChp.setValue(publication.getIndicationNvt());
|
| 587 |
fasciculeChp.setValue(publication.getFascicule());
|
623 |
fasciculeChp.setValue(publication.getFascicule());
|
| Line 588... |
Line 624... |
| 588 |
pagesChp.setValue(publication.getPages());
|
624 |
pagesChp.setValue(publication.getPages());
|
| Line 596... |
Line 632... |
| 596 |
}
|
632 |
}
|
| Line 597... |
Line 633... |
| 597 |
|
633 |
|
| 598 |
private Publication collecterPublication() {
|
634 |
private Publication collecterPublication() {
|
| Line -... |
Line 635... |
| - |
|
635 |
Publication publicationCollectee = (Publication) publication.cloner(new Publication());
|
| - |
|
636 |
|
| 599 |
Publication publicationCollectee = (Publication) publication.cloner(new Publication());
|
637 |
publicationCollectee.setIdProjet(getValeurComboProjets());
|
| 600 |
|
638 |
|
| 601 |
String auteurIntituleFormate = "";
|
639 |
String auteurIntituleFormate = "";
|
| 602 |
int auteursNombre = auteurComboboxListe.size();
|
640 |
int auteursNombre = auteurComboboxListe.size();
|
| 603 |
for (int i = 0; i < auteursNombre; i++) {
|
641 |
for (int i = 0; i < auteursNombre; i++) {
|
| Line 673... |
Line 711... |
| 673 |
return datePar.split("-")[0];
|
711 |
return datePar.split("-")[0];
|
| 674 |
} else {
|
712 |
} else {
|
| 675 |
return "";
|
713 |
return "";
|
| 676 |
}
|
714 |
}
|
| 677 |
}
|
715 |
}
|
| - |
|
716 |
|
| - |
|
717 |
private String getValeurComboProjets() {
|
| - |
|
718 |
String valeur = "";
|
| - |
|
719 |
if (projetsCombo.getValue() != null) {
|
| - |
|
720 |
valeur = projetsCombo.getValue().getId();
|
| - |
|
721 |
}
|
| - |
|
722 |
return valeur;
|
| - |
|
723 |
}
|
| - |
|
724 |
private void setValeurComboProjets() {
|
| - |
|
725 |
if (projetsCombo.getStore() != null ) {
|
| - |
|
726 |
if (mode.equals(Formulaire.MODE_MODIFIER) && publication != null) {
|
| - |
|
727 |
projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", publication.getIdProjet()));
|
| - |
|
728 |
} else if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
| - |
|
729 |
projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", mediateur.getProjetId()));
|
| - |
|
730 |
}
|
| - |
|
731 |
}
|
| - |
|
732 |
}
|
| 678 |
}
|
733 |
}
|
| 679 |
|
734 |
|