Example usage for com.vaadin.ui Link setStyleName

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

Introduction

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

Prototype

@Override
    public void setStyleName(String style) 

Source Link

Usage

From source file:com.foc.vaadin.FocWebVaadinWindow.java

License:Apache License

protected Component newLogoEmbedded() {
    //      Button iconButton = new Button();
    //      setStyleName(BaseTheme.BUTTON_LINK);
    //      iconButton.addClickListener(new ClickListener() {
    //         @Override
    //         public void buttonClick(ClickEvent event) {
    //            
    //         }/*from www. j  a v  a  2s .  c  o  m*/
    //      });
    //      iconButton.setIcon(new ThemeResource("img/logo.png"));
    //      iconButton.addStyleName("foc-UpperLogo");
    //      return iconButton;

    Link iconLink = new Link();
    //      iconLink.setIcon(new ThemeResource("img/everpro_logo.png"));

    iconLink.setIcon(new ThemeResource("img/logo.png"));
    String logoURL = getLogoURL();
    if (logoURL != null) {
        iconLink.setResource(new ExternalResource(logoURL));
    }

    //      iconLink.setStyleName("everproLogo");
    iconLink.setStyleName("foc-UpperLogo");

    return iconLink;
}

From source file:fr.amapj.view.views.mescontrats.MesContratsViewAdhesionPart.java

License:Open Source License

public void addAhesionInfo(VerticalLayout layout) {
    MesContratsDTO mesContratsDTO = view.mesContratsDTO;

    // Cas classique de renouvellement de l'adhsion
    if (mesContratsDTO.adhesionDTO.displayAdhesionTop()) {

        Label lab = new Label("Renouvellement de votre adhsion  l'AMAP");
        lab.addStyleName(MesContratsView.LABEL_RUBRIQUE);
        layout.addComponent(lab);/*from w  w  w.  ja v  a2  s  .  com*/

        Panel p = new Panel();
        p.addStyleName(MesContratsView.PANEL_UNCONTRAT);

        HorizontalLayout hl = new HorizontalLayout();
        hl.setMargin(true);
        hl.setSpacing(true);
        hl.setWidth("100%");

        VerticalLayout vl = new VerticalLayout();
        Label lab1 = new Label("Adhsion pour " + mesContratsDTO.adhesionDTO.periodeCotisationDTO.nom);
        lab1.addStyleName(MesContratsView.LABEL_TITRECONTRAT);
        vl.addComponent(lab1);

        String str = formatLibelleAdhesion(mesContratsDTO.adhesionDTO);
        BaseUiTools.addHtmlLabel(vl, str, "libelle-contrat");

        addLinkImpressionBulletin(mesContratsDTO.adhesionDTO, vl);

        hl.addComponent(vl);
        hl.setExpandRatio(vl, 1);

        VerticalLayout vl2 = new VerticalLayout();
        vl2.setWidth("115px");
        vl2.setSpacing(true);

        hl.addComponent(vl2);
        hl.setComponentAlignment(vl2, Alignment.MIDDLE_CENTER);

        if (mesContratsDTO.adhesionDTO.isCotisant()) {
            Button b = addButtonAdhesionAdherer("Modifier");
            b.setWidth("100%");
            vl2.addComponent(b);

            b = addButtonAdhesionSupprimer("Supprimer");
            b.setWidth("100%");
            vl2.addComponent(b);

            Button v = addButtonAdhesionVoir("Voir");
            v.setWidth("100%");
            v.addStyleName(MesContratsView.BUTTON_PRINCIPAL);
            vl2.addComponent(v);

        } else {
            Button b = addButtonAdhesionAdherer("Adhrer");
            b.addStyleName(MesContratsView.BUTTON_PRINCIPAL);
            b.setWidth("100%");
            vl2.addComponent(b);
        }

        p.setContent(hl);
        layout.addComponent(p);

    }

    // Cas d'affichage uniquement, pendant 30 jours apres la fin des inscriptions  
    if (mesContratsDTO.adhesionDTO.affichageOnly != null) {
        AffichageOnly aff = mesContratsDTO.adhesionDTO.affichageOnly;

        Label lab = new Label("Votre adhsion  l'AMAP");
        lab.addStyleName(MesContratsView.LABEL_RUBRIQUE);
        layout.addComponent(lab);

        Panel p = new Panel();
        p.addStyleName(MesContratsView.PANEL_UNCONTRAT);

        HorizontalLayout hl = new HorizontalLayout();
        hl.setMargin(true);
        hl.setSpacing(true);
        hl.setWidth("100%");

        VerticalLayout vl = new VerticalLayout();
        Label lab1 = new Label("Adhsion pour " + aff.nomPeriode);
        lab1.addStyleName(MesContratsView.LABEL_TITRECONTRAT);
        vl.addComponent(lab1);

        String str = "Vous avez renouvel votre adhsion  l'AMAP. Montant : "
                + new CurrencyTextFieldConverter().convertToString(aff.montantAdhesion) + " ";
        BaseUiTools.addHtmlLabel(vl, str, "libelle-contrat");

        if (shouldDisplayLinkBulletinInAffichageOnly(aff)) {
            Link l = LinkCreator
                    .createLink(new PGBulletinAdhesion(aff.idPeriode, aff.idPeriodeUtilisateur, null));
            l.setCaption("Imprimer mon bulletin d'adhsion");
            l.setStyleName("adhesion");

            vl.addComponent(l);
        }

        hl.addComponent(vl);
        hl.setExpandRatio(vl, 1);

        VerticalLayout vl2 = new VerticalLayout();
        vl2.setWidth("115px");
        vl2.setSpacing(true);

        hl.addComponent(vl2);
        hl.setComponentAlignment(vl2, Alignment.MIDDLE_CENTER);

        p.setContent(hl);
        layout.addComponent(p);

    }
}

From source file:fr.amapj.view.views.mescontrats.MesContratsViewAdhesionPart.java

License:Open Source License

/**
 * Ajoute si cela est ncessaire le lien vers l'impression des bulletins d'adhesion
 * @param adhesionDTO/*  w  w  w.j a  v  a 2 s . c o  m*/
 * @param vl
 */
private void addLinkImpressionBulletin(AdhesionDTO adhesionDTO, VerticalLayout vl) {
    if (shouldDisplayLinkBulletin(adhesionDTO) == false) {
        return;
    }

    Long idPeriode = adhesionDTO.periodeCotisationDTO.id;
    Long idPeriodeUtilisateur = adhesionDTO.periodeCotisationUtilisateurDTO.id;
    Link l = LinkCreator.createLink(new PGBulletinAdhesion(idPeriode, idPeriodeUtilisateur, null));
    l.setCaption("Imprimer mon bulletin d'adhsion");
    l.setStyleName("adhesion");

    vl.addComponent(l);
}

From source file:org.eclipse.hawkbit.ui.components.SPUIComponentProvider.java

License:Open Source License

/**
 * Method to create a link.//from   w  ww  . ja v a2s.c o m
 *
 * @param id
 *            of the link
 * @param name
 *            of the link
 * @param resource
 *            path of the link
 * @param icon
 *            of the link
 * @param targetOpen
 *            specify how the link should be open (f. e. new windows =
 *            _blank)
 * @param style
 *            chosen style of the link. Might be {@code null} if no style
 *            should be used
 * @return a link UI component
 */
public static Link getLink(final String id, final String name, final String resource, final FontAwesome icon,
        final String targetOpen, final String style) {

    final Link link = new Link(name, new ExternalResource(resource));
    link.setId(id);
    link.setIcon(icon);
    link.setDescription(name);

    link.setTargetName(targetOpen);
    if (style != null) {
        link.setStyleName(style);
    }

    return link;

}

From source file:org.escidoc.browser.ui.view.helpers.AdminDescriptorsTable.java

License:Open Source License

private Link buildLink(AdminDescriptor ad) {
    Link mdLink = new Link("View", new ExternalResource(buildUri(ad)));
    mdLink.setTargetName("_blank");
    mdLink.setStyleName(BaseTheme.BUTTON_LINK);
    mdLink.setDescription("Show Admin Descriptor information in a separate window");
    return mdLink;
}

From source file:org.escidoc.browser.ui.view.helpers.ContainerMetadataTable.java

License:Open Source License

private Link buildLink(final MetadataRecord metadataRecord) {
    Link mdLink = new Link("View", new ExternalResource(buildUri(metadataRecord)));
    mdLink.setTargetName("_blank");
    mdLink.setStyleName(BaseTheme.BUTTON_LINK);
    mdLink.setDescription("Show metadata information in a separate window");
    return mdLink;
}

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);//from  www .j a v a2  s.  c  om
        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);
    }
}