// Assume that the host HTML has elements defined whose
// IDs are "slot1", "slot2". In a real app, you probably
would not want
// to hard-code IDs. Instead, you could, for example, search
for all
// elements with a particular CSS class and replace them with
widgets.
//
The part I thought was interesting was searching for elements with a
particular CSS class.
I don't really see any easy way to do that with GWT. Did I miss
something?
I know that prototype allows elements to be found using a css
selector rather than an ID, but I didn't see any similar
functionality in GWT.
For integrating GWT into existing HTML pages it might be handy to
have something like
RootPanel.getElementsByCSS(String selector)
or perhaps more appropriately a DOM method for that
DOM.getElementsByCSS(Element element, String selector)
then you could for instance find all elements of class "TD.my-gwt-
widget" by doing.
List element = DOM.getElementsByCSS(RootPanel.getBodyElement(),
"TD.my-gwt-widget");
If this is something that others would find useful I would be happy
to file a feature request.
-jason
List elements = SearchUtils.findElementsForClass("className");
http://gwt-widget.sourceforge.net/docs/xref/index.html
Having the ability to use any valid CSS selector would be extremely
useful I would think.
Rob
[source]
http://gwt-widget.sourceforge.net/docs/xref/org/gwtwidgets/client/util/SearchUtils.html
[javadoc]
http://gwt-widget.sourceforge.net/docs/apidocs/org/gwtwidgets/client/util/SearchUtils.html
...And I had the incorrect signature.
List elements = SearchUtils.findElementsForClass(widget.getElement(),
"className");
Rob