public static ExternalResource testRule = new ExternalResource(){ @Override protected void before() throws Throwable{
public static class UsesExternalResource { Server myServer = new Server(); @Rule public ExternalResource resource = new ExternalResource() { @Override protected void before() throws Throwable { myServer.connect(); }; @Override protected void after() { myServer.disconnect(); }; }; @Test public void testFoo() { new Client().run(myServer); } }
@Override public Resource parse(String value) { // default behavior for HTTP, HTTPS, FTP and FTPS return new ExternalResource(value); }
/** * Creates a window opener that will open windows to the provided URL. * * @param url * the URL to open in the window */ public BrowserWindowOpener(String url) { this(new ExternalResource(url)); }
/** * Creates a new open resource. * * @param url * The URL to open * @param name * The name of the target window * @param width * The width of the target window * @param height * The height of the target window * @param border * The border style of the target window * @param tryToOpenAsPopup * Should try to open as a pop-up */ private OpenResource(String url, String name, int width, int height, BorderStyle border, boolean tryToOpenAsPopup) { this(new ExternalResource(url), name, width, height, border, tryToOpenAsPopup); }
/** * Sets the provided URL {@code url} for this instance. The {@code url} will * be opened in a new browser window/tab when the extended component is * clicked. * * @since 7.4 * * @param url * URL to open */ public void setUrl(String url) { setResource(new ExternalResource(url)); }
/** * Creates a window opener that will open windows containing the provided UI * using the provided path. * * @param uiClass * the UI class that should be opened when the extended component * is clicked * @param path * the path that the UI should be bound to */ public BrowserWindowOpener(Class<? extends UI> uiClass, String path) { // Create a Resource with a translated URL going to the VaadinService this(new ExternalResource( ApplicationConstants.APP_PROTOCOL_PREFIX + path), new BrowserWindowOpenerUIProvider(uiClass, path)); }
/** * @see org.opencms.ui.apps.I_CmsWorkplaceAppConfiguration#getIcon() */ public Resource getIcon() { return new ExternalResource(OpenCmsTheme.getImageLink("apps/workplace-traditional.png")); }
/** * @see org.opencms.ui.apps.I_CmsWorkplaceAppConfiguration#getIcon() */ public Resource getIcon() { return new ExternalResource(OpenCmsTheme.getImageLink("apps/sitemap.png")); }
/** * @see org.opencms.ui.apps.I_CmsWorkplaceAppConfiguration#getIcon() */ public Resource getIcon() { return new ExternalResource(OpenCmsTheme.getImageLink("apps/explorer.png")); }
/** * @see org.opencms.ui.apps.I_CmsWorkplaceAppConfiguration#getIcon() */ public Resource getIcon() { return new ExternalResource(OpenCmsTheme.getImageLink("apps/scheduler.png")); }
/** * Gets the icon resource for the given workplace resource path.<p> * * @param subPath the path relative to the workplace resources * * @return the icon resource */ ExternalResource getIconResource(String subPath) { String resPath = CmsWorkplace.getResourceUri(subPath); return new ExternalResource(resPath); }
table.addGeneratedColumn("link", new Table.ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { Item item = source.getItem(itemId); String columnValue = String.valueOf(item.getItemProperty(columnId).getValue()); String urlValue = columnValue; // Assume columnValue contains full url including protocol, e.g. http://stackoverflow.com String urlDescription = columnValue; // Description is the same as the return new Link(urlDescription, new ExternalResource(urlValue)); } })
@Override public void refresh() { m_verticalLayout.removeAllComponents(); m_browserFrame = new BrowserFrame(null, new ExternalResource("/opennms/rtc/fullscreen-categories-box.jsp")); m_browserFrame.setSizeFull(); m_verticalLayout.addComponent(m_browserFrame); }
@Override public void setUrl(String url) { final BrowserFrame page = new BrowserFrame(null, new ExternalResource(url)); page.setSizeFull(); layout.removeAllComponents(); layout.addComponent(page); } }
HorizontalLayout hor = new HorizontalLayout(); final Link link = new Link("Click on Me!", new ExternalResource("http://www.google.com")); hor.addComponent(link); hor.addLayoutClickListener(new LayoutClickListener() { @Override public void layoutClick(LayoutClickEvent event) { // capture the click here and do whatever you'd like to do, e.g. // if ( event.getClickedComponent() != null ) { // if(event.getClickedComponent().equals(link)) {} } });
@Override public void valueChange(Property.ValueChangeEvent valueChangeEvent) { String newImage = "/opennms/charts?chart-name=" + valueChangeEvent.getProperty().getValue(); Image image = new Image(null, new ExternalResource(newImage)); image.setStyleName("preview"); panel.setContent(image); } });
@Override public void refresh() { m_verticalLayout.removeAllComponents(); String searchString = ""; if (getDashletSpec().getParameters().containsKey("search")) { searchString = getDashletSpec().getParameters().get("search"); } BrowserFrame browserFrame = new BrowserFrame(null, new ExternalResource("/opennms/node-maps#search/" + searchString)); browserFrame.setSizeFull(); m_verticalLayout.addComponent(browserFrame); }
Embedded e = new Embedded(null, new ExternalResource( "http://www.youtube.com/v/meXvxkn1Y_8&hl=en_US&fs=1&")); e.setMimeType("application/x-shockwave-flash"); e.setParameter("allowFullScreen", "true"); e.setWidth("320px"); e.setHeight("265px"); addComponent(e);
public InfoWindow(final URL embeddedURL, LabelCreator labelCreator) { infoBrowser = new Embedded("", new ExternalResource(embeddedURL)); String label = labelCreator == null ? "" : labelCreator.getLabel(); setCaption(label); setResizable(false); setModal(true); /*Adds the browser to the main layout*/ VerticalLayout layout = new VerticalLayout(); layout.addComponent(infoBrowser); setContent(layout); }