Example usage for com.vaadin.ui Link Link

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

Introduction

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

Prototype

public Link(String caption, Resource resource) 

Source Link

Document

Creates a new instance of Link.

Usage

From source file:org.balisunrise.vaadin.components.header.UserBar.java

private void init() {
    setHeight("100%");
    setWidthUndefined();/*from  w ww .  ja  va 2  s  .co m*/
    setStyleName("b-user-bar");
    setSpacing(true);
    addLayoutClickListener(this::click);

    userName = new Link("Entrar", null);
    userName.setStyleName("b-user-name");
    userName.setIcon(FontAwesome.USER);
    addComponent(userName);

    configuration = new Configuration();
    addComponent(configuration);
}

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

License:Open Source License

@Override
public synchronized void addComponents() {
    if (!componentsAdded) {
        GridLayout mainLayout = new GridLayout(2, 1);
        addComponent(mainLayout);/*from   w  w w.ja  va 2 s.c  o  m*/
        setExpandRatio(mainLayout, 1.0f);

        VerticalLayout contactDetailsLayout = new VerticalLayout();
        contactDetailsLayout.setStyleName(Reindeer.LAYOUT_BLACK);
        contactDetailsLayout.setWidth("280px");
        contactDetailsLayout.setMargin(true);
        contactDetailsLayout.setSpacing(true);

        contactDetailsLayout.addComponent(StyleUtils.getLabelH2("Contact Details"));
        contactDetailsLayout.addComponent(StyleUtils.getHorizontalLine());
        contactDetailsLayout.addComponent(StyleUtils.getLabelBold("Project Team"));
        contactDetailsLayout.addComponent(StyleUtils.getLabel("Benjamin Erb & Tobias Schlecht"));
        contactDetailsLayout.addComponent(StyleUtils.getHorizontalLine());
        contactDetailsLayout.addComponent(StyleUtils.getLabelBold("Address"));
        contactDetailsLayout
                .addComponent(StyleUtils.getLabel("Institute of Media Informatics, Ulm University"));
        contactDetailsLayout.addComponent(StyleUtils.getLabel("James-Franck-Ring, 89073 Ulm, Germany"));
        contactDetailsLayout.addComponent(StyleUtils.getHorizontalLine());
        contactDetailsLayout.addComponent(StyleUtils.getLabelBold("Project Website"));
        contactDetailsLayout
                .addComponent(new Link("www.diretto.org", new ExternalResource("http://www.diretto.org/")));
        contactDetailsLayout.addComponent(StyleUtils.getVerticalSpaceSmall());
        contactDetailsLayout.addComponent(StyleUtils.getLabelBold("GitHub Profile"));
        contactDetailsLayout.addComponent(
                new Link("github.com/diretto", new ExternalResource("https://github.com/diretto")));
        contactDetailsLayout.addComponent(StyleUtils.getVerticalSpaceSmall());
        contactDetailsLayout.addComponent(StyleUtils.getLabelBold("Twitter Account"));
        contactDetailsLayout.addComponent(new Link("twitter.com/diretto_project",
                new ExternalResource("http://twitter.com/diretto_project")));
        contactDetailsLayout.addComponent(StyleUtils.getHorizontalLine());
        contactDetailsLayout.addComponent(StyleUtils.getLabelBold("Email Address"));
        contactDetailsLayout.addComponent(
                new Link("diretto@googlegroups.com", new ExternalResource("mailto:diretto@googlegroups.com")));

        mainLayout.addComponent(contactDetailsLayout);

        VerticalLayout wrapperLayout = new VerticalLayout();
        wrapperLayout.setWidth("600px");
        wrapperLayout.setMargin(false, true, false, true);

        VerticalLayout termsOfUseLayout = new VerticalLayout();
        termsOfUseLayout.setWidth("520px");
        termsOfUseLayout.setMargin(true);
        termsOfUseLayout.setSpacing(true);

        termsOfUseLayout.addComponent(StyleUtils.getLabelH2("Terms of Use"));
        termsOfUseLayout.addComponent(StyleUtils.getHorizontalLine());
        termsOfUseLayout.addComponent(StyleUtils.getLabelBold("Terms"));
        termsOfUseLayout.addComponent(StyleUtils.getLabelHTML(
                "By accessing this website, you are agreeing to be bound by these website <i>Terms of Use</i>, all applicable laws and regulations, and agree that you are responsible for compliance with any applicable local laws. If you do not agree with any of these terms, you are prohibited from using or accessing this site. The materials contained in this web site are protected by applicable copyright and trade mark law."));
        termsOfUseLayout.addComponent(StyleUtils.getHorizontalLine());
        termsOfUseLayout.addComponent(StyleUtils.getLabelBold("Use License"));
        termsOfUseLayout.addComponent(StyleUtils.getLabelHTML(
                "Permission is granted to temporarily download one copy of the materials (information or software) on this website for personal, non-commercial transitory viewing only. This is the grant of a license, not a transfer of title, and under this license you may not:<br /><br />"
                        + "&bull;&nbsp;&nbsp;modify or copy the materials<br />"
                        + "&bull;&nbsp;&nbsp;use the materials for any commercial purpose, or for any public display<br />"
                        + "&bull;&nbsp;&nbsp;attempt to decompile or reverse engineer any software contained on this website<br />"
                        + "&bull;&nbsp;&nbsp;remove any copyright or other proprietary notations from the materials<br />"
                        + "&bull;&nbsp;&nbsp;transfer the materials to another person or any other server<br />"
                        + "<br />This license shall automatically terminate if you violate any of these restrictions and may be terminated by the <i>diretto</i> Project Team at any time. Upon terminating your viewing of these materials or upon the termination of this license, you must destroy any downloaded materials in your possession whether in electronic or printed format."));
        termsOfUseLayout.addComponent(StyleUtils.getHorizontalLine());
        termsOfUseLayout.addComponent(StyleUtils.getLabelBold("Disclaimer"));
        termsOfUseLayout.addComponent(StyleUtils.getLabelHTML(
                "The materials on this website are provided <i>as is</i>. The <i>diretto</i> Project Team makes no warranties, expressed or implied, and hereby disclaims and negates all other warranties, including without limitation, implied warranties or conditions of merchantability, fitness for a particular purpose, or non-infringement of intellectual property or other violation of rights. Further, the <i>diretto</i> Project Team does not warrant or make any representations concerning the accuracy, likely results, or reliability of the use of the materials on its Internet website or otherwise relating to such materials or on any sites linked to this site."));
        termsOfUseLayout.addComponent(StyleUtils.getHorizontalLine());
        termsOfUseLayout.addComponent(StyleUtils.getLabelBold("Limitations"));
        termsOfUseLayout.addComponent(StyleUtils.getLabelHTML(
                "In no event shall the <i>diretto</i> Project Team be liable for any damages (including, without limitation, damages for loss of data or profit, or due to business interruption) arising out of the use or inability to use the materials on this website, even if the <i>diretto</i> Project Team has been notified orally or in writing of the possibility of such damage. Because some jurisdictions do not allow limitations on implied warranties, or limitations of liability for consequential or incidental damages, these limitations may not apply to you. "));
        termsOfUseLayout.addComponent(StyleUtils.getHorizontalLine());
        termsOfUseLayout.addComponent(StyleUtils.getLabelBold("Revisions and Errata"));
        termsOfUseLayout.addComponent(StyleUtils.getLabelHTML(
                "The materials appearing on this website could include technical, typographical, or photographic errors. The <i>diretto</i> Project Team does not warrant that any of the materials on its website are accurate, complete, or current. The <i>diretto</i> Project Team may make changes to the materials contained on its website at any time without notice. The <i>diretto</i> Project Team does not, however, make any commitment to update the materials. "));
        termsOfUseLayout.addComponent(StyleUtils.getHorizontalLine());
        termsOfUseLayout.addComponent(StyleUtils.getLabelBold("Links"));
        termsOfUseLayout.addComponent(StyleUtils.getLabelHTML(
                "The <i>diretto</i> Project Team has not reviewed all of the sites linked to its Internet website and is not responsible for the contents of any such linked site. The inclusion of any link does not imply endorsement by the <i>diretto</i> Project Team of the site. Use of any such linked website is at the user's own risk. "));
        termsOfUseLayout.addComponent(StyleUtils.getHorizontalLine());
        termsOfUseLayout.addComponent(StyleUtils.getLabelBold("Site Terms of Use Modifications"));
        termsOfUseLayout.addComponent(StyleUtils.getLabelHTML(
                "The <i>diretto</i> Project Team may revise these terms of use for its website at any time without notice. By using this website you are agreeing to be bound by the then current version of these <i>Terms of Use</i>."));
        termsOfUseLayout.addComponent(StyleUtils.getHorizontalLine());
        termsOfUseLayout.addComponent(StyleUtils.getLabelBold("Governing Law"));
        termsOfUseLayout.addComponent(StyleUtils.getLabelHTML(
                "Any claim relating to this website shall be governed by the laws of <i>Germany</i> without regard to its conflict of law provisions. General terms and conditions are applicable to the use of this website."));

        wrapperLayout.addComponent(termsOfUseLayout);
        wrapperLayout.setComponentAlignment(termsOfUseLayout, Alignment.TOP_CENTER);
        mainLayout.addComponent(wrapperLayout);

        componentsAdded = true;
    }
}

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

