public void testShow() throws Exception { String dialogTitle = "modal-title"; String cssClassName = "css-name"; baseDialog.init(dialogTitle, testWidget, cssClassName); baseDialog.show(); assertNotNull($(TEST_WIDGET_ID)); assertEquals(dialogTitle, $(BodyElement.TAG).find(MODAL_TITLE_TAG).asElement().getInnerHTML()); assertNotNull($(CLASS_DOM_PREFIX + cssClassName)); assertTrue(rootPanelContains(baseDialog.getModal())); assertEquals(1, baseDialog.getFooter().getChildrenList().size()); }
private void openWindow(Element rootElement) { /* This is the hackish area ... */ BodyElement printBody = openWindow(I18nUtils.tr("print.button"), printCss); printBody.getOwnerDocument().getElementById("printarea") .appendChild(rootElement); }
/** * Implementation note: Including a CSS as script with href in the HTML * document below does not work. We need to include the CSS inline, * pre-downloaded. * * @param printLabel * @param cssContent * CSS CONTENT, not URL. * @return */ public static native BodyElement openWindow(String printLabel, String cssContent) /*-{ var win = window.open("", "win", "width=940,height=400,status=1,resizeable=1,scrollbars=1"); win.document.open("text/html", "replace"); win.document.write("<html><head><style>\n" + cssContent + "\n</style></head><body><div><button onclick='window.print()'>" + printLabel + "</button></div><div id='printarea'/></body></html>"); win.document.close(); win.focus(); return win.document.body; }-*/;