0

In C#, there are observable collections. In Java how do I represent a list a models? Suppose I have a model Item. I want to show users a list of Items. Do I create a ItemsModel (notice plural, encapsulating an ArrayList<Item>) then in my ItemsView bind (listen to property change events) to that? This model will also need to listen to PropertyChange events from its underlying Item. Is this the right way of implementing this? Is there a better way?

Jiew Meng
  • 84,767
  • 185
  • 495
  • 805

2 Answers2

0

A possible solution could be the Eclipse Databinding. It let's you create a binding from your POJOs to certain SWT Controls. For your special case with Items, you could use the Master-Detail Binding mechanism, for an example see http://wiki.eclipse.org/JFace_Data_Binding/Snippets#Master_Detail

Tom Seidel
  • 9,525
  • 1
  • 26
  • 38
0

Depending on the source of your domain model, you could consider changing it to use Eclipse Modeling Framework (EMF). EMF have complete a notification framework for all changes made to the model, which makes it easy to use and bind to. Eclipse Databinding - as mentioned by Tom Seidel - also bind to EMF.

Tonny Madsen
  • 12,628
  • 4
  • 31
  • 70