License:Open Source License

/**
 * Method to create a link.//  ww  w  .  ja v a  2 s.co  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.eclipse.hawkbit.ui.components.SPUIComponentProvider.java

License:Open Source License

/**
 * Generates help/documentation links from within management UI.
 *
 * @param i18n/*from   ww  w  . j a v a 2  s  . c  o m*/
 *            the i18n
 * @param uri
 *            to documentation site
 *
 * @return generated link
 */
public static Link getHelpLink(final VaadinMessageSource i18n, final String uri) {

    final Link link = new Link("", new ExternalResource(uri));
    link.setTargetName("_blank");
    link.setIcon(FontAwesome.QUESTION_CIRCLE);
    link.setDescription(i18n.getMessage("tooltip.documentation.link"));
    return link;

}

From source file:org.eclipse.skalli.view.ext.InfoBoxBase.java

License:Open Source License

protected void createLink(Layout layout, String caption, Resource resource, String targetName,
        String styleName) {/* w  ww .j  a  v a2  s  .  c o  m*/
    Link link = new Link(caption, resource);
    if (StringUtils.isNotBlank(targetName)) {
        link.setTargetName(targetName);
    } else {
        link.setTargetName(DEFAULT_TARGET);
    }
    if (StringUtils.isNotBlank(styleName)) {
        link.addStyleName(styleName);
    } else {
        link.addStyleName(STYLE_LINK);
    }
    layout.addComponent(link);
}

