RE: Re[2]: Barracuda: Patch for IterativeListModel
Jacob Kjome <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <[email protected]> |
Hi Christian,
See comments below...
At 03:57 PM 12/6/2002 -0500, you wrote:
> > And given that we are modifying "List" to "Collection", maybe
> > this class should be called "IterativeCollectionModel"?
>
>I would actually vote for AbstractIterativeListModel. The 'Abstract' needs
>to be there to follow naming convention used everywhere else in Barracuda.
>I'd stick with 'List' to keep it short, and to reflect that that's really
>the nature of the data structure - you iterate over a "list" of items;
>whether that list comes from a List, a Collection, and Array, or something
>else is really irrelevant (IMO).
Ok, that's fine with me, except that the Diez' IterativeListModel isn't
abstract. Right now it is defined as:
"public class IterativeListModel extends AbstractTemplateModel implements
IterativeModel"
and the examples for usage show it being instantiated directly...
IterativeListModel ilm = new IterativeListModel() {
public Object getItem(Strink key) {
if(key.equals("MYKEY"))= {
return _current;
}
}}
If we made it abstract, you couldn't do as the examples suggest. So, I
guess that needs to be figured out as well.
I still think postIterate() should clean up after itself. I'll leave that
decision up to you and Diez, though.
> > Also, why aren't the models in the core.comp.model package?
>
>The model package is only there to hold a couple of low-level swing-style
>event notification interfaces needed to define the callback mechanism
>between components and their models. The basic idea is that a user should
>never have to interact with these "behind the surface" interfaces, so
>they're placed out of the way in another package.
Ok
> > On that same note, it might be nice to put the interface classes
> > in their own package separated from the implementations.
>
>I'd really rather not do this, on the basis that
>
>a) it makes it much harder to keep the UML diagrams up to date
>
>b) it makes it harder for programmers to know where things are; right now,
>if you are going to use the components, you pretty much know that everything
>you need is in comp or comp.helper; same thing with event and event.helper.
>
>c) we'd have further refactoring, and on really core packages at that. I'd
>like to avoid this if possible at this point.
I can live with that.
>Just my .02...
>Christian
>----------------------------------------------
>Christian Cryder [[email protected]]
>Internet Architect, ATMReports.com
>Barracuda - http://barracuda.enhydra.org
>----------------------------------------------
>"Coffee? I could quit anytime, just not today"
>
>
> > -----Original Message-----
> > From: [email protected] [mailto:[email protected]]On
> > Behalf Of Jacob Kjome
> > Sent: Friday, December 06, 2002 3:08 PM
> > To: Christian Cryder
> > Subject: Re[2]: Barracuda: Patch for IterativeListModel
> >
> >
> >
> > After looking at the IterativeListModel, I've got a couple
> > comments....
> >
> > I hadn't realized that this was in the contrib package (oversight). That
> > being true, we should be able to modify it to our liking before moving
> > it to the core.comp package as suggested by Chistian. Here are a
> > couple things we should think about:
> >
> > 1. Given the javadoc:
> > "Use this class to build IterativeModels bassed on arbitrary Lists.
> > The class will iterate over the List and store the current item
> > in the _current variable."
> > And given that we are modifying "List" to "Collection", maybe
> > this class should be called "IterativeCollectionModel"?
> >
> > 2. postIterate() is implemented, but does nothing in
> > InterativeListModel. Seems like it should do some default cleanup
> > like nulling the iterator or something.
> >
> >
> > Also, why aren't the models in the core.comp.model package?
> > Everything gets lumped in the core.comp package. On that same note,
> > it might be nice to put the interface classes in their own package
> > separated from the implementations. Just a thought. I don't suppose
> > that will happen since it would affect all existing Barracuda apps,
> > but it might be worth the thought. We've already done some good
> > organization. Why not some more?
> >
> > Jake
> >
> >
> > Friday, December 06, 2002, 1:18:07 PM, you wrote:
> >
> > CC> I'm +1 on this, and can go ahead an apply the patch, but
> > first I'd like to
> > CC> give Diez a change to comment on it before I do (since he
> > actually owns the
> > CC> code).
> >
> > CC> Diez? Is there any reason not to do this?
> >
> > CC> On a slightly different note, is there any reason why we
> > shouldn't move this
> > CC> into the core.comp package? I don't see any real dependencies...
> >
> > CC> Christian
> > CC> ----------------------------------------------
> > CC> Christian Cryder [[email protected]]
> > CC> Internet Architect, ATMReports.com
> > CC> Barracuda - http://barracuda.enhydra.org
> > CC> ----------------------------------------------
> > CC> "Coffee? I could quit anytime, just not today"
> >
> >
> > >> -----Original Message-----
> > >> From: [email protected]
>[mailto:[email protected]]On
> >> Behalf Of Stefan Armbruster
> >> Sent: Friday, December 06, 2002 5:59 AM
> >> To: [email protected]
> >> Subject: Barracuda: Patch for IterativeListModel
> >>
> >>
> >> Hi,
> >>
> >> IterativeListModel uses internally a List. The only operation called
> >> upon this is iterator(). Since List extends Collection, it is sufficient
> >> to use Collection instead of List inside IterativeListModel.
> >> The attached patch solves this.
> >>
> >> There's no need to modify any code that uses IterativeListModel, only a
> >> recompile is necessary.
> >>
> >> The benefit from this is, you can pass e.g. Set to IterativeListModel.
> >>
> >> Regards,
> >> Stefan
> >>
>
>CC> _______________________________________________
>CC> Barracuda mailing list
>CC> [email protected]
>CC> http://www.enhydra.org/mailman/listinfo.cgi/barracuda
>CC> FAQ - http://www.jguru.com/faq/Barracuda
>
>
>
>--
>Best regards,
> Jacob mailto:[email protected]
>
>_______________________________________________
>Barracuda mailing list
>[email protected]
>http://www.enhydra.org/mailman/listinfo.cgi/barracuda
>FAQ - http://www.jguru.com/faq/Barracuda
>
>_______________________________________________
>Barracuda mailing list
>[email protected]
>http://www.enhydra.org/mailman/listinfo.cgi/barracuda
>FAQ - http://www.jguru.com/faq/Barracuda