Constructor overload?

GWT Designer allows you to quickly create the modules, composites, panels, remote services and other elements that comprise Google Web Tookit applications.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

Constructor overload?

Postby alex.d » Tue Jun 17, 2008 6:04 am

I tried to overload constructor in my composite class, but GWT-Designer can not build the designer view showing an error: "...unable to find any GUI elements in your source." The code looks like following:
Code: Select all
public class MyClass extends Composite
{
   public MyClass()
   {
      // initialising with the default parameter
      initMyClass(defaultParam); 
   }
   
   public MyClass(int param)
   {
      initMyClass(param);
   }
   
   public void initMyClass(int param)
   {
      \\here all the GUI initializing code
   }
}

As far as i can see, GUI elements should be defined in the constructor, or GWT-Designer doesn't recognize them. Is there any workaround?
alex.d
 
Posts: 35
Joined: Mon Jun 02, 2008 4:46 am

Re: Constructor overload?

Postby Eric Clayberg » Tue Jun 17, 2008 6:27 am

I got a similar error with your example, but that was due to the fact that the code you sent would not compile.

After fixing the compilation problems, it opened fine.

If you do plan on having multiple constructors, mark the one that should be used as the parsing root with a @wbp.parser.constructor Javadoc tag.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: Constructor overload?

Postby alex.d » Tue Jun 17, 2008 10:45 pm

Actually compiling the code was successful - i've had problems only with the designer view. But @wbp.parser.constructor worked - thank you Eric.
alex.d
 
Posts: 35
Joined: Mon Jun 02, 2008 4:46 am

Re: Constructor overload?

Postby Eric Clayberg » Fri Jun 20, 2008 8:54 am

alex.d wrote:But @wbp.parser.constructor worked

Good. At some point, we will probably add a quick fix to add that tag for you.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to GWT Designer

Who is online

Users browsing this forum: No registered users and 3 guests