Hi Jens,
I made these changes:
<code>
import com.google.gwt.dom.client.IFrameElement;
private static final IFrameElement iframe = Document.get().createIFrameElement();
FlowPanel innerBox = new FlowPanel();
innerBox.getElement().appendChild(iframe);
public static void setIFrame(IFrameElement ife, String url) {
try {
RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, url);
Request request = builder.sendRequest(null, new RequestCallback() {
@Override
public void onError(Request request, Throwable exception) {
Window.alert("Error setIFrame Load");
}
@Override
public void onResponseReceived(Request requestli, Response responseli) {
if (200 == responseli.getStatusCode()) {
fillIframe(ife,responseli.getText());
addHeadElement(ife, "mycss.css");
} else {
Window.alert("Oops Server Returned: " + responseli.getStatusCode());
}
}
final native void addHeadElement(IFrameElement iframe, String cssUrl) /*-{
setTimeout(function() {
var body;
if ( iframe.contentDocument ) {
// FF
iframe.contentDocument.designMode= "On";
iframe.contentDocument.execCommand('styleWithCSS',false,'false');
body= iframe.contentDocument.body;
}
else if ( iframe.contentWindow ) {
// IE
body = iframe.contentWindow.document.body;
}
if (body == null) {
return;
}
body.className = "custom-body-classname";
var head = body.previousSibling;
if(head == null) {
head = iframe.contentWindow.document.createElement("head");
iframe.contentWindow.document.childNodes[0].insertBefore(head, body);
}
var fileref = iframe.contentWindow.document.createElement("link");
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", cssUrl);
head.appendChild(fileref);
}, 50);
}-*/;
final native void fillIframe(IFrameElement iframe, String content) /*-{
var doc = iframe.document;
if(iframe.contentDocument)
doc = iframe.contentDocument; // For NS6
else if(iframe.contentWindow)
doc = iframe.contentWindow.document; // For IE5.5 and IE6
// Put the content in the iframe
doc.open();
doc.writeln(content);
doc.close();
}-*/;
});
} catch (Throwable e) {
Window.alert("Error During Log Out");
}
}
</code>
Clicking from outside renders the area, but the click from inside the iframe are broken, it offers a select to move rather then the click fo fill the area.
Also the iframe is not sized it is very small.
Any suggestions?