Example usage for com.vaadin.ui BrowserFrame setWidth

List of usage examples for com.vaadin.ui BrowserFrame setWidth

Introduction

In this page you can find the example usage for com.vaadin.ui BrowserFrame setWidth.

Prototype

@Override
    public void setWidth(String width) 

Source Link

Usage

From source file:org.opennms.features.pluginmgr.vaadin.config.karaf.SimpleIframeApplication.java

License:Apache License

@Override
public void init(VaadinRequest request) {
    if (iframePageUrl == null)
        throw new RuntimeException("iframePageUrl must not be null");

    m_request = request;//from w w w.j a v a  2  s  . c  o m

    m_rootLayout = new VerticalLayout();

    m_rootLayout = new VerticalLayout();
    m_rootLayout.setSizeFull();
    m_rootLayout.addStyleName("root-layout");
    setContent(m_rootLayout);

    // add header if provided
    if (headerComponent != null)
        m_rootLayout.addComponent(headerComponent);

    //add additional header page links if provided
    if (headerLinks != null) {
        // defining 2 horizontal layouts to force links to stay together
        HorizontalLayout horizontalLayout1 = new HorizontalLayout();
        horizontalLayout1.setWidth("100%");
        horizontalLayout1.setDefaultComponentAlignment(Alignment.TOP_RIGHT);
        HorizontalLayout horizontalLayout2 = new HorizontalLayout();
        horizontalLayout1.addComponent(horizontalLayout2);

        for (String name : headerLinks.keySet()) {
            String urlStr = headerLinks.get(name);
            ExternalResource urlResource = new ExternalResource(urlStr);
            Link link = new Link(name, urlResource);
            Label label = new Label("   ", ContentMode.HTML); // adds space between links
            horizontalLayout2.addComponent(link);
            horizontalLayout2.addComponent(label);
        }
        m_rootLayout.addComponent(horizontalLayout1);
    }

    ExternalResource iframPageResource = new ExternalResource(iframePageUrl);

    BrowserFrame browser = new BrowserFrame("", iframPageResource);
    browser.setWidth("100%");
    browser.setHeight("100%");
    m_rootLayout.addComponent(browser);

    // this forces the UI panel to use up all the available space below the header
    m_rootLayout.setExpandRatio(browser, 1.0f);

}

From source file:org.opennms.features.pluginmgr.vaadin.config.opennms.SimpleIframeInVaadinApplication.java

License:Open Source License

@Override
public void init(VaadinRequest request) {
    if (iframePageUrl == null)
        throw new RuntimeException("iframePageUrl must not be null");

    m_rootLayout = new VerticalLayout();
    m_rootLayout.setSizeFull();//ww  w  . ja  v a  2 s .c  om
    m_rootLayout.addStyleName("root-layout");
    setContent(m_rootLayout);
    addHeader(request);

    //add diagnostic page links
    if (headerLinks != null) {
        // defining 2 horizontal layouts to force links to stay together
        HorizontalLayout horizontalLayout1 = new HorizontalLayout();
        horizontalLayout1.setWidth("100%");
        horizontalLayout1.setDefaultComponentAlignment(Alignment.TOP_RIGHT);
        HorizontalLayout horizontalLayout2 = new HorizontalLayout();
        horizontalLayout1.addComponent(horizontalLayout2);

        for (String name : headerLinks.keySet()) {
            String urlStr = headerLinks.get(name);
            ExternalResource urlResource = new ExternalResource(urlStr);
            Link link = new Link(name, urlResource);
            Label label = new Label("   ", ContentMode.HTML); // adds space between links
            horizontalLayout2.addComponent(link);
            horizontalLayout2.addComponent(label);
        }
        m_rootLayout.addComponent(horizontalLayout1);
    }

    ExternalResource iframPageResource = new ExternalResource(iframePageUrl);

    BrowserFrame browser = new BrowserFrame("", iframPageResource);
    browser.setWidth("100%");
    browser.setHeight("100%");
    m_rootLayout.addComponent(browser);

    // this forces the UI panel to use up all the available space below the header
    m_rootLayout.setExpandRatio(browser, 1.0f);

}