Hi everyone,
I want to put a Widget in a new browser-window.
I took some code from here: http://stackoverflow.com/questions/4167570/opening-a-new-window-with-a-widget-in-gwt.
This is how it works so far:
My widget is in a TabLayoutPanel. I use getWidget() and put it in a new window (received from getBodyElement()).
At this point my TabLayoutpanel still has the Tab but without the widget. When i switched the Tab, the widget in the new browser-window disappeared / appeared depending on the tab i currently have selected ^^.
Thats why I did the following:
I also put the widget it in an invisible (size 0) absolutePanel.
Now the Tab from my TablayoutPanel is gone and Im able to switch tabs without make the widget in the new browser-window disappear.
But there is a problem:
The Widget works well now, but most of the style is gone now. Is there a way to fix the style ?
Or maybe better solution to open a widget in a new browser-window?
I dont want to create a new Entry-Point or anything like that :/
I attached two pictures to show you how it looks.
Regards,
Manuel
Here is some Code from the link + what I wrote to get it in an own browser-window:
The method to pop the widget into a seperate browser window:
private void popAsWindow(){
int selected = display.getDialogContainer().getSelectedIndex();
//Wir sind auf dem Kalender, also nix tun
if(selected==0)
return;
BodyElement bdElement = getBodyElement();
Widget aaa = display.getDialogContainer().getWidget(selected).asWidget();
display.getPopAsWindowContainer().add(aaa);
bdElement.getOwnerDocument().getElementById("mainbody")
.appendChild(aaa.getElement());
TabCount--;
display.getDialogContainer().selectTab(selected-1);
}
public native BodyElement getBodyElement() /*-{
var win = window.open("", "",
"width=940,height=400,status=1,resizeable=1,scrollbars=1",false); // a window object
win.document.open("text/html", "replace");
win.document
.write('<HTML><meta http-equiv="content-type" content="text/html; charset=UTF-8"><LINK REL="SHORTCUT ICON" HREF="favicon.ico"><link type="text/css" rel="stylesheet" href="Mash.css"><title>Meine App</title>'
+ "</HEAD><BODY><div class=\"mainpanel\"><div style=\"width: 100%; height: 54px;\"><div id=\"mainbody\"class=\"mainbody\" style=\"width: 100%;\"></div></div></div></BODY></HTML>");
win.document.close();
win.focus();
return win.document.body;
}-*/;
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment