I am trying to use a button to open a new vaadin window and am having trouble displaying a web page in the window. I am trying to figure out how to get nodeWindow to display the External resource.
Here is my code.
Button button = new Button(caption, new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
Window nodeWindow = new Window("Node: " + caption);
new ExternalResource("http://www.google.com");
nodeWindow.setModal(true);
nodeWindow.setStyleName(Reindeer.WINDOW_LIGHT);
nodeWindow.setHeight("50%");
nodeWindow.setWidth("50%");
getUI().addWindow(nodeWindow);
}
});
button.setStyleName(Reindeer.BUTTON_LINK);
return button;
}
I was able to get this to work with the following code, but am running into another issue. The site that I am opening up in the BrowserFrame is an https site that requires a login. The site comes up fine along with the login page, however after a login, the BrowserFram window is blank. Any suggestions?
@Override
public Object generateCell(Table source, Object itemId,
Object columnId) {
final String caption = container.getItem(itemId).getBean()
.getNodeLabel();
final Byte nodeid = container.getItem(itemId).getBean()
.getNodeId();
final BrowserFrame browser = new BrowserFrame("Browser",
new ExternalResource("https://nms.company.com/nms/element/node.jsp?node=" + nodeid));
browser.setWidth("100%");
browser.setHeight("100%");
Button button = new Button(caption , new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
Window nodeWindow = new Window("Node: " + caption, browser);
nodeWindow.setModal(true);
nodeWindow.setStyleName(ChameleonTheme.ACCORDION_OPAQUE);
nodeWindow.setHeight("75%");
nodeWindow.setWidth("75%");
nodeWindow.
getUI().addWindow(nodeWindow);
}
});
button.setStyleName(ChameleonTheme.BUTTON_LINK);
return button;
}
It could be that the website intentionally prevents embedding, some websites such as Google Maps do that. Well, I suppose it could be unintentional as well.
Otherwise, there should not be difference in displaying a web page in a iframe (BrowserWindow) and as an actual browser window.