Adding tabs to a GWT TabPanel widget

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

Adding tabs to a GWT TabPanel widget

Postby Kelly » Mon Jul 26, 2010 10:28 am

Maybe I am going about this wrongly for WBP but..

When I am creating Java application that uses tabfolder and tabitems I normally create the contains of each tab in a separate java file using the composite class and the Choose Component feature of WBP. This way I do not have one java file that contains all of the code. This helps in a lot of ways.

So when I tried that in GWT using the TabPanel I found out that I can not use the GWT composite class as a tabitem in the TabPanel widget and I get an GWT designer error when I create a class that extends the AbsolutePanel and I add that to the code by hand and then switch to designer mode.

Code: Select all
package com.agilemesh.project.client;

import com.google.gwt.user.client.ui.AbsolutePanel;
import com.smartgwt.client.widgets.Img;

public class PortMapping extends AbsolutePanel {

   public PortMapping() {
      
      Img img = new Img("/images/ambanner5.png");
      img.setSize("430px", "100px");
      add(img, 10, 10);
   }
}


I can create the AboslutePanel class by hand and then use the designer to place widgets but I can not create it through the designer.

And the main code to add it is

Code: Select all
RootPanel rootPanel = RootPanel.get();
      
TabPanel tabPanel = new TabPanel();
rootPanel.add(tabPanel, 6, 6);
tabPanel.setSize("798px", "453px");

AbsolutePanel absolutePanel = new PortMapping();
tabPanel.add(absolutePanel, "Port", false);
absolutePanel.setSize("796px", "441px");


The above will generate an error then I switch to designer mode.
WindowBuilder encountered unexpected internal error. Please contact support.

java.lang.AssertionError: This UIObject's element is not set; you may be missing a call to either Composite.initWidget() or UIObject.setElement()


Am I trying something that should not be done this way or is a WBP fix needed?
Can you show me the correct way?

If you need the project source let me know.

Thanks
Kelly
 
Posts: 38
Joined: Wed Feb 02, 2005 8:22 am

Re: Adding tabs to a GWT TabPanel widget

Postby Kelly » Mon Jul 26, 2010 12:10 pm

I think something was out of sync and the above designer error was happening, sorry.

I can now enter designer mode with the PortMapping class in my main file and designer shows the PortMapping class.

But I am now getting an error from the webpage when I switch to designer mode.
See attachment for webpage error.
Attachments
weberror1.png
web page error when switching to designer mode.
weberror1.png (42.21 KiB) Viewed 586 times
Kelly
 
Posts: 38
Joined: Wed Feb 02, 2005 8:22 am

Re: Adding tabs to a GWT TabPanel widget

Postby Eric Clayberg » Tue Jul 27, 2010 2:01 pm

I did not have any problem adding a Composite as a page to a TabPanel.

The "Message from webpage" dialog you are getting appears to be caused by a bug in SmartGWT. We can easily reproduce it at runtime in a browser as well (see the attached test case).

I would suggest ignoring it and closing the dialog any time it appears. You can also report the bug to the SmartGWT developers (use the attached test case, if you like).
Attachments
ImageViewer.java
(1.13 KiB) Downloaded 17 times
PortMapping.java
(409 Bytes) Downloaded 9 times
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 1 guest