• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
  • Tim Holloway
  • Carey Brown
  • salvin francis

When do we need to call Composite.initWidget in a GWT App?

author and cow tipper
Posts: 5000
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm messing around with GWT, and as I test deeper waters, I'm seeing an exception about not calling initWidget. I've seen that Ryan Dewsbury in his book Google Web Toolkit Applications occasionally calls this method, but I'm not sure of the reasoning.

When is it necessary to call the initWidget method, and is it always a parent calling it on a child widget or something?

java.lang.AssertionError: This UIObject's element is not set; you may be missing a call to either Composite.initWidget() or UIObject.setElement()
at com.google.gwt.user.client.ui.UIObject.getElement(UIObject.java:512)


So, I had a Composite panel going on my EntryPoint. The composite panel had a VerticalPanel and a Grid widget. Apparently, I needed to call initWidget on the first widget that was going to act as a container on the page, which was the Grid. That then made my error go away.

-Cameron McKenzie
Water! People swim in water! Even tiny ads swim in water:
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!