Search in sources :

Example 1 with CustomLayout

use of com.vaadin.ui.CustomLayout in project opennms by OpenNMS.

the class SimpleIframeInVaadinApplication method addHeader.

private void addHeader(VaadinRequest request) {
    if (m_headerProvider != null) {
        try {
            setHeaderHtml(m_headerProvider.getHeaderHtml(((VaadinServletRequest) request).getHttpServletRequest()));
        } catch (final Exception e) {
            LOG.error("failed to get header HTML for request " + request.getPathInfo(), e.getCause());
        }
    }
    if (m_headerHtml != null) {
        InputStream is = null;
        try {
            is = new ByteArrayInputStream(m_headerHtml.getBytes());
            final CustomLayout headerLayout = new CustomLayout(is);
            headerLayout.setWidth("100%");
            headerLayout.addStyleName("onmsheader");
            m_rootLayout.addComponent(headerLayout);
        } catch (final IOException e) {
            closeQuietly(is);
            LOG.debug("failed to get header layout data", e);
        }
    }
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) CustomLayout(com.vaadin.ui.CustomLayout) VaadinServletRequest(com.vaadin.server.VaadinServletRequest) IOException(java.io.IOException) IOException(java.io.IOException)

Example 2 with CustomLayout

use of com.vaadin.ui.CustomLayout in project opennms by OpenNMS.

the class NodeMapsApplication method addHeader.

private void addHeader() {
    if (m_headerProvider != null) {
        try {
            URL pageUrl = Page.getCurrent().getLocation().toURL();
            setHeaderHtml(m_headerProvider.getHeaderHtml(new HttpServletRequestVaadinImpl(m_request, pageUrl)));
        } catch (final Exception e) {
            LOG.error("failed to get header HTML for request " + m_request.getPathInfo(), e.getCause());
        }
    }
    if (m_headerHtml != null) {
        InputStream is = null;
        try {
            is = new ByteArrayInputStream(m_headerHtml.getBytes());
            final CustomLayout headerLayout = new CustomLayout(is);
            headerLayout.setWidth("100%");
            headerLayout.addStyleName("onmsheader");
            m_rootLayout.addComponent(headerLayout);
        } catch (final IOException e) {
            closeQuietly(is);
            LOG.debug("failed to get header layout data", e);
        }
    }
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) CustomLayout(com.vaadin.ui.CustomLayout) IOException(java.io.IOException) URL(java.net.URL) IOException(java.io.IOException)

Example 3 with CustomLayout

use of com.vaadin.ui.CustomLayout in project opennms by OpenNMS.

the class PluginManagerAdminApplication method addHeader.

private void addHeader(VaadinRequest request) {
    if (m_headerProvider != null) {
        try {
            setHeaderHtml(m_headerProvider.getHeaderHtml(((VaadinServletRequest) request).getHttpServletRequest()));
        } catch (final Exception e) {
            LOG.error("failed to get header HTML for request " + request.getPathInfo(), e.getCause());
        }
    }
    if (m_headerHtml != null) {
        InputStream is = null;
        try {
            is = new ByteArrayInputStream(m_headerHtml.getBytes());
            final CustomLayout headerLayout = new CustomLayout(is);
            headerLayout.setWidth("100%");
            headerLayout.addStyleName("onmsheader");
            m_rootLayout.addComponent(headerLayout);
        } catch (final IOException e) {
            closeQuietly(is);
            LOG.debug("failed to get header layout data", e);
        }
    }
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) CustomLayout(com.vaadin.ui.CustomLayout) VaadinServletRequest(com.vaadin.server.VaadinServletRequest) IOException(java.io.IOException) IOException(java.io.IOException)

Example 4 with CustomLayout

use of com.vaadin.ui.CustomLayout in project opennms by OpenNMS.

the class TopologyUI method addHeader.

private void addHeader() {
    if (m_headerHtml != null && m_showHeader) {
        InputStream is = null;
        try {
            is = new ByteArrayInputStream(m_headerHtml.getBytes());
            final CustomLayout headerLayout = new CustomLayout(is);
            headerLayout.setWidth("100%");
            headerLayout.addStyleName("onmsheader");
            m_rootLayout.addComponent(headerLayout);
        } catch (final IOException e) {
            try {
                is.close();
            } catch (final IOException closeE) {
                LOG.debug("failed to close HTML input stream", closeE);
            }
            LOG.debug("failed to get header layout data", e);
        }
    }
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) CustomLayout(com.vaadin.ui.CustomLayout) IOException(java.io.IOException)

Aggregations

CustomLayout (com.vaadin.ui.CustomLayout)4 ByteArrayInputStream (java.io.ByteArrayInputStream)4 IOException (java.io.IOException)4 InputStream (java.io.InputStream)4 VaadinServletRequest (com.vaadin.server.VaadinServletRequest)2 URL (java.net.URL)1