Example usage for com.vaadin.ui Link setCaption

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

Introduction

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

Prototype

@Override
    public void setCaption(String caption) 

Source Link

Usage

From source file:fr.amapj.view.views.editionspe.engagement.EngagementEditorPart.java

License:Open Source License

private void addFieldTest() {
    // Titre/*from  w  ww . j a  v a  2 s  .  c o  m*/
    setStepTitle("tester le contrat d'engagement");

    //
    Searcher s = addSearcher("Modele de contrat qui servira pour tester", "idModeleContrat",
            SearcherList.MODELE_CONTRAT, null);
    s.setBuffered(false);

    //
    Link link = LinkCreator.createLink(
            new PGEngagement(PGEngagementMode.TOUS_LES_CONTRATS_EN_MODE_TEST, null, null, etiquetteDTO));
    link.setCaption("Cliquer ici pour tester cette dition");
    form.addComponent(link);
}

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);//  w w w . j  av a  2  s  . co  m

        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/*from w w  w  .  ja va  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.vaadin.addon.leaflet.demoandtestapp.util.TListUi.java

License:Apache License

private void loadTestClasses(TListUi aThis) {
    if (testClassess != null) {
        return;//from w  ww.  jav a2 s.  c om
    }
    testClassess = listTestClasses();
    Table table = new Table("Test cases", testClassess);
    table.addGeneratedColumn("name", new Table.ColumnGenerator() {
        public Object generateCell(Table source, Object itemId, Object columnId) {
            String name = (String) source.getItem(itemId).getItemProperty(columnId).getValue();
            Link link = new Link();
            link.setResource(new ExternalResource("/" + name));
            link.setCaption(name);
            link.setTargetName("_new");
            return link;
        }
    });
    table.addGeneratedColumn("description", new Table.ColumnGenerator() {
        public Object generateCell(Table source, Object itemId, Object columnId) {
            String description = (String) source.getItem(itemId).getItemProperty(columnId).getValue();
            return new Label(description);
        }
    });
    table.setSizeFull();
    table.setColumnExpandRatio("description", 1);
    setContent(table);
}

From source file:org.vaadin.addon.levelindicator.demoandtestapp.TListUi.java

License:Apache License

private void loadTestClasses(TListUi aThis) {
    if (testClassess != null) {
        return;/*from w  w  w  .j  a  v  a  2  s .  c om*/
    }
    testClassess = listTestClasses();
    Table table = new Table("Test cases", testClassess);
    table.addGeneratedColumn("name", new Table.ColumnGenerator() {
        @Override
        public Object generateCell(Table source, Object itemId, Object columnId) {
            String name = (String) source.getItem(itemId).getItemProperty(columnId).getValue();
            Link link = new Link();
            link.setResource(new ExternalResource("/" + name));
            link.setCaption(name);
            link.setTargetName("_new");
            return link;
        }
    });
    table.addGeneratedColumn("description", new Table.ColumnGenerator() {
        @Override
        public Object generateCell(Table source, Object itemId, Object columnId) {
            String description = (String) source.getItem(itemId).getItemProperty(columnId).getValue();
            return new Label(description);
        }
    });
    table.setSizeFull();
    table.setColumnExpandRatio("description", 1);
    setContent(table);
}

From source file:org.vaadin.addon.touchkitstuff.demoandtestapp.TListUi.java

License:Apache License

private void loadTestClasses(TListUi aThis) {
    if (testClassess != null) {
        return;//from  w  ww . j  ava 2s  .  c  om
    }
    testClassess = listTestClasses();
    Table table = new Table("Test cases", testClassess);
    table.addGeneratedColumn("name", new Table.ColumnGenerator() {
        public Object generateCell(Table source, Object itemId, Object columnId) {
            String name = (String) source.getItem(itemId).getItemProperty(columnId).getValue();
            Link link = new Link();
            link.setResource(new ExternalResource("/" + name));
            link.setCaption(name);
            link.setTargetName("_new");
            return link;
        }
    });
    table.addGeneratedColumn("description", new Table.ColumnGenerator() {
        public Object generateCell(Table source, Object itemId, Object columnId) {
            String description = (String) source.getItem(itemId).getItemProperty(columnId).getValue();
            return new Label(description);
        }
    });
    table.setSizeFull();
    table.setColumnExpandRatio("description", 1);
    VerticalLayout verticalLayout = new VerticalLayout();
    TextField filter = new TextField();
    filter.addTextChangeListener(new TextChangeListener() {
        @Override
        public void textChange(TextChangeEvent event) {
            String text = event.getText();
            testClassess.removeAllContainerFilters();
            testClassess.addContainerFilter("name", text, true, false);
        }
    });
    verticalLayout.addComponent(filter);
    filter.focus();
    verticalLayout.addComponent(table);
    setContent(verticalLayout);
}

From source file:org.vaadin.addonhelpers.TListUi.java

License:Apache License

