From f89c6a65295c4a2be18cd5c1d8171d91d6c9dd1f Mon Sep 17 00:00:00 2001 From: Markus Kreth Date: Sat, 26 Jan 2019 03:54:19 +0100 Subject: [PATCH] Contacts are shown. --- .../ui/components/PersonEditDetails.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/components/PersonEditDetails.java b/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/components/PersonEditDetails.java index 468bf94..0312657 100644 --- a/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/components/PersonEditDetails.java +++ b/src/main/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/components/PersonEditDetails.java @@ -19,6 +19,7 @@ import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; import de.kreth.vaadin.clubhelper.vaadinclubhelper.dao.PersonDao; +import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Contact; import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Gender; import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.GroupDef; import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Person; @@ -160,6 +161,7 @@ public class PersonEditDetails extends HorizontalLayout { if (person != null) { okButton.setEnabled(true); updateRelationshipBinding(); + updateContactBinding(); } else { okButton.setEnabled(false); contactLayout.removeAllComponents(); @@ -167,6 +169,18 @@ public class PersonEditDetails extends HorizontalLayout { } } + private void updateContactBinding() { + contactLayout.removeAllComponents(); + Person current = binder.getBean(); + List contacts = current.getContacts(); + for (Contact c : contacts) { + TextField textField = new TextField(c.getType()); + textField.setValue(c.getValue()); + textField.setEnabled(false); + contactLayout.addComponent(textField); + } + } + private void updateRelationshipBinding() { relationshipLayout.removeAllComponents(); Person current = binder.getBean();