View Poll Results: Content Provider vs View Model

Voters
15. You may not vote on this poll
  • I favour the Content Provider Pattern (JFace)

    9 60.00%
  • I favour the View Model Pattern (Swing)

    1 6.67%
  • I don't understand the diffrence between them

    5 33.33%
  • I don't care

    0 0%
Page 3 of 3 FirstFirst 123
Results 21 to 22 of 22

Thread: Content Provider vs View Model

  1. #21
    Join Date
    Aug 2004
    Location
    Germany, Magdeburg
    Posts
    279

    Default

    Personally I prefer to use the List instead of Object[] for reasons like flexibility, easy sorting and filtering etc. But it really is no big deal, I can of course convert the object array to a List inside the View anyway.
    You didn't got the main idea, I guess. The getAssociatedObjects method is not about transfering anything like ordering and filtering. Of cause this can be a list but why?

    This is not the model of the view only of the viewer (tree or what ever). It is also nothing to be synchronized with the domain or something like that. Please return me all your children and that's it.

    Please correct me if I'm wrong, but it seems to me we were talking a bit past each other and we don't really disagree that much on this issue.
    Maybe. The question raises about what you do, when you feed a tree viewer with some content.

    I would not have a labelprovider that is potentially tied to all my domain objects. Besides, using a Provider for simply setting a label seems like overkill. And you need labels for your Customer fields too. How do you handle those?
    It is only about the viewer's needs. A node of a tree or list is composed of an image and a text (label). This is what the label provider is all about. Using a table label provider is somewhat diffrent, too.

    I prefer having all labels and some other config info for each domain object in separate classes.
    In my framework I use reflection to get all fields from a domain model class using what I call a BeanPicker:
    You can do as you please. But the some other config and all labels is somewhat confusing. Again the label provider is only an adapter for your domain model elements and nothing more special.

    The BeanPicker has a few other methods like setting which property is editable etc.
    Your bean picker is quite heavy weight but seams to be very handy. I often used reflection, too but now I mostly try to avoid it. It is not quite good programming habbit to inspect an object. I would go for something like a type called NamedItem or something like that.

    But anyway your solution is quite nice, I guess. But it is nothing the label provider is about. It is simply an adapter for the viewer being used by some view. Nothing more but nothing less.


    Cheers,

    Martin (Kersten)[/quote]

  2. #22
    Join Date
    Sep 2004
    Location
    Ghent, Belgium
    Posts
    224

    Default

    for those who are interested, I created a project for the development of the ContentProvider pattern: http://sourceforge.net/projects/niceswing/

    There is not much too see (yet), but Martin and I will get started as soon as we can, 8)

    greets,

    Peter

Similar Threads

  1. Replies: 37
    Last Post: Dec 6th, 2007, 10:02 AM
  2. Replies: 1
    Last Post: Mar 13th, 2006, 07:53 PM
  3. Replies: 9
    Last Post: Nov 1st, 2005, 10:36 PM
  4. adding a model to the success view
    By mariuss in forum Web
    Replies: 8
    Last Post: Sep 1st, 2005, 09:28 PM
  5. Replies: 0
    Last Post: Jun 10th, 2005, 05:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •