我有一个<div>
文件My.html
:
<html><head>
<script type="text/javascript" language="javascript" src="
path/biz.path.nocache.js"></script></head>
<div id = "div_test"> </div>
现在我写了一个java
类来获取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);
}
以下是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;
}
}
类从哪里InheritWidget
扩展ContentContainer
。我还检查了控制台,它显示了我In Widget
。这意味着代码流是正确的。请告诉我应该怎么做才能加载AddTestWidget
in的内容HTML div
。
有没有我遗漏的部分?