1..n binding for the table container

Hello Community.

I’m developing application which allow user to upload some files. The upload and other things works ok.
The problem what i have is about binding. I want to show the filenames that was uploaded on the same page.

I have 2 classes:


public class ApplicationAttachment implements Serializable {
    private String fileName;
    private String fileType;
}

public class ApplicationInfoSet implements Serializable {
    private List<ApplicationAttachment> attachmentList = new ArrayList<ApplicationAttachment>();
}

By uploading the new applicationAttachment is added to the attachmentList on the ApplicationInfoSet.
Now i need to synchronize or bind the representation of the table on ui with given model.

I have 3 ways to do it:

  • The uploader class adds a new attachment to the Property from BeanFieldGroup. The attachmentList model is updated, but the Problem is that the table container dont’t listen to the changes of the collection and doesnt know about new items

  • The uploader class adds a new attachment to the same BeanItemContainer as the table is bound on. The Problem is that the container has no binding to the model and attachmentList need to be updated manually.

  • Update the attachmentList directly and handle changes on the container manually. That is the uglyest way i see. The Problem is that i need to make synchronization completely myself whether all other Form elements are synchronized perfectly throw the Framework.

Maybe someone has already seen this problem and can help me. I think 1:n binding is nothing unusual in software engineering and it need to be a nice solution.

Thanks
Leonid

I usually rebuild containers after modifying data. Save button saves the data to the backend and fetches a new list to be shown in the table. That saves me from having any synchronizing logic on the table (let the backend take care of it) and the UI has always fresh data. That helps when you have multiple users using the app.