Databinding to custom form

Dear all

I finally need help, I am trying to bind my entity to a custom form I programmed. The form looks as in the data “printscreen.png”

The entity recording (a pojo) consists of several fields. I have to display the fields in the form.

The Indication is stored in the Property indication. This is another pojo wrapping an xml syntax. There is a getter getDisplayString() which returns the text I would have to show. In the example this would be “the indication”.
Same goes for the risk factor which is an instance of the same pojo class.

For the medication field its a bit more complex. This is a List which has a getName() methode on it to return the medications value.
The Form should display the first three available medications of the set.

The minisummary is the class responsible for the header of the panel, a simple label in another vertical layout.

The form is currently working but it is a) read only and b) poorly designed by glueing the entity and the form related code together (using the setData(Recording recording method which is bad design in my opinion)

Which would be the Vaadin way of “glueing” business and entity together?

I already read something about PropertyFormatter, BeanItem, tried to use the FormBinder Addon but nothing resulted in “nice” code from my point of view.

Has someone a hint how he would try to solve this?

Many thanks in advantages
Patrick Schmid

Edit: Forgot to say, I am currently using Vaadin 6.8.2

package ch.schiller.webanalyzer.views.analyzerview.ui;

import ch.schiller.ecg.pdms.model.Medication;
import ch.schiller.ecg.pdms.model.Recording;
import ch.schiller.webanalyzer.uicomponents.MiniSummary;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Panel;

 * A Panel containing additional information of a recording (indications, risks,
 * medications)
 * @author PAS
public class AdditionalInformationPanel extends MiniSummary

  private final Label indicationLabel;
  private final Label indication;
  private final Label riskLabel;
  private final Label risk;
  private final Label medicationsLabel;
  private final Label medication1;
  private final Label medication2;
  private final Label medication3;

  public AdditionalInformationPanel()
    super("Additional Information", "icons/");

    indicationLabel = new Label("Indication:");
    indication = new Label();
    riskLabel = new Label("Risk Factor(s):");
    risk = new Label();
    medicationsLabel = new Label("Medication(s)");
    medication1 = new Label();
    medication2 = new Label();
    medication3 = new Label();

    GridLayout grid = new GridLayout(2, 5);
    grid.setColumnExpandRatio(0, 0.25f);
    grid.setColumnExpandRatio(1, 0.75f);
    grid.addComponent(indicationLabel, 0, 0);
    grid.addComponent(indication, 1, 0);

    grid.addComponent(riskLabel, 0, 1);
    grid.addComponent(risk, 1, 1);

    grid.addComponent(medicationsLabel, 0, 2);
    grid.addComponent(medication1, 1, 2);

    grid.addComponent(medication2, 1, 3);

    grid.addComponent(medication3, 1, 4);

    Panel panel = new Panel();

   * Fills this panel with the data of the recording
  public void setData(Recording recording)
    indication.setValue(recording.getIndicationDocument() == null ? null : recording.getIndicationDocument().getPlainText());
    risk.setValue(recording.getRiskfactorDocument() == null ? null : recording.getRiskfactorDocument().getPlainText());
    Medication[] medications = new Medication[3]
    int i = 0;
    for (Medication med : recording.getMedications()) {
 = med;
      if (i == 2) {
 == null ? null : medications[0]
 == null ? null : medications[1]
 == null ? null : medications[2]