Example usage for com.vaadin.ui Embedded TYPE_BROWSER

List of usage examples for com.vaadin.ui Embedded TYPE_BROWSER

Introduction

In this page you can find the example usage for com.vaadin.ui Embedded TYPE_BROWSER.

Prototype

int TYPE_BROWSER

To view the source code for com.vaadin.ui Embedded TYPE_BROWSER.

Click Source Link

Document

Browser ("iframe") type.

Usage

From source file:eu.lod2.Siren.java

License:Apache License

public Siren(LOD2DemoState st) {

    // The internal state
    state = st;/*  w  w  w .j  a  v  a 2 s.c o  m*/

    Embedded browser = new Embedded();
    try {

        URL url = new URL(state.getHostName(false) + ":8080/siren");

        browser = new Embedded("", new ExternalResource(url));
        browser.setType(Embedded.TYPE_BROWSER);
        browser.setSizeFull();
        //panel.addComponent(browser);
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }

    // The composition root MUST be set
    setCompositionRoot(browser);
}

From source file:eu.lod2.SPARQLPoolParty.java

License:Apache License

public SPARQLPoolParty(LOD2DemoState st) {

    // The internal state 
    state = st;/* ww  w  .ja va 2  s  .c  o  m*/

    Embedded browser = new Embedded();
    try {
        URL url = new URL("http://prod.poolparty.punkt.at/PoolParty/sparql/semweb");
        browser = new Embedded("", new ExternalResource(url));
        browser.setType(Embedded.TYPE_BROWSER);
        browser.setSizeFull();
        //panel.addComponent(browser);
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
    ;

    // The composition root MUST be set
    setCompositionRoot(browser);
}

From source file:eu.lod2.VirtuosoISPARQL.java

License:Apache License

public VirtuosoISPARQL(LOD2DemoState st) {

    // The internal state and 
    state = st;/*ww w  . j a  v  a2 s .com*/

    Embedded browser = new Embedded();
    try {
        URL url;
        if (state.getHostName().equals("http://localhost:8080")) {
            url = new URL("http://localhost:8890/isparql");
        } else {
            url = new URL(state.getHostName() + "/virtuoso/isparql");
        }
        ;
        browser = new Embedded("", new ExternalResource(url));
        browser.setType(Embedded.TYPE_BROWSER);
        browser.setSizeFull();
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
    ;

    // The composition root MUST be set
    setCompositionRoot(browser);
}

From source file:eu.lod2.VirtuosoSPARQL.java

License:Apache License

public VirtuosoSPARQL(LOD2DemoState st) {

    // The internal state and 
    state = st;// w  ww . j ava2  s  .c  o m

    final String query = "SELECT * where {?s ?p ?o.} LIMIT 20";
    String encodedQuery = "";
    String encodedGraphName = "";
    try {
        encodedQuery = URLEncoder.encode(query, "UTF-8");
        encodedGraphName = URLEncoder.encode(state.getCurrentGraph(), "UTF-8");
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    ;

    Embedded browser = new Embedded();
    try {
        URL url;
        if (state.getHostName().equals("http://localhost:8080")) {
            url = new URL("http://localhost:8890/sparql");
        } else {
            url = new URL(state.getHostName() + "/virtuoso/sparql");
        }
        ;
        browser = new Embedded("", new ExternalResource(url));
        browser.setType(Embedded.TYPE_BROWSER);
        browser.setSizeFull();
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
    ;

    // The composition root MUST be set
    setCompositionRoot(browser);
}

From source file:gov.va.ds4p.ds4pmobileportal.ui.eHealthExchange.java

License:Open Source License

private Popover getPopoverPDF(String val, String title) {
    Popover popover = new Popover();
    popover.setModal(true);//from   w  w w.j a va2  s  .c o  m
    popover.setClosable(true);
    popover.setWidth("700px");
    popover.setHeight("100%");
    CssLayout popLayout = new CssLayout();
    popLayout.setSizeFull();
    popLayout.setMargin(true);

    NavigationView navView = new NavigationView(popLayout);
    navView.setCaption(title);

    CssLayout layout2 = new CssLayout();
    Embedded pdf = new Embedded();
    pdf.setType(Embedded.TYPE_BROWSER);
    pdf.setMimeType("application/pdf");
    pdf.setSizeFull();
    pdf.setWidth("100%");
    pdf.setHeight("700px");

    pdf.setSource(createPdf(val));

    layout2.addComponent(pdf);

    popLayout.addComponent(layout2);

    Button close = new Button(null, new ClickListener() {

        public void buttonClick(ClickEvent event) {
            event.getButton().getWindow().getParent().removeWindow(event.getButton().getWindow());
        }
    });
    close.setIcon(new ThemeResource("../runo/icons/64/cancel.png"));
    navView.setRightComponent(close);

    popover.setContent(navView);

    return popover;
}

From source file:nl.amc.biolab.nsg.display.component.ProcessingStatusForm.java

License:Open Source License

private void showHTML(final String htmlContent, final Application app)
        throws IllegalArgumentException, NullPointerException {
    app.getMainWindow().addWindow(new Window() {
        private static final long serialVersionUID = -2307854110750435145L;

        {/* w ww . j av a  2s .c  o  m*/
            center();
            setWidth("75%");
            setHeight("600px");
            StreamResource.StreamSource source = new StreamResource.StreamSource() {
                private static final long serialVersionUID = -3745013501121916404L;

                public InputStream getStream() {
                    return new ByteArrayInputStream(htmlContent.getBytes());
                }
            };
            StreamResource resource = new StreamResource(source, "TestReport.html", app);
            Embedded e = new Embedded();
            e.setMimeType("text/html");
            e.setType(Embedded.TYPE_BROWSER);
            e.setWidth("100%");
            e.setHeight("590px");
            e.setSource(resource);
            addComponent(e);
        }
    });
}

From source file:org.activiti.explorer.ui.management.processinstance.ProcessInstanceDetailPanel.java

License:Apache License

protected void addProcessImage() {
    ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService)
            .getDeployedProcessDefinition(processDefinition.getId());

    // Only show when graphical notation is defined
    if (processDefinitionEntity != null) {

        boolean didDrawImage = false;

        if (ExplorerApp.get().isUseJavascriptDiagram()) {
            try {

                final InputStream definitionStream = repositoryService.getResourceAsStream(
                        processDefinition.getDeploymentId(), processDefinition.getResourceName());
                XMLInputFactory xif = XmlUtil.createSafeXmlInputFactory();
                XMLStreamReader xtr = xif.createXMLStreamReader(definitionStream);
                BpmnModel bpmnModel = new BpmnXMLConverter().convertToBpmnModel(xtr);

                if (!bpmnModel.getFlowLocationMap().isEmpty()) {

                    int maxX = 0;
                    int maxY = 0;
                    for (String key : bpmnModel.getLocationMap().keySet()) {
                        GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(key);
                        double elementX = graphicInfo.getX() + graphicInfo.getWidth();
                        if (maxX < elementX) {
                            maxX = (int) elementX;
                        }// w  ww  . j a  v a  2 s  .  c  om
                        double elementY = graphicInfo.getY() + graphicInfo.getHeight();
                        if (maxY < elementY) {
                            maxY = (int) elementY;
                        }
                    }

                    Panel imagePanel = new Panel(); // using panel for scrollbars
                    imagePanel.addStyleName(Reindeer.PANEL_LIGHT);
                    imagePanel.setWidth(100, UNITS_PERCENTAGE);
                    imagePanel.setHeight(100, UNITS_PERCENTAGE);
                    URL explorerURL = ExplorerApp.get().getURL();
                    URL url = new URL(explorerURL.getProtocol(), explorerURL.getHost(), explorerURL.getPort(),
                            explorerURL.getPath().replace("/ui", "")
                                    + "diagram-viewer/index.html?processDefinitionId="
                                    + processDefinition.getId() + "&processInstanceId="
                                    + processInstance.getId());
                    Embedded browserPanel = new Embedded("", new ExternalResource(url));
                    browserPanel.setType(Embedded.TYPE_BROWSER);
                    browserPanel.setWidth(maxX + 350 + "px");
                    browserPanel.setHeight(maxY + 220 + "px");

                    HorizontalLayout panelLayoutT = new HorizontalLayout();
                    panelLayoutT.setSizeUndefined();
                    imagePanel.setContent(panelLayoutT);
                    imagePanel.addComponent(browserPanel);

                    panelLayout.addComponent(imagePanel);

                    didDrawImage = true;
                }

            } catch (Exception e) {
                LOGGER.error("Error loading process diagram component", e);
            }
        }

        if (!didDrawImage && processDefinitionEntity.isGraphicalNotationDefined()) {
            ProcessEngineConfiguration processEngineConfiguration = ProcessEngines.getDefaultProcessEngine()
                    .getProcessEngineConfiguration();
            ProcessDiagramGenerator diagramGenerator = processEngineConfiguration.getProcessDiagramGenerator();
            StreamResource diagram = new ProcessDefinitionImageStreamResourceBuilder().buildStreamResource(
                    processInstance, repositoryService, runtimeService, diagramGenerator,
                    processEngineConfiguration);

            if (diagram != null) {
                Label header = new Label(i18nManager.getMessage(Messages.PROCESS_HEADER_DIAGRAM));
                header.addStyleName(ExplorerLayout.STYLE_H3);
                header.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
                header.addStyleName(ExplorerLayout.STYLE_NO_LINE);
                panelLayout.addComponent(header);

                Embedded embedded = new Embedded(null, diagram);
                embedded.setType(Embedded.TYPE_IMAGE);
                embedded.setSizeUndefined();

                Panel imagePanel = new Panel(); // using panel for scrollbars
                imagePanel.setScrollable(true);
                imagePanel.addStyleName(Reindeer.PANEL_LIGHT);
                imagePanel.setWidth(100, UNITS_PERCENTAGE);
                imagePanel.setHeight(100, UNITS_PERCENTAGE);

                HorizontalLayout panelLayoutT = new HorizontalLayout();
                panelLayoutT.setSizeUndefined();
                imagePanel.setContent(panelLayoutT);
                imagePanel.addComponent(embedded);

                panelLayout.addComponent(imagePanel);
            }
        }
    }
}

From source file:org.activiti.explorer.ui.process.ProcessDefinitionInfoComponent.java

License:Apache License

protected void initImage() {
    processImageContainer = new VerticalLayout();

    Label processTitle = new Label(i18nManager.getMessage(Messages.PROCESS_HEADER_DIAGRAM));
    processTitle.addStyleName(ExplorerLayout.STYLE_H3);
    processImageContainer.addComponent(processTitle);

    boolean didDrawImage = false;

    if (ExplorerApp.get().isUseJavascriptDiagram()) {
        try {//from w w  w  .  j a  v a  2 s . c  o m

            final InputStream definitionStream = repositoryService.getResourceAsStream(
                    processDefinition.getDeploymentId(), processDefinition.getResourceName());
            XMLInputFactory xif = XmlUtil.createSafeXmlInputFactory();
            XMLStreamReader xtr = xif.createXMLStreamReader(definitionStream);
            BpmnModel bpmnModel = new BpmnXMLConverter().convertToBpmnModel(xtr);

            if (!bpmnModel.getFlowLocationMap().isEmpty()) {

                int maxX = 0;
                int maxY = 0;
                for (String key : bpmnModel.getLocationMap().keySet()) {
                    GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(key);
                    double elementX = graphicInfo.getX() + graphicInfo.getWidth();
                    if (maxX < elementX) {
                        maxX = (int) elementX;
                    }
                    double elementY = graphicInfo.getY() + graphicInfo.getHeight();
                    if (maxY < elementY) {
                        maxY = (int) elementY;
                    }
                }

                Panel imagePanel = new Panel(); // using panel for scrollbars
                imagePanel.addStyleName(Reindeer.PANEL_LIGHT);
                imagePanel.setWidth(100, UNITS_PERCENTAGE);
                imagePanel.setHeight(100, UNITS_PERCENTAGE);

                URL explorerURL = ExplorerApp.get().getURL();
                URL url = new URL(explorerURL.getProtocol(), explorerURL.getHost(), explorerURL.getPort(),
                        explorerURL.getPath().replace("/ui", "")
                                + "diagram-viewer/index.html?processDefinitionId=" + processDefinition.getId());
                Embedded browserPanel = new Embedded("", new ExternalResource(url));
                browserPanel.setType(Embedded.TYPE_BROWSER);
                browserPanel.setWidth(maxX + 350 + "px");
                browserPanel.setHeight(maxY + 220 + "px");

                HorizontalLayout panelLayout = new HorizontalLayout();
                panelLayout.setSizeUndefined();
                imagePanel.setContent(panelLayout);
                imagePanel.addComponent(browserPanel);

                processImageContainer.addComponent(imagePanel);

                didDrawImage = true;
            }

        } catch (Exception e) {
            LOGGER.error("Error loading process diagram component", e);
        }
    }

    if (didDrawImage == false) {

        StreamResource diagram = null;

        // Try generating process-image stream
        if (processDefinition.getDiagramResourceName() != null) {
            diagram = new ProcessDefinitionImageStreamResourceBuilder().buildStreamResource(processDefinition,
                    repositoryService);
        }

        if (diagram != null) {

            Embedded embedded = new Embedded(null, diagram);
            embedded.setType(Embedded.TYPE_IMAGE);
            embedded.setSizeUndefined();

            Panel imagePanel = new Panel(); // using panel for scrollbars
            imagePanel.addStyleName(Reindeer.PANEL_LIGHT);
            imagePanel.setWidth(100, UNITS_PERCENTAGE);
            imagePanel.setHeight(100, UNITS_PERCENTAGE);
            HorizontalLayout panelLayout = new HorizontalLayout();
            panelLayout.setSizeUndefined();
            imagePanel.setContent(panelLayout);
            imagePanel.addComponent(embedded);
            processImageContainer.addComponent(imagePanel);

            didDrawImage = true;
        }
    }

    if (didDrawImage == false) {
        Label noImageAvailable = new Label(i18nManager.getMessage(Messages.PROCESS_NO_DIAGRAM));
        processImageContainer.addComponent(noImageAvailable);
    }
    addComponent(processImageContainer);
}

From source file:org.fossa.rolp.ui.leb.LebAnzeigen.java

License:Open Source License

public LebAnzeigen(FossaApplication app, SchuelerLaso schueler, KlasseLaso klasse)
        throws DocumentException, IOException {
    super(app);//from  w ww  .j a v a  2s.c o m
    setCaption(" - Lernentwicklungsbericht anzeigen - ");
    VerticalLayout layout = new VerticalLayout();
    setWidth("800px");
    setContent(layout);
    layout.setSpacing(true);

    Embedded embeddedPdf = new Embedded();
    embeddedPdf.setType(Embedded.TYPE_BROWSER);
    DateFormat dateFormat = new SimpleDateFormat("ddMMyy-HHmmss");
    String dateiname = "Klasse" + klasse.getKlassenname() + "_" + schueler.getVorname() + "_"
            + schueler.getName() + "_" + dateFormat.format(new Date()) + ".pdf";
    embeddedPdf.setSource(new LebCreator(app, schueler, klasse, dateiname).getLebResource());
    embeddedPdf.setWidth(100, Sizeable.UNITS_PERCENTAGE);
    embeddedPdf.setHeight("580px");
    windowCloseButton.setWidth(100, Sizeable.UNITS_PERCENTAGE);
    layout.addComponent(embeddedPdf);
    layout.addComponent(windowCloseButton);
}

From source file:org.generationcp.breeding.manager.crossingmanager.EmbeddedGermplasmListDetailComponent.java

License:Open Source License

@Override
public void afterPropertiesSet() throws Exception {
    setMargin(false);/* w  ww.j av a2  s .  c  o m*/
    setSpacing(true);
    setWidth("800px");

    Tool tool = null;
    try {
        tool = workbenchDataManager.getToolWithName(ToolName.germplasm_list_browser.toString());
    } catch (MiddlewareQueryException qe) {
        LOG.error("QueryException", qe);
    }

    ExternalResource listBrowserLink = null;
    if (tool == null) {
        listBrowserLink = new ExternalResource(
                "http://localhost:18080/GermplasmStudyBrowser/main/germplasmlist-" + listId);
    } else {
        listBrowserLink = new ExternalResource(
                tool.getPath().replace("germplasmlist/", "germplasmlist-") + listId);
    }

    VerticalLayout layoutForList = new VerticalLayout();
    layoutForList.setMargin(false);
    layoutForList.setSpacing(false);

    Embedded listInfoPage = new Embedded("", listBrowserLink);
    listInfoPage.setType(Embedded.TYPE_BROWSER);
    listInfoPage.setSizeFull();
    layoutForList.setHeight("550px");
    layoutForList.addComponent(listInfoPage);

    CrossingManagerImportButtonClickListener listener = new CrossingManagerImportButtonClickListener(this);

    exportButton = new Button();
    exportButton.setData(EXPORT_BUTTON_ID);
    exportButton.addListener(listener);

    makeCrossesButton = new Button();
    makeCrossesButton.setData(MAKE_CROSSES_BUTTON_ID);
    makeCrossesButton.addListener(listener);

    HorizontalLayout buttonArea = new HorizontalLayout();
    buttonArea.setMargin(true);
    buttonArea.setSpacing(true);
    buttonArea.addComponent(exportButton);
    buttonArea.addComponent(makeCrossesButton);

    addComponent(layoutForList);
    addComponent(buttonArea);
    setComponentAlignment(buttonArea, Alignment.BOTTOM_RIGHT);
}