Thursday, June 24, 2010

Re: Flyweight version of Element? Trying to implement "find an element by CSS Selector"

Thanks very much for that info, I'm sure it will come in handy any day
now. For the moment I have kept aside my home-made selector system in
favour of simply keeping an ArrayList of element IDs. I know the IDs
of the elements I'm creating because as I create the elements I am
giving them and ID and the storing that in a simple
ArrayList<Integer>. Then, later when I want to "select" those elements
I just loop through the array list and call DOM.getElementByID(ID)
method. This seems to be ok for me because getElementById is a native
browser function and so one would hope that it's implemented very
efficiently, and also on any given page I will have at most about 80
of these selectable elements. The performance cost is cheap.

On Jun 24, 3:36 pm, Chris Lercher <cl_for_mail...@gmx.net> wrote:
> On Jun 24, 1:08 pm, Paul Schwarz <paulsschw...@gmail.com> wrote:
>
> > But getting back to GWTQuery, it looks interesting, but now that I've
> > solved my "Element selector woes" why else should I delve into
> > GWTQuery?
>
> No need to do that, but GWTQuery provides the easy selector syntax you
> mentioned in your first post. So it's very suitable to find elements
> in an "unknown" part of the DOM.
>
> However - especially if you build the DOM via GWT - you can also hold
> direct references to your elements, and put them in ArrayLists etc.,
> if you can afford the bit of extra runtime memory for these
> references. Then you don't have to search them anymore.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment