tags:

views:

72

answers:

1

I have a HTML file that is linked to a Java class using the Google Web Toolkit.

Within the HTML I have defined several buttons and text fields using standard HTML.

I am trying to get those elements into the GWT class so that I can manipulate them.

Is there a way to use GWT to get those elements and put them into object?

For example, in the com.google.gwt.user.client.ui.Button class there is a constructor that can be passed an Element. I figured that is where I could pass in the Element after retrieving it via another method.

A: 

You can ask for elements within the document...

NodeList<Element> buttonElements = Document.get().getElementsByTagName("button");

Also you could 'reach' into the JS itself by writing native JS method in your Java-class: Writing Java methods with JavaScript, and retrieve all forms via W3C DOM document.forms collection.

Jaroslav Záruba