From source file:org.escidoc.browser.elabsmodul.views.helpers.LabsStudyTableHelper.java

License:Open Source License

private static Link createLinkByResourcePath(String inputUrl) {
    Preconditions.checkNotNull(inputUrl, "URL is null");
    String urlString = inputUrl.trim();

    if (!urlString.toLowerCase().startsWith(HTTP) && !urlString.toLowerCase().startsWith(HTTPS)) {
        urlString = HTTP + urlString;//from w w w.  ja v  a  2  s .c om
    }

    String inputString = urlString;
    String fileFormat;

    while (inputString.endsWith("/")) {
        inputString = inputString.substring(0, inputString.length() - 1);
    }

    fileFormat = inputString.substring(inputString.lastIndexOf(".") + 1).toLowerCase();
    final Link link = new Link(urlString, new ExternalResource(urlString));
    link.setTargetName("_blank");

    if (fileFormat.startsWith("doc")) {
        link.setIcon(ELabsViewContants.ICON_16_DOC_DOC);
    } else if (fileFormat.startsWith("pdf")) {
        link.setIcon(ELabsViewContants.ICON_16_DOC_PDF);
    } else if (fileFormat.startsWith("ppt")) {
        link.setIcon(ELabsViewContants.ICON_16_DOC_PPT);
    } else if (fileFormat.startsWith("txt")) {
        link.setIcon(ELabsViewContants.ICON_16_DOC_TXT);
    } else if (fileFormat.startsWith("jpg") || fileFormat.startsWith("jpeg") || fileFormat.startsWith("png")) {
        link.setIcon(ELabsViewContants.ICON_16_DOC_IMG);
    } else {
        link.setIcon(ELabsViewContants.ICON_16_DOC_WEB);
    }
    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.escidoc.browser.ui.view.helpers.CreateResourceLinksVH.java

License:Open Source License

public CreateResourceLinksVH(String url, ResourceProxy resourceProxy,
        AbstractComponentContainer componentContainer, Router router) {
    HorizontalLayout vl = buildInitialElements();

    if (resourceProxy.getType().equals(ResourceType.ITEM)) {
        vl.setStyleName("permanentLinkItem");
    } else {/*from  w  w  w .  j a  va 2 s.c  om*/
        vl.setStyleName("permanentLink");
    }
    if (!resourceProxy.getType().equals(ResourceType.CONTEXT)) {

        final Button btnVersionHistory = new Button(" ", new VersionHistoryClickListener(resourceProxy,
                router.getMainWindow(), router.getRepositories()));
        btnVersionHistory.setStyleName(BaseTheme.BUTTON_LINK);
        btnVersionHistory.setDescription("Show Version history in a Pop-up");
        btnVersionHistory.addStyleName("paddingright10");
        btnVersionHistory.setIcon(ICON_HISTORY);
        vl.addComponent(btnVersionHistory);
    }
    try {
        l = new Link("",
                new ExternalResource(
                        url + "?id=" + resourceProxy.getId() + "&type=" + resourceProxy.getType().toString()
                                + "&escidocurl=" + router.getServiceLocation().getEscidocUrl()));
        l.setDescription(ViewConstants.PERMANENT_LINK);
        l.setIcon(new ThemeResource("images/wpzoom/globe-1.png"));
        vl.addComponent(l);

    } catch (MalformedURLException e) {
        componentContainer.getWindow().showNotification(ViewConstants.COULD_NOT_RETRIEVE_APPLICATION_URL);
        LOG.error(ViewConstants.COULD_NOT_RETRIEVE_APPLICATION_URL + e.getLocalizedMessage());
    }
    componentContainer.addComponent(hl);
}

From source file:org.mpavel.app.views.ApplicationView.java

License:Apache License

public ApplicationView() {
    VerticalLayout layout = new VerticalLayout();
    Link lnk = new Link("Count", new ExternalResource("#!" + CountView.NAME));
    layout.addComponent(lnk);/*  www . ja  v a 2 s  .c o  m*/

    lnk = new Link("Message: Hello", new ExternalResource("#!" + MessageView.NAME + "/Hello"));
    layout.addComponent(lnk);

    lnk = new Link("Message: Bye", new ExternalResource("#!" + MessageView.NAME + "/Bye/Goodbye"));
    layout.addComponent(lnk);

    @SuppressWarnings("serial")
    Button logout = new Button("Logout", new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            ApplicationSecurity.logout();
            UI.getCurrent().getNavigator().navigateTo(LoginView.NAME);
        }
    });
    layout.addComponent(logout);
    setContent(layout);
}