I have a <div>
in My.html
file:
<html><head>
<script type="text/javascript" language="javascript" src="
path/biz.path.nocache.js"></script></head>
<div id = "div_test"> </div>
Now i wrote a java
class which fetch the test division
using Dom
.
private void AddWidget() throws Exception{
_obj = new testWidget(this._session);
_obj.setSize("100%", "100%");
_obj.AddTestWidget();
RootPanel rootpanel = getViewRootPanel(div_test); // returns the division id
rootpanel.clear();
rootpanel.add(_obj);
}
and following is TestWidget.java
:
public class TestWidget extends ContentContainer{
HorizontalPanel _base = new HorizontalPanel();
protected FlexTable _bill = new FlexTable();
Label lblTitle;
public TestWidget(Session s) {
super(s);
_base.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
_base.setWidth("100%");
initWidget(_base);
this._session= s;
_inheritwidget = new InheritWidget(session);
}
public Widget AddTestWidget() {
System.out.println("In widget");
lblTitle= new Label("Details");
lblTitle.setStyleName(Resources.INSTANCE.cssElements().labelBig());
lblTitle.getElement().getStyle().setPadding(3, Unit.PX);
_inheritwidget .setWidget(1, 0, lblBillingTitle);
_inheritwidget .setWidget(2, 0, billingWidget);
_base.add(_billing);
return _base;
}
}
where InheritWidget
class is extended from ContentContainer
.
I also check the console and it shows me In Widget
. It means the flow of code is right.
Please tell me what should i do to load the content of AddTestWidget
in HTML div
.
Is there any part which i am missing?
What is ContentContainer
? I am unable to find it in the GWT library. Your TestWidget
does not extend the GWT Widget class. Because of this, you can't use it as a widget. If you MUST extend ContentContainer
for your coding needs, you can implement the GWT isWidget
interface to let GWT know that it is a widget.