Example usage for com.vaadin.ui Embedded TYPE_IMAGE

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

Introduction

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

Prototype

int TYPE_IMAGE

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

Click Source Link

Document

Image types.

Usage

From source file:org.activiti.explorer.ui.task.UserDetailsComponent.java

License:Apache License

protected void addUserPicture() {
    Resource pictureResource = Images.USER_32; // default icon
    if (user != null) {
        final Picture userPicture = identityService.getUserPicture(user.getId());
        if (userPicture != null) {
            pictureResource = new StreamResource(new StreamSource() {
                public InputStream getStream() {
                    return userPicture.getInputStream();
                }// w ww  . ja va2  s .c o  m
            }, user.getId(), ExplorerApp.get());

        }
    }
    Embedded picture = new Embedded(null, pictureResource);

    picture.setType(Embedded.TYPE_IMAGE);
    picture.addStyleName(ExplorerLayout.STYLE_TASK_EVENT_PICTURE);
    if (user != null) {
        // Only set fixed height and width when user has image, otherwise icon's dimensions will be used
        picture.setHeight("32px");
        picture.setWidth("32px");
    }
    addComponent(picture);

    // Add profile popup listener
    if (user != null) {
        picture.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
        picture.addListener(new com.vaadin.event.MouseEvents.ClickListener() {
            public void click(ClickEvent event) {
                viewManager.showProfilePopup(user.getId());
            }
        });
    }
}

From source file:org.activiti.kickstart.ui.popup.ProcessImagePopupWindow.java

License:Apache License

protected void initUi() {
    setModal(true);//from w  ww.  j a  v  a  2  s .c  o m
    setHeight("80%");
    setWidth("80%");
    center();
    setCaption(TITLE);

    StreamResource.StreamSource streamSource = null;
    if (processDefinitionId != null) {
        streamSource = new StreamSource() {

            private static final long serialVersionUID = -8875067466181823014L;

            public InputStream getStream() {
                return adhocWorkflowService.getProcessImage(processDefinitionId);
            }
        };
    } else if (adhocWorkflow != null) {
        final ProcessDiagramGenerator converter = new ProcessDiagramGenerator(adhocWorkflow);
        streamSource = new StreamSource() {

            private static final long serialVersionUID = 239500411112658830L;

            public InputStream getStream() {
                return converter.execute();
            }
        };
    }

    // resource must have unique id!
    StreamResource imageresource = new StreamResource(streamSource, UUID.randomUUID() + ".png",
            viewManager.getApplication());
    Panel panel = new Panel();
    panel.setContent(new HorizontalLayout());
    panel.setStyleName(Reindeer.PANEL_LIGHT);
    panel.setHeight("95%");
    Embedded embedded = new Embedded("", imageresource);
    embedded.setType(Embedded.TYPE_IMAGE);
    panel.addComponent(embedded);
    addComponent(panel);
}

From source file:org.apache.ace.webui.vaadin.component.BaseObjectPanel.java

License:Apache License

/**
 * Factory method to create an embeddable icon.
 * //from  ww w .  ja v a 2 s .  co m
 * @param name
 *            the name of the icon to use (is also used as tooltip text);
 * @param res
 *            the resource denoting the actual icon.
 * @return an embeddable icon, never <code>null</code>.
 */
protected Embedded createIcon(String name, Resource res) {
    Embedded embedded = new Embedded(name, res);
    embedded.setType(Embedded.TYPE_IMAGE);
    embedded.setDescription(name);
    embedded.setHeight(ICON_HEIGHT + "px");
    embedded.setWidth(ICON_WIDTH + "px");
    return embedded;
}

From source file:org.diretto.web.richwebclient.view.sections.UploadSection.java

/**
 * Uploads the currently processed file.
 * // www  .j  a v  a  2s. co m
 * @param uploadSettings The {@code UploadSettings} of the file
 * @param filesWithSameSettings A {@code List} with the names of the files
 *        which should get the given {@code UploadSettings} as presetting
 */
public void upload(final UploadSettings uploadSettings, List<String> filesWithSameSettings) {
    final FileInfo fileInfo = currentFile;

    settings.put(fileInfo.getName(), uploadSettings);

    for (String fileName : filesWithSameSettings) {
        preSettings.put(fileName, uploadSettings);
    }

    new Thread(new Runnable() {
        @Override
        public void run() {
            ProgressIndicator progressIndicator = multipleUpload.upload(fileInfo);

            synchronized (application) {
                VerticalLayout uploadBoxLayout = new VerticalLayout();
                mainLayout.addComponent(uploadBoxLayout);

                HorizontalLayout fileInfoLayout = new HorizontalLayout();
                uploadBoxLayout.addComponent(fileInfoLayout);

                Label nameLabel = StyleUtils.getLabelBold(fileInfo.getName());
                fileInfoLayout.addComponent(nameLabel);
                fileInfoLayout.addComponent(StyleUtils.getLabelSmallHTML("&nbsp;&nbsp;&nbsp;"));
                fileInfoLayout.setComponentAlignment(nameLabel, Alignment.MIDDLE_LEFT);

                BigDecimal fileSize = new BigDecimal((((double) fileInfo.getSize()) / 1000000.0d));
                fileSize = fileSize.setScale(2, BigDecimal.ROUND_HALF_UP);

                Label typeSizeLabel = StyleUtils.getLabelSmallHTML(
                        fileInfo.getType() + "&nbsp;&nbsp;--&nbsp;&nbsp;" + fileSize.toPlainString() + " MB");
                fileInfoLayout.addComponent(typeSizeLabel);
                fileInfoLayout.setComponentAlignment(typeSizeLabel, Alignment.MIDDLE_LEFT);

                uploadBoxLayout.addComponent(StyleUtils.getVerticalSpace("100%", "8px"));

                uploadBoxLayout.addComponent(progressIndicator);

                uploadBoxLayout.addComponent(StyleUtils.getVerticalSpace("100%", "8px"));

                HorizontalLayout resultLayout = new HorizontalLayout();
                uploadBoxLayout.addComponent(resultLayout);

                Label uploadedLabel = StyleUtils.getLabelSmallHTML("Uploaded:&nbsp;");
                resultLayout.addComponent(uploadedLabel);
                resultLayout.setComponentAlignment(uploadedLabel, Alignment.MIDDLE_LEFT);

                Embedded uploadedEmbedded = new Embedded(null, ResourceUtils.RUNO_ICON_32_GLOBE_RESOURCE);
                uploadedEmbedded.addStyleName("image-opacity-65");
                uploadedEmbedded.setType(Embedded.TYPE_IMAGE);
                uploadedEmbedded.setImmediate(true);
                uploadedEmbedded.setWidth("22px");
                uploadedEmbedded.setHeight("22px");
                resultLayout.addComponent(uploadedEmbedded);

                uploadedEmbeddeds.put(fileInfo, uploadedEmbedded);

                resultLayout.addComponent(StyleUtils.getLabelSmallHTML("&nbsp;&nbsp;&nbsp;"));

                Label publishedLabel = StyleUtils.getLabelSmallHTML("Published:&nbsp;");
                resultLayout.addComponent(publishedLabel);
                resultLayout.setComponentAlignment(publishedLabel, Alignment.MIDDLE_LEFT);

                Embedded publishedEmbedded = new Embedded(null, ResourceUtils.RUNO_ICON_32_GLOBE_RESOURCE);
                publishedEmbedded.addStyleName("image-opacity-65");
                publishedEmbedded.setType(Embedded.TYPE_IMAGE);
                publishedEmbedded.setImmediate(true);
                publishedEmbedded.setWidth("22px");
                publishedEmbedded.setHeight("22px");
                resultLayout.addComponent(publishedEmbedded);

                publishedEmbeddeds.put(fileInfo, publishedEmbedded);

                mainLayout.addComponent(StyleUtils.getVerticalSpace("100%", "5px"));

                requestRepaint();
            }
        }
    }).start();

    handleNextFile();
}

From source file:org.fossa.rolp.demo.DemoWelcomeScreen.java

License:Open Source License

