private GwtCompilerShell gwt;
public RemovalHandler openIframe(final String id, final String url) {
final GwtCompileState gwtc = getCompileState(id);
IFrameElement iframe = gwtc.el;
if (iframe == null) {
DivElement sizer = Elements.createDivElement();
sizer.getStyle().setPosition("absolute");
sizer.getStyle().setLeft("0px");
sizer.getStyle().setRight("10px");
sizer.getStyle().setTop("50px");
sizer.getStyle().setBottom("20px");
gwtc.el = iframe = Browser.getDocument().createIFrameElement();
iframe.getStyle().setWidth("100%");
iframe.getStyle().setHeight("100%");
iframe.setAttribute("sandbox", "allow-same-origin allow-scripts");
iframe.setSrc(url);
sizer.appendChild(iframe);
final RemovalHandler[] remover = new RemovalHandler[1];
gwtc.header = GwtcModuleControlView.create(new GwtcController() {
@Override
public void onReloadClicked() {
GwtCompilePlace.PLACE.fireRecompile(id);
}
@Override
public void onCloseClicked() {
if (remover[0] != null) {
removeCompileState(id);
remover[0].remove();
remover[0] = null;
}
}
@Override
public void onRefreshClicked() {
gwtc.el.setSrc(url);
}
});
Element wrapper = gwtc.header.getElement();
gwtc.header.setHeader(id);
wrapper.appendChild(sizer);
wrapper.getStyle().setOverflow("hidden");
remover[0] = middleBar.addChild(wrapper, 450, 2);
} else {
iframe.setSrc("about:blank");
iframe.setSrc(url);
}
iframe.scrollIntoViewIfNeeded(true);
return new RemovalHandler() {
@Override
public void remove() {
removeCompileState(id);
}