/** * Sets the content display mode. Note that the window attributes will be ignored if the mode is changed to * something other than {@link WContent.DisplayMode#OPEN_NEW_WINDOW}. * * @param displayMode the content display mode to set. */ public void setDisplayMode(final DisplayMode displayMode) { content.setDisplayMode(displayMode); link.setOpenNewWindow(DisplayMode.OPEN_NEW_WINDOW.equals(content.getDisplayMode())); }
@Test public void testSetOpenNewWindow() { WLink link = new WLink(); Assert.assertTrue("Should open in new window by default", link.getOpenNewWindow()); link.setOpenNewWindow(false); Assert.assertFalse("Open in new window should be false", link.getOpenNewWindow()); link.setOpenNewWindow(true); Assert.assertTrue("Open in new window should be true", link.getOpenNewWindow()); }
/** * Construct the WContentLink. */ public WContentLink() { WindowAttributes attr = new WindowAttributes(); attr.setHeight(DEFAULT_HEIGHT); attr.setWidth(DEFAULT_WIDTH); attr.setWindowName(DEFAULT_NAME); attr.setResizable(true); link.setWindowAttrs(attr); link.setOpenNewWindow(true); add(link); add(content); }
exampleLink.setOpenNewWindow(true); exampleLink.setTargetWindowName("_blank"); } else { exampleLink.setOpenNewWindow(false);
root.add(link1); WLink link2 = new WLink("lets go to google in the same window", "http://www.google.com"); link2.setOpenNewWindow(false); root.add(link2);
link.setOpenNewWindow(false); assertSchemaMatch(link); assertXpathEvaluatesTo(TEXT, "normalize-space(//ui:link)", link); link.setOpenNewWindow(false); assertSchemaMatch(link); assertXpathUrlEvaluatesTo(LINK_URL, "//ui:link/@url", link); link.setToolTip(TITLE); link.setRel(REL); link.setOpenNewWindow(true); link.setImageUrl(IMAGE_URL); link.setRenderAsButton(true);
link.setOpenNewWindow(false); add(link);