public DemoWelcomeScreen(RolpApplication app, FossaAuthorizer authorizer) {
    super(app);//from   ww w  . ja  va2  s .  co  m
    this.app = app;
    setStyleName("demo");
    setWidth("900px");
    center();
    this.authorizer = authorizer;
    CustomLayout layout = new CustomLayout("./demo/welcomeScreen");
    CustomLayout layoutTop = new CustomLayout("./demo/welcomeScreenTop");
    CustomLayout layoutMiddle = new CustomLayout("./demo/welcomeScreenMiddle");
    CustomLayout layoutBottom = new CustomLayout("./demo/welcomeScreenBottom");

    Embedded logoRolp = new Embedded(null, new ThemeResource(DEMO_LOGO_ROLP_PATH));
    logoRolp.setType(Embedded.TYPE_IMAGE);
    logoRolp.setWidth("100px");
    logoRolp.setHeight("96px");

    Label rolpDemoText = new Label(
            "<h2>Wilkommen</h2>Dies ist eine Demoversion der Software ROLP. Whlen Sie eine Rolle aus, um in das entsprechende Szenario zu gelangen. Der Schulleiter hat eine eigene Verwaltungsoberflche, wo er die Lehrer und Klassen berblicken und zuweisen kann. Als Klassenlehrer und Fachlehrer gelangt man auf den Startbildschirm. Von da aus gelangt man zum Klassenlehrer-Dashboard und dem Fachlehrer-Dashboard. Der Klassenlehrer hat Zugang zu beiden Dashboards, da er im Normalfall auch Fcher unterrichtet.",
            Label.CONTENT_XHTML);
    Label githubLinkDummy = new Label(
            "ROLP auf <a href=\"https://github.com/fossaag/rolp\" target=\"_blank\">GitHub.com</a>",
            Label.CONTENT_XHTML);

    Embedded logoFossa = new Embedded(null, new ThemeResource(DEMO_LOGO_FOSSA_PATH));
    logoFossa.setType(Embedded.TYPE_IMAGE);
    logoFossa.setWidth("150px");

    Label roleSelectCaption = new Label("Bitte whlen Sie eine Rolle aus:", Label.CONTENT_XHTML);

    BeanItemContainer<String> roles = new BeanItemContainer<String>(String.class);
    roles.addBean("Fachlehrer");
    roles.addBean("Klassenlehrer");
    roles.addBean("Schulleiter");
    roleSelect.setContainerDataSource(roles);
    roleSelect.setWidth("200px");

    layoutTop.addComponent(logoRolp, "logoRolp");
    layoutTop.addComponent(rolpDemoText, "rolpDemoText");
    layoutTop.addComponent(logoFossa, "logoFossa");
    layout.addComponent(layoutTop, "layoutTop");

    layoutMiddle.addComponent(roleSelectCaption, "roleSelectCaption");
    layoutMiddle.addComponent(roleSelect, "roleSelect");
    layoutMiddle.addComponent(okButton, "okButton");
    layout.addComponent(layoutMiddle, "layoutMiddle");

    layoutBottom.addComponent(githubLinkDummy, "githubLinkDummy");
    layout.addComponent(layoutBottom, "layoutBottom");
    setContent(layout);
}

From source file:org.fossa.rolp.RolpApplication.java

License:Open Source License

@Override
public void buildMainLayout() {
    Embedded logo = new Embedded(null, new ThemeResource(MAINPAGE_PANEL_ANMELDEN_LOGO_PATH));
    logo.setType(Embedded.TYPE_IMAGE);
    logo.setWidth("100px");
    logo.setHeight("96px");
    headlineApp.addComponent(logo, "logo");
    headlineApp.addComponent(authorizerLayout, "authorizerLayout");
    headlineApp.addStyleName("headlineApp");

    layout.addComponent(headlineApp, "headlineApp");

    getMainWindow().setContent(layout);//ww  w  .ja va2  s  .  c o  m
    getMainWindow().addComponent(getAnimator());

    if (getLoginLehrer().getIsAdmin()) {
        layout.addComponent(getAdminDashboard(), "admin");
    } else {
        layout.addComponent(main, "main");
        buildAppLayout();
    }
}

From source file:org.fossa.rolp.ui.dashboard.FachlehrerDashboard.java

License:Open Source License

