dev@jsftemplating.java.net

Re: [Fwd: New role requested in the jsftemplating project]

From: Ken Paulsen <Ken.Paulsen_at_Sun.COM>
Date: Wed, 03 May 2006 03:58:41 -0700

Hi Ed,

Yes, I've been making those types of conversions (I wasn't sure if you
meant something else I didn't yet know about... b/c there's a lot I
don't know!). If you look in the ...layout.template package, these are
the new files that I'm still working on and use generics. I only
recently decided to take advantage of 1.5 features...
LayoutElementBase.java has been around for over a year w/o little or no
changes.

Feel free to jump in and make the changes, I'd be happy to review the
changes before or after you check it in. Also, if you want to see CVS
notifications, you can subscribe to the cvs mail alias @
jsftemplating.dev.java.net. I also decided to cc the
dev_at_jsftemplating.dev.java.net alias b/c this might be of interest to
others on that alias.

Thanks!!

Ken

Ed Chen wrote:
> Ken,
>
> Here's one example of what I mean:
>
> in com.sun.jsftemplating.layout.descriptors.LayoutElementBase
>
> if
>
> private List _layoutElements = new ArrayList();
>
> is declared as
>
> private List<LayoutElement> _layoutElements = new
> ArrayList<LayoutElement>();
>
> and we change the interface method of LayoutElement from
>
> public List getChildLayoutElements() {
>
> to
>
> public List<LayoutElement> getChildLayoutElements() {
>
> then in all usage of LayoutElement.getChildLayoutElements() as in
> followings:
>
> [LayoutViewHandler.java at line 163, column 35] Iterator it =
> elt.getChildLayoutElements().iterator();
> [LayoutDefinition.java at line 166, column 23] Iterator it =
> parent.getChildLayoutElements().iterator();
> [LayoutElementBase.java at line 239, column 20] Iterator it =
> getChildLayoutElements().iterator();
> [CommandActionListener.java at line 199, column 20] Iterator it =
> elt.getChildLayoutElements().iterator();
>
> the iterator loop can be:
>
> Iterator<LayoutElement> it = elt.getChildLayoutElements().iterator();
> LayoutElement childElt;
> UIComponent child = null;
> while (it.hasNext()) {
> childElt = it.next();
> .....
>
> no need to the typecast the return object of it.next() into
> LayoutElement. if you like, i can change the above and send you a code
> diff for your review.
>
> thanks,
> Ed
>
> Ken Paulsen wrote:
>
>> Yep, that's the expected output... complete w/ some debug statements
>> that I was printing out.
>>
>> Can you explain more about the generic iterator? ...I'm still learning
>> the new features of Java 5 and probably just didn't know how to do
>> it. I have been switching over some of the iteration stuff using "for
>> (variable : list) {}" type of syntax. I've also started to use generics
>> variable definitions: "<type>"... but I haven't converted all the code
>> to do this yet.
>>
>> As I mentioned before, if you see something that you'd like to change...
>> feel free. ;)
>>
>> Ken
>>
>>
>>
>