Example usage for com.vaadin.ui Link setHeight

List of usage examples for com.vaadin.ui Link setHeight

Introduction

In this page you can find the example usage for com.vaadin.ui Link setHeight.

Prototype

@Override
    public void setHeight(float height, Unit unit) 

Source Link

Usage

From source file:org.vaadin.addons.sitekit.viewlet.user.ProfileImageViewlet.java

License:Apache License

@Override
public void enter(final String parameters) {
    final String user = getSite().getSecurityProvider().getUser();
    if (user == null) {
        final VerticalLayout layout = new VerticalLayout();
        layout.setMargin(false);// w w w.j  a  v a 2s .co m
        final Link link = new Link(null, new ExternalResource("#!login"));
        link.setStyleName("gravatar");
        link.setIcon(getSite().getIcon("view-icon-login"));
        link.setWidth(32, UNITS_PIXELS);
        link.setHeight(32, UNITS_PIXELS);
        layout.addComponent(link);
        layout.setComponentAlignment(link, Alignment.MIDDLE_CENTER);
        this.setCompositionRoot(layout);
        return;
    }
    try {
        final VerticalLayout layout = new VerticalLayout();
        layout.setMargin(false);
        if (getSite().getSiteContext().getObject("gravatar-url") == null) {
            getSite().getSiteContext().putObject("gravatar-url", getGravatarUrl(user));
        }
        final URL gravatarUrl = new URL((String) getSite().getSiteContext().getObject("gravatar-url"));
        //final Embedded embedded = new Embedded(null, new ExternalResource(gravatarUrl));
        final Link link = new Link(null, new ExternalResource("http://www.gravatar.com/"));
        link.setStyleName("gravatar");
        link.setIcon(new ExternalResource(gravatarUrl));
        link.setWidth(32, UNITS_PIXELS);
        link.setHeight(32, UNITS_PIXELS);
        layout.addComponent(link);
        layout.setComponentAlignment(link, Alignment.MIDDLE_CENTER);
        this.setCompositionRoot(layout);
    } catch (final Exception e) {
        LOGGER.warn("Error reading gravatar image for user: " + user, e);
    }
}

From source file:org.vaadin.tori.component.Breadcrumbs.java

License:Apache License

private Component getDashboardLink() {
    Link link = new Link(getDashboardTitle(),
            new ExternalResource("#" + ToriNavigator.ApplicationView.DASHBOARD.getUrl()));
    link.setHeight(100.0f, Unit.PERCENTAGE);
    return link;// www .  j a va 2 s.  c  om
}

From source file:org.vaadin.tori.component.Breadcrumbs.java

License:Apache License

private Component getCategoryLink(final Category category) {
    HorizontalLayout result = new HorizontalLayout();
    result.setSpacing(true);//ww w .  ja v  a  2s.c  o m
    result.setHeight(100.0f, Unit.PERCENTAGE);
    result.addStyleName("categorylink");
    final Link crumb = new Link(category.getName(), new ExternalResource(
            "#" + ToriNavigator.ApplicationView.CATEGORIES.getUrl() + "/" + category.getId()));
    crumb.setHeight(100.0f, Unit.PERCENTAGE);
    result.addComponent(crumb);
    result.setComponentAlignment(crumb, Alignment.MIDDLE_CENTER);
    Component siblingMenu = getSiblingMenuBar(category);
    siblingMenu.setHeight(100.0f, Unit.PERCENTAGE);
    result.addComponent(siblingMenu);
    result.setComponentAlignment(siblingMenu, Alignment.MIDDLE_CENTER);
    return result;
}