public FachlehrerDashboard(RolpApplication app) {
    super(app);//from  w  w  w  .  j av  a2s.  co  m
    this.app = app;
    setCaption(" - FachlehrerDashboard - ");
    setWidth("100%");
    setHeight("100%");

    buildButtonBatteries();

    CustomLayout layout = new CustomLayout("./lehrerDashboards/fachLehrerDashboardMain");
    setContent(layout);

    CustomLayout headline = new CustomLayout("./lehrerDashboards/headline");
    headline.addStyleName("headline");

    Embedded logo = new Embedded(null, new ThemeResource(MAINPAGE_PANEL_ANMELDEN_LOGO_PATH));
    logo.setType(Embedded.TYPE_IMAGE);
    logo.setWidth("100px");
    logo.setHeight("96px");

    headline.addComponent(logo, "logo");

    CustomLayout faecherListe = new CustomLayout("./lehrerDashboards/liste");
    faecherListe.addStyleName("liste");
    faecherList = getFaecherList();
    faecherList.setHeight("250px");
    faecherList.setStyleName("list");
    faecherListe.addComponent(faecherList, "list");
    faecherListe.setHeight("260px");

    layout.addComponent(faecherListe, "liste");
    layout.addComponent(headline, "headline");
    layout.addComponent(horizontalButtonBattery, "horizontalButtonBattery");

    lehrerBlog = getLehrerBlog();
    layout.addComponent(lehrerBlog, "blog");
    windowCloseButton.setWidth("100%");
    layout.addComponent(windowCloseButton, "windowCloseButton");

}

From source file:org.fossa.rolp.ui.dashboard.KlassenlehrerDashboard.java

License:Open Source License

public KlassenlehrerDashboard(RolpApplication app) {
    super(app);//from w  w w.  ja v a 2 s.c  o m
    this.app = app;
    setCaption(" - KlassenlehrerDashboard - ");
    setWidth("100%");
    setHeight("100%");

    buildButtonBatteries();

    CustomLayout layout = new CustomLayout("./lehrerDashboards/klassenLehrerDashboardMain");
    setContent(layout);

    CustomLayout headline = new CustomLayout("./lehrerDashboards/headline");
    headline.addStyleName("headline");

    Embedded logo = new Embedded(null, new ThemeResource(MAINPAGE_PANEL_ANMELDEN_LOGO_PATH));
    logo.setType(Embedded.TYPE_IMAGE);
    logo.setWidth("100px");
    logo.setHeight("96px");

    headline.addComponent(logo, "logo");
    headline.addComponent(headdataEditingPanel, "headdataEditingPanel");

    Panel hints = new Panel();
    hints.addStyleName("hints");
    hinweistext = new Label();
    hinweistext.setContentMode(Label.CONTENT_XHTML);
    hinweistext.setReadOnly(true);
    hinweistext.setHeight("250px");
    hints.setHeight("250px");
    hints.setScrollable(true);
    hints.addComponent(hinweistext);
    refreshHinweistext();

    CustomLayout schuelerListe = new CustomLayout("./lehrerDashboards/liste");
    schuelerListe.addStyleName("liste");
    schuelerList = getSchuelerList();
    schuelerList.setHeight("250px");
    schuelerList.setStyleName("list");
    schuelerListe.addComponent(schuelerList, "list");
    schuelerListe.setHeight("260px");
    layout.addComponent(schuelerListe, "liste");

    layout.addComponent(headline, "headline");
    layout.addComponent(horizontalButtonBattery, "horizontalButtonBattery");
    layout.addComponent(verticalButtonBattery, "verticalButtonBattery");

    layout.addComponent(hints, "hints");
    windowCloseButton.setWidth("100%");
    layout.addComponent(windowCloseButton, "windowCloseButton");
    //      app.getAnimator().animate(horizontalButtonBattery, AnimType.ROLL_DOWN_OPEN_POP).setDuration(500).setDelay(500);
}

From source file:org.fossa.vaadin.ui.FossaBooleanCellImageHandler.java

License:Open Source License

public FossaBooleanCellImageHandler(boolean datasource) {
    super(null);/*from w  ww .  j  a  v a2  s  . c  o m*/
    if (datasource) {
        setSource(new ThemeResource("images/check.gif"));
    } else {
        setSource(new ThemeResource("images/uncheck.gif"));
    }
    setType(Embedded.TYPE_IMAGE);
}

From source file:org.milleni.dunning.ui.customer.form.CustomProcessInstanceDetailPanel.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 = XMLInputFactory.newInstance();
                XMLStreamReader xtr = xif.createXMLStreamReader(definitionStream);
                BpmnModel bpmnModel = new BpmnXMLConverter().convertToBpmnModel(xtr);

                if (bpmnModel.getFlowLocationMap().size() > 0) {

                    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;
                        }//from ww w  . j a  va2 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 == false && processDefinitionEntity.isGraphicalNotationDefined()) {

            StreamResource diagram = new ProcessDefinitionImageStreamResourceBuilder()
                    .buildStreamResource(processInstance, repositoryService, runtimeService);

            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);
            }
        }
    }
}