Example usage for com.vaadin.ui Image setAlternateText

List of usage examples for com.vaadin.ui Image setAlternateText

Introduction

In this page you can find the example usage for com.vaadin.ui Image setAlternateText.

Prototype

public void setAlternateText(String altText) 

Source Link

Document

Sets this component's alternate text that can be presented instead of the component's normal content for accessibility purposes.

Usage

From source file:annis.gui.ReportBugWindow.java

License:Apache License

private void addScreenshotPreview(Layout layout, final byte[] rawImage, String mimeType) {
    StreamResource res = new StreamResource(new ScreenDumpStreamSource(rawImage),
            "screendump_" + UUID.randomUUID().toString() + ".png");
    res.setMIMEType(mimeType);//w w w.j a v  a2 s.  c om

    final Image imgScreenshot = new Image("Attached screenshot", res);
    imgScreenshot.setAlternateText(
            "Screenshot of the ANNIS browser window, " + "no other window or part of the desktop is captured.");
    imgScreenshot.setVisible(false);
    imgScreenshot.setWidth("100%");

    Button btShowScreenshot = new Button("Show attached screenshot",
            new ShowScreenshotClickListener(imgScreenshot));
    btShowScreenshot.addStyleName(BaseTheme.BUTTON_LINK);
    btShowScreenshot.setIcon(FontAwesome.PLUS_SQUARE_O);

    layout.addComponent(btShowScreenshot);
    layout.addComponent(imgScreenshot);
}

From source file:de.kaiserpfalzEdv.office.ui.web.widgets.about.AboutPanel.java

License:Apache License

@PostConstruct
public void init() {
    Image logo = new Image(null, new ThemeResource("../images/lichti-wappen.png"));
    logo.setId("about-logo");
    logo.setAlternateText("Logo: Kaiserpfalz EDV-Service");
    logo.setWidth(150f, Unit.PIXELS);/*from   w  w w .  j  ava  2 s . c  om*/
    logo.setHeight(170f, Unit.PIXELS);
    logo.setCaption("Kaiserpfalz EDV-Service");

    addComponent(logo);
    setComponentAlignment(logo, Alignment.MIDDLE_CENTER);

    Label name = new Label(
            "<div style='text-align: center;'><b>" + application.get(ApplicationMetaData.APPLICATION_NAME)
                    + "</b>" + "<br/>" + "<i><small>Version "
                    + application.get(ApplicationMetaData.APPLICATION_VERSION) + "</small></i></div>",
            ContentMode.HTML);
    name.setWidth(200f, Unit.PIXELS);
    addComponent(name);
    setComponentAlignment(name, Alignment.MIDDLE_CENTER);

    addComponent(new Label(""));
    addComponent(new Label("License: " + license.getId()));
    addComponent(new Label("Licensee: " + license.getLicensee()));
    addComponent(new Label(""));
    addComponent(new Label("Issued: " + license.getIssueDate()));
    addComponent(new Label("Issuer: " + license.getIssuer()));
    addComponent(new Label(""));
    addComponent(new Label("Valid (Time): " + license.getStart() + " - " + license.getExpiry()));
    addComponent(new Label("Valid (Version): " + license.getVersionRange().getStart() + " - "
            + license.getVersionRange().getEnd()));

    LOG.trace("Initialized: {}", this);
    LOG.trace("  application: {}", application);
    LOG.trace("  license: {}", license);
}

From source file:uk.co.intec.keyDatesApp.components.HeaderComponent.java

License:Apache License

/**
 * Constructor, passing the Vaadin application page
 *
 * @param ui// w  w  w . jav a  2 s  . c o  m
 *            MainUI application page
 */
public HeaderComponent(MainUI ui) {
    setHeight("50px");
    setStyleName("header");

    final HorizontalLayout bannerArea = new HorizontalLayout();
    bannerArea.setStyleName("menuArea");
    bannerArea.setSizeFull();

    final ThemeResource resource = new ThemeResource("img/intec-logo.gif.png");
    final Image bannerImg = new Image();
    bannerImg.setAlternateText("Intec");
    bannerImg.setHeight("50px");
    bannerImg.setDescription("Intec Logo");
    bannerImg.setSource(resource);
    bannerImg.setWidth(null);
    bannerImg.setStyleName("bannerImg");

    setMenubar(new MenuBar());
    getMenubar().setStyleName(ValoTheme.MENU_SUBTITLE);
    getMenubar().addStyleName("valo-menu-subtitle-indent");
    getMenubar().setWidth(100, Unit.PERCENTAGE);

    if (!"Anonymous".equals(getUserName())) {
        final MenuItem logout = menubar.addItem("Logout", null);
        logout.setStyleName("menuRight");
    }

    final MenuItem userItem = menubar.addItem(getUserName(), null);
    userItem.setStyleName("menuRight");

    bannerArea.addComponents(bannerImg, menubar);
    bannerArea.setExpandRatio(menubar, 1);
    addComponent(bannerArea);
    setExpandRatio(bannerArea, 1);
    setSizeFull();
}