7,7 → 7,6 |
import org.tela_botanica.client.Mediateur; |
import org.tela_botanica.client.RegistreId; |
import org.tela_botanica.client.interfaces.Rafraichissable; |
import org.tela_botanica.client.modeles.Personne; |
import org.tela_botanica.client.modeles.PersonneListe; |
import org.tela_botanica.client.modeles.Publication; |
import org.tela_botanica.client.modeles.Structure; |
45,11 → 44,10 |
private String idProjet = "" ; |
private String metaPubli = "" ; |
|
private PersonneListe listePersonneAuteur = null ; |
private ListStore<Personne> storeAuteurs = null ; |
private ArrayList<ComboBox<Personne>> listeAuteurs = null; |
private ArrayList<TextField<String>> listeAuteurs = null; |
|
private TextField<String> nomArticle = null; |
private TextField<String> nomPub = null; |
private TextField<String> intituleCollPub = null; |
private TextField<String> uriPub = null; |
|
62,8 → 60,6 |
private String mode = "AJOUT"; |
|
FieldSet fieldSetAuteurs = null ; |
|
private Publication publi; |
|
|
public FormPublicationVue() { |
71,9 → 67,6 |
setLayout(new FitLayout()); |
mediateur = Registry.get(RegistreId.MEDIATEUR); |
|
storeAuteurs = new ListStore<Personne>(); |
listePersonneAuteur = new PersonneListe(); |
|
// Création de la disposition : FIELDSET |
FormLayout layoutFieldset = new FormLayout(); |
layoutFieldset.setLabelWidth(200); |
119,6 → 112,9 |
nomArticle.setName("cpu"); |
nomArticle.setFieldLabel("Titre de l'article ou de l'ouvrage"); |
|
nomPub = new TextField<String>(); |
nomPub.setFieldLabel("Intitulé complet de la publication"); |
|
intituleCollPub = new TextField<String>(); |
intituleCollPub.setFieldLabel("Intitulé de la collection ou de la revue"); |
|
126,6 → 122,7 |
uriPub.setFieldLabel("URI de la publication"); |
|
fieldSetInfosGen.add(nomArticle); |
fieldSetInfosGen.add(nomPub); |
fieldSetInfosGen.add(intituleCollPub); |
fieldSetInfosGen.add(uriPub); |
|
191,7 → 188,6 |
}); |
panel.addButton(validerBtn); |
|
mediateur.clicObtenirListeAuteurs(this); |
mediateur.clicObtenirListeEditeurs(this); |
} |
|
202,10 → 198,12 |
|
mode = "MODIF" ; |
|
publi = (Publication)nouvelleDonnees; |
genererChampsAuteur(publi.getIdAuteur(),false); |
Publication publi = (Publication)nouvelleDonnees; |
|
genererChampsAuteur(publi.getAuteur(),false); |
|
nomArticle.setValue(publi.getTitre()); |
nomPub.setValue(publi.getNomComplet()); |
intituleCollPub.setValue(publi.getCollection()); |
uriPub.setValue(publi.getURI()); |
datePub.setRawValue(publi.getDateParution()); |
234,19 → 232,6 |
} |
comboListeEditeurs.expand(); |
} |
|
if(nouvelleDonnees instanceof PersonneListe) { |
storeAuteurs.removeAll(); |
listePersonneAuteur = (PersonneListe)nouvelleDonnees; |
Set<String> listeStructureSet = listePersonneAuteur.keySet(); |
for(Iterator<String> it = listeStructureSet.iterator() ; it.hasNext() ;) { |
storeAuteurs.add(listePersonneAuteur.get(it.next())); |
} |
|
if(mode.equals("MODIF")) { |
genererChampsAuteur(publi.getIdAuteur(),false); |
} |
} |
} |
|
private void soumettreFormulaire() { |
259,7 → 244,7 |
} |
} |
String nomArt = nomArticle.getValue(); |
String pub = nomArticle.getValue()+" "+intituleCollPub.getValue(); |
String pub = nomPub.getValue(); |
String collPub = intituleCollPub.getValue(); |
String uri = uriPub.getValue(); |
String editeur = comboListeEditeurs.getValue().getId(); |
279,14 → 264,14 |
|
private void genererChampsAuteur(String auteursStr, boolean ajouter) { |
|
String[] auteurs = auteursStr.split(";;"); |
String[] auteurs = auteursStr.split("\\|"); |
LayoutContainer conteneurChamps = new LayoutContainer(); |
|
if(auteurs.length != 0) { |
listeAuteurs = new ArrayList<ComboBox<Personne>>(auteurs.length); |
listeAuteurs = new ArrayList<TextField<String>>(auteurs.length); |
} |
else{ |
listeAuteurs = new ArrayList<ComboBox<Personne>>(1); |
listeAuteurs = new ArrayList<TextField<String>>(1); |
ajouter = true ; |
} |
|
315,20 → 300,12 |
|
for(int i = 0 ; i < listeAuteurs.size() ; i++) { |
|
Personne enCours = listeAuteurs.get(i).getValue() ; |
String valeurChampAuteur = " " ; |
if(enCours != null) { |
valeurChampAuteur = enCours.getId(); |
} |
else |
{ |
valeurChampAuteur = null ; |
} |
String valeurChampAuteur = listeAuteurs.get(i).getValue(); |
if(valeurChampAuteur != null) |
{ |
idsAuteurs += valeurChampAuteur ; |
} |
idsAuteurs += ";;" ; |
idsAuteurs += "|" ; |
} |
genererChampsAuteur(idsAuteurs,true); |
} |
348,12 → 325,9 |
FormLayout layoutPanelTF = new FormLayout(); |
p.setLayout(layoutPanelTF); |
|
final ComboBox<Personne> tf = new ComboBox<Personne>() ; |
tf.setDisplayField("fmt_nom_complet"); |
tf.setStore(storeAuteurs); |
if(valeurDefaut != null && !valeurDefaut.equals("") ) { |
Personne auteur = listePersonneAuteur.get((String)valeurDefaut); |
tf.setValue(auteur); |
final TextField<String> tf = new TextField<String>() ; |
if(valeurDefaut != null) { |
tf.setValue(valeurDefaut); |
} |
tf.setSize(200, 20); |
listeAuteurs.add(tf); |
368,16 → 342,7 |
|
for(int i = 0 ; i < listeAuteurs.size() ; i++) { |
|
Personne enCours = listeAuteurs.get(i).getValue() ; |
String valeurChampAuteur = " " ; |
if(enCours != null) { |
valeurChampAuteur = enCours.getId(); |
} |
else |
{ |
valeurChampAuteur = null ; |
} |
|
String valeurChampAuteur = listeAuteurs.get(i).getValue(); |
if(valeurChampAuteur != null & !valeurChampAuteur.equals("")) |
{ |
idsAuteurs += valeurChampAuteur ; |
387,7 → 352,7 |
idsAuteurs += " " ; |
} |
if(i != listeAuteurs.size() - 1) { |
idsAuteurs+= ";;"; |
idsAuteurs+= "|"; |
} |
} |
genererChampsAuteur(idsAuteurs,false); |