以下是GWT 生成的代码,这段代码直接在 html.body插入iframe, 我如何控制在我指定的 div 中插入iframe呢?
我不能直接修改生成的js吧, 如何在java中控制呢?
function arden_gwt_Main(){
var $wnd_0 = window, $doc_0 = document,
...
}
function maybeInjectFrame(){
if (!frameInjected) {
frameInjected = true;
var iframe = $doc_0.createElement('iframe');
...
iframe.tabIndex = -1;
$doc_0.body.appendChild(iframe);
...
}
}
问题补充
自己发现答案了:
RootPanel rootPanel = RootPanel.get("contentwrapper");
[code="java"]
This is an example of a host page for the Dashboard application. You can attach a Web Toolkit module to any HTML page you like, making it easy to add bits of AJAX functionality to existing pages without starting from scratch.
[/code]
[code="java"]RootPanel.get("slot1").add(button);
RootPanel.get("slot2").add(label);[/code]
这种方法也可以。
但是大部分情况是创建不同的Panel,并添加到body中去:
[code="java"]FlowPanel panel = new FlowPanel();
Button btn = new Button("dddd",false);
panel.add(btn);
RootPanel.get().add(panel);[/code]