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