public interface Resources extends ClientBundle {
@Source({Css.DEFAULT_CSS})
Css css();
}
public interface Css extends CssResource {
String DEFAULT_CSS = "test/client/app/start/StartView.gss";
String outerBox();
String iframe();
String test();
}
@UiField(provided = true)
Resources resources;
@UiField(provided = true)
Messages messages;
@Inject
public StartView(final Binder binder, Resources resources, Messages messages)
{
this.resources = resources;
resources.css().ensureInjected();
this.messages = messages;
initWidget(binder.createAndBindUi(this));
final IFrameElement iframe = Document.get().createIFrameElement();
FlowPanel innerBox = new FlowPanel() {
@Override
protected void onLoad() {
super.onLoad();
FlowPanel p1 = new FlowPanel();
p1.addStyleName(resources.css().test());
HTMLPanel panel = new HTMLPanel("Hello World!");
panel.setStyleName(resources.css().test()); // does not work
p1.add(panel);
final Document doc = iframe.getContentDocument();
BodyElement body = doc.getBody();
body.appendChild(p1.getElement());
panel.setStyleName(resources.css().test()); // does not work
p1.getElement().addClassName(resources.css().test()); // does not work
}
};
}
The former code inserts GWT Panels into an iframe. The problem is that I cannot set any css style. Even if I set the style with:
panel.setStyleName(resources.css().test()); // does not work
p1.getElement().addClassName(resources.css().test()); // does not work
both variants do not work. I know I can inject a general css file in the head of the iframe document, but I want to use the GWT resources.
How can I set the styles using CSS/GSS Resources for the Panels inside the iframe?
I want to insert GWT Widgets like FlowPanel, HTMLPanel inside and iframe using GWT.
panel.setStyleName(resources.css().test()); // does not work p1.getElement().addClassName(resources.css().test()); // does not work } }; }
The former code inserts GWT Panels into an iframe. The problem is that I cannot set any css style. Even if I set the style with:
panel.setStyleName(resources.css().test()); // does not work p1.getElement().addClassName(resources.css().test()); // does not work
both variants do not work. I know I can inject a general css file in the head of the iframe document, but I want to use the GWT resources.
How can I set the styles using CSS/GSS Resources for the Panels inside the iframe?
out.print("var $wnd = $wnd || document.getElementById("myiframe");");
But what do you mean by "an iframe created during "bootstrap"? Where do I create the iframe?
--
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/2bf5cdc5-9108-45ac-911b-44995474f518%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
As long as both $wnd and $doc exist in the frame where you plan on creating/rendering widgets, it shouldn't matter how you create or find the iframe. This should only mean that your frame must be created when that line of bootstrap code executes, either because you created it there, or because you found it.
On Fri, Jan 8, 2016 at 11:44 AM confile <michael....@googlemail.com> wrote:
I could extend the CrossSiteIframeLinker and change:L413: out.print("var $wnd = $wnd || window.parent;");toout.print("var $wnd = $wnd || document.getElementById("myiframe");");
But what do you mean by "an iframe created during "bootstrap"? Where do I create the iframe?
Am Dienstag, 5. Januar 2016 18:40:28 UTC+1 schrieb Thomas Broyer:--Ideally, probably use a custom linker that makes it so that $wnd and $doc point to an iframe created during "bootstrap" of the app.
Or as I said before, don't use widgets.
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscribe@googlegroups.com.