44,8 → 44,18 |
private FieldSet fsIdentite; |
private FieldSet fsContact; |
|
//A ajouter : |
// Onglet Adresse |
// contient : adresse perso / adresse pro |
|
//Onglet Info Naturaliste |
|
// > Se baser sur la présentation thunderBird |
|
|
public PersonneDetailPanneauVue() { |
|
//Constructeur de la classe |
Registry.register(RegistreId.PANNEAU_PERSONNE_DETAIL, this); |
setLayout(new FitLayout()); |
|
54,51 → 64,59 |
identite.setScrollMode(Scroll.AUTO); |
|
fsIdentite = new FieldSet(); |
|
fsIdentite.setLayout(new FormLayout()); |
|
|
fsContact = new FieldSet(); |
|
fsContact.setLayout(new FormLayout()); |
|
|
this.add(identite); |
|
//TODO : ajouter adresse |
//TODO : ajouter info naturaliste |
|
} |
|
public void afficherDetailPersonne(Personne personne) { |
if (personne != null) { |
|
|
//MAJ Identité : Configurer les fieldSet |
identite.removeAll(); |
|
fsIdentite.setHeading("Identité"); |
fsIdentite.setWidth("350px"); |
fsIdentite.setStyleAttribute("padding", "1px"); |
|
fsContact.setHeading("Contact"); |
fsContact.setWidth("350px"); |
|
|
identite.add(fsIdentite); |
|
//La personne peut avoir un logo |
String logoUrl = (String) personne.obtenirValeurChamp("truk_logo"); |
|
if ((logoUrl!=null)&&(!logoUrl.trim().equals(""))) { |
|
//Si c'est le cas, on l'affiche sur la même ligne que fsIdentité |
Image img = new Image(); |
img.setUrl(logoUrl); |
img.setTitle("logo-personne"); |
|
// FIXME : pour avoir un affichage correct, je force la redimension à 300px. Idéalement, ce serait un max-height qu'il faudrait. |
// FIXME : L'image devrait se mettre sur deux lignes au lieu d'une, ca décale tout ... |
img.setHeight("300px"); |
|
identite.add(img); |
|
} else { |
//Sinon, on doit mettre une case vide pour garder une présentation en colonne de fsIdentite & fsContact |
identite.add(new Label()); |
} |
|
identite.add(fsContact); |
|
|
|
|
|
|
fsIdentite.removeAll(); |
fsContact.removeAll(); |
//Ajout des champs Identité |
138,6 → 156,8 |
|
//CONTACT |
|
//FIXME : courriel est un champ TRUK |
// on doit afficher N entrées |
String courriel = (String) personne.obtenirValeurChamp("truk_courriel"); |
Hyperlink lnkCourriel = new Hyperlink(); |
lnkCourriel.setHTML("<b style=\"margin:0 50px 0 0 ; color:black;\">Courriel:</b><a href=\"mailto:" + courriel + "\">" + courriel + "</a>"); |
145,6 → 165,9 |
|
fsContact.addText("<br >"); |
|
|
/* |
* Adresses : |
String adresse01 = (String) personne.obtenirValeurChamp("adresse_01"); |
ajouterTextFieldNonEditable(fsContact, "Adresse", adresse01); |
|
167,7 → 190,7 |
String pays = (String) personne.obtenirValeurChamp("pays"); |
ajouterTextFieldNonEditable(fsContact, "Pays", pays); |
|
fsContact.addText("<br >"); |
fsContact.addText("<br >"); */ |
|
|
|
201,57 → 224,6 |
} |
} |
|
/*public void visualiserPersonneIdentite() { |
|
//FieldSet identité |
|
FieldSet fsId = new FieldSet(); |
fsId.setHeading("Identité"); |
fsId.setLayout(new FormLayout()); |
|
visualiser(champsIdentite, fsId); |
|
/*NodeList nl = (NodeList) fsId.getElement().getChildNodes(); |
Window.alert(String.valueOf(nl.getLength()));*/ |
|
/*identite.add(fsId); |
|
//TEST |
Widget w = (TextField) fsId.getWidget(0); |
|
|
//FieldSet contact |
FieldSet fsContact = new FieldSet(); |
fsContact.setHeading("Contact"); |
|
|
|
} |
|
public void visualiser(HashMap champs, LayoutContainer lContent) { |
|
Iterator<String> itNomChamps = champs.keySet().iterator(); |
while (itNomChamps.hasNext()) { |
TextField<String> nom = new TextField(); |
String cle = itNomChamps.next(); |
nom.setFieldLabel(cle); |
nom.setValue((String) champs.get(cle)); |
|
//Dans le cas de la visualisation, on ne veut aucun évènement sur la saisie clavier. |
nom.addKeyListener(new KeyListener(){ |
public void componentKeyPress(ComponentEvent ev) { |
ev.stopEvent(); |
} |
|
}); |
|
lContent.add(nom); |
|
} |
|
}/*/ |
|
|
public void rafraichir(Object nouvelleDonnees) { |
if (nouvelleDonnees instanceof Personne) { |
afficherDetailPersonne((Personne) nouvelleDonnees); |