private void loadTestClasses(TListUi aThis) {
    if (testClassess != null) {
        return;//from w  w  w  .j  av  a  2s  . c om
    }
    testClassess = listTestClasses();
    Table table = new Table("Test cases", testClassess);
    table.setVisibleColumns("name", "description");
    table.addGeneratedColumn("name", new Table.ColumnGenerator() {
        public Object generateCell(Table source, Object itemId, Object columnId) {
            String name = (String) source.getItem(itemId).getItemProperty(columnId).getValue();
            Class clazz = (Class) source.getItem(itemId).getItemProperty("clazz").getValue();
            Link link = new Link();
            link.setResource(new ExternalResource("/" + clazz.getName()));
            link.setCaption(name);
            link.setTargetName("_new");
            return link;
        }
    });
    table.addGeneratedColumn("description", new Table.ColumnGenerator() {
        public Object generateCell(Table source, Object itemId, Object columnId) {
            String description = (String) source.getItem(itemId).getItemProperty(columnId).getValue();
            return new Label(description);
        }
    });
    table.setSizeFull();
    table.setColumnExpandRatio("description", 1);
    VerticalLayout verticalLayout = new VerticalLayout();
    TextField filter = new TextField();
    filter.setInputPrompt("Filter list");
    filter.addTextChangeListener(new TextChangeListener() {
        @Override
        public void textChange(TextChangeEvent event) {
            String text = event.getText();
            testClassess.removeAllContainerFilters();
            testClassess.addContainerFilter("name", text, true, false);
        }
    });
    verticalLayout.addComponent(filter);
    filter.focus();
    verticalLayout.addComponent(table);
    verticalLayout.setSizeFull();
    verticalLayout.setExpandRatio(table, 1);
    verticalLayout.setMargin(true);
    setContent(verticalLayout);
}

From source file:ru.codeinside.gses.activiti.ftarchive.AttachmentField.java

License:Mozilla Public License

Component createDownloadLink(final FileValue fileValue) {
    final Link result = new Link();
    result.setCaption(fileValue.getFileName());
    result.setTargetName("_top");
    result.setImmediate(true);/*from ww w.  j av  a 2s. com*/
    result.setDescription("");
    StreamResource.StreamSource streamSource = new StreamResource.StreamSource() {
        public InputStream getStream() {
            return new ByteArrayInputStream(fileValue.getContent());
        }
    };
    StreamResource resource = new StreamResource(streamSource, fileValue.getFileName(), Flash.app()) {
        public DownloadStream getStream() {
            final StreamSource ss = getStreamSource();
            if (ss == null) {
                return null;
            }
            final DownloadStream ds = new DownloadStream(ss.getStream(), getMIMEType(), getFilename());
            ds.setCacheTime(0);
            try {
                WebBrowser browser = (WebBrowser) result.getWindow().getTerminal();
                if (browser.isIE()) {
                    URI uri = new URI(null, null, fileValue.getFileName(), null);
                    ds.setParameter("Content-Disposition", "attachment; filename=" + uri.toASCIIString());
                } else {
                    ds.setParameter("Content-Disposition", "attachment; filename=\""
                            + MimeUtility.encodeWord(fileValue.getFileName(), "utf-8", "Q") + "\"");
                }
            } catch (Exception e) {
                ds.setParameter("Content-Disposition", "attachment; filename=" + fileValue.getFileName());
            }
            return ds;
        }
    };
    resource.setMIMEType(fileValue.getMimeType());
    result.setResource(resource);
    return result;
}

From source file:ru.codeinside.gses.webui.utils.Components.java

License:Mozilla Public License

@Deprecated
public static Link createAttachShowButton(final FileValue attachment, final Application appl) {
    if (attachment == null) {
        return null;
    }//from   w w w  .  j  av  a2s .  com
    final Link result = new Link();
    result.setCaption(attachment.getFileName());
    result.setTargetName("_top");
    result.setImmediate(true);
    //String description = attachment.getDescription();
    result.setDescription("");
    StreamSource streamSource = new StreamSource() {

        private static final long serialVersionUID = 456334952891567271L;

        public InputStream getStream() {
            return new ByteArrayInputStream(attachment.getContent());
        }
    };
    StreamResource resource = new StreamResource(streamSource, attachment.getFileName(), appl) {

        private static final long serialVersionUID = -3869546661105572851L;

        public DownloadStream getStream() {
            final StreamSource ss = getStreamSource();
            if (ss == null) {
                return null;
            }
            final DownloadStream ds = new DownloadStream(ss.getStream(), getMIMEType(), getFilename());
            ds.setBufferSize(getBufferSize());
            ds.setCacheTime(0);
            try {
                WebBrowser browser = (WebBrowser) result.getWindow().getTerminal();
                if (browser.isIE()) {
                    URI uri = new URI(null, null, attachment.getFileName(), null);
                    ds.setParameter("Content-Disposition", "attachment; filename=" + uri.toASCIIString());
                } else {
                    ds.setParameter("Content-Disposition", "attachment; filename=\""
                            + MimeUtility.encodeWord(attachment.getFileName(), "utf-8", "Q") + "\"");
                }
            } catch (Exception e) {
                ds.setParameter("Content-Disposition", "attachment; filename=" + attachment.getFileName());
            }
            return ds;
        }
    };
    String type = attachment.getMimeType();
    if (type != null) {
        resource.setMIMEType(type);
    }
    result.setResource(resource);
    return result;
}