Example usage for com.vaadin.ui Link setDescription

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

Introduction

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

Prototype

public void setDescription(String description) 

Source Link

Document

Sets the component's description.

Usage

From source file:com.esofthead.mycollab.vaadin.web.ui.AttachmentDisplayComponent.java

License:Open Source License

public void addAttachmentRow(final Content attachment) {
    String docName = attachment.getPath();
    int lastIndex = docName.lastIndexOf("/");
    if (lastIndex != -1) {
        docName = docName.substring(lastIndex + 1, docName.length());
    }//from www . ja  v a2 s. c o  m

    final AbsoluteLayout attachmentLayout = new AbsoluteLayout();
    attachmentLayout.setWidth(UIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_WIDTH);
    attachmentLayout.setHeight(UIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_HEIGHT);
    attachmentLayout.setStyleName("attachment-block");

    CssLayout thumbnailWrap = new CssLayout();
    thumbnailWrap.setSizeFull();
    thumbnailWrap.setStyleName("thumbnail-wrap");

    Link thumbnail = new Link();
    if (StringUtils.isBlank(attachment.getThumbnail())) {
        thumbnail.setIcon(FileAssetsUtil.getFileIconResource(attachment.getName()));
    } else {
        thumbnail.setIcon(VaadinResourceFactory.getInstance().getResource(attachment.getThumbnail()));
    }

    if (MimeTypesUtil.isImageType(docName)) {
        thumbnail.setResource(VaadinResourceFactory.getInstance().getResource(attachment.getPath()));
        new Fancybox(thumbnail).setPadding(0).setVersion("2.1.5").setEnabled(true).setDebug(true);
    }

    Div contentTooltip = new Div().appendChild(new Span().appendText(docName).setStyle("font-weight:bold"));
    Ul ul = new Ul()
            .appendChild(new Li().appendText("Size: " + FileUtils.getVolumeDisplay(attachment.getSize())))
            .setStyle("line-height:1.5em");
    ul.appendChild(new Li().appendText(
            "Last modified: " + AppContext.formatPrettyTime(attachment.getLastModified().getTime())));
    contentTooltip.appendChild(ul);
    thumbnail.setDescription(contentTooltip.write());
    thumbnail.setWidth(UIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_WIDTH);
    thumbnailWrap.addComponent(thumbnail);

    attachmentLayout.addComponent(thumbnailWrap, "top: 0px; left: 0px; bottom: 0px; right: 0px; z-index: 0;");

    CssLayout attachmentNameWrap = new CssLayout();
    attachmentNameWrap.setWidth(UIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_WIDTH);
    attachmentNameWrap.setStyleName("attachment-name-wrap");

    Label attachmentName = new Label(StringUtils.trim(docName, 60, true));
    attachmentName.setStyleName("attachment-name");
    attachmentNameWrap.addComponent(attachmentName);
    attachmentLayout.addComponent(attachmentNameWrap, "bottom: 0px; left: 0px; right: 0px; z-index: 1;");

    Button trashBtn = new Button(null, new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            ConfirmDialogExt.show(UI.getCurrent(),
                    AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, AppContext.getSiteName()),
                    AppContext.getMessage(GenericI18Enum.CONFIRM_DELETE_ATTACHMENT),
                    AppContext.getMessage(GenericI18Enum.BUTTON_YES),
                    AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.Listener() {
                        private static final long serialVersionUID = 1L;

                        @Override
                        public void onClose(ConfirmDialog dialog) {
                            if (dialog.isConfirmed()) {
                                ResourceService attachmentService = AppContextUtil
                                        .getSpringBean(ResourceService.class);
                                attachmentService.removeResource(attachment.getPath(), AppContext.getUsername(),
                                        AppContext.getAccountId());
                                ((ComponentContainer) attachmentLayout.getParent())
                                        .removeComponent(attachmentLayout);
                            }
                        }
                    });

        }
    });
    trashBtn.setIcon(FontAwesome.TRASH_O);
    trashBtn.setStyleName("attachment-control");
    attachmentLayout.addComponent(trashBtn, "top: 9px; left: 9px; z-index: 1;");

    Button downloadBtn = new Button();
    FileDownloader fileDownloader = new FileDownloader(
            VaadinResourceFactory.getInstance().getStreamResource(attachment.getPath()));
    fileDownloader.extend(downloadBtn);

    downloadBtn.setIcon(FontAwesome.DOWNLOAD);
    downloadBtn.setStyleName("attachment-control");
    attachmentLayout.addComponent(downloadBtn, "right: 9px; top: 9px; z-index: 1;");
    this.addComponent(attachmentLayout);
}

From source file:com.liferay.mail.vaadin.PreferencesView.java

License:Open Source License

public PreferencesView(final Controller controller) {

    this.controller = controller;

    setSpacing(true);/*ww w .  j  av  a 2s  .c om*/

    accountPanel = new Panel(Lang.get("your-email-accounts"));
    updateAccountList();
    addComponent(accountPanel);

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    addComponent(buttons);

    Button createAccountButton = new Button(Lang.get("create-account"));
    createAccountButton.addListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            editAccount(null);
        }
    });
    buttons.addComponent(createAccountButton);

    Button createGmailButton = new Button("Create GMail account");
    createGmailButton.addListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            editGmailAccount(null);

        }
    });
    buttons.addComponent(createGmailButton);

    Link poweredByVaadin = new Link("", new ExternalResource("http://vaadin.com"));
    poweredByVaadin.setIcon(new PortletResource("images/vaadin/powered-by-vaadin.png"));
    poweredByVaadin.setDescription("Mail portlet interface created using Vaadin - RIA's with pure Java.");
    addComponent(poweredByVaadin);
}

From source file:com.mycollab.vaadin.web.ui.AttachmentDisplayComponent.java

License:Open Source License

private void addAttachmentRow(final Content attachment) {
    String docName = attachment.getPath();
    int lastIndex = docName.lastIndexOf("/");
    if (lastIndex != -1) {
        docName = docName.substring(lastIndex + 1, docName.length());
    }//  ww w.  jav  a2 s .c o m

    final AbsoluteLayout attachmentLayout = new AbsoluteLayout();
    attachmentLayout.setWidth(WebUIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_WIDTH);
    attachmentLayout.setHeight(WebUIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_HEIGHT);
    attachmentLayout.setStyleName("attachment-block");

    CssLayout thumbnailWrap = new CssLayout();
    thumbnailWrap.setSizeFull();
    thumbnailWrap.setStyleName("thumbnail-wrap");

    Link thumbnail = new Link();
    if (StringUtils.isBlank(attachment.getThumbnail())) {
        thumbnail.setIcon(FileAssetsUtil.getFileIconResource(attachment.getName()));
    } else {
        thumbnail.setIcon(VaadinResourceFactory.getResource(attachment.getThumbnail()));
    }

    if (MimeTypesUtil.isImageType(docName)) {
        thumbnail.setResource(VaadinResourceFactory.getResource(attachment.getPath()));
        new Fancybox(thumbnail).setPadding(0).setVersion("2.1.5").setEnabled(true).setDebug(true);
    }

    Div contentTooltip = new Div().appendChild(new Span().appendText(docName).setStyle("font-weight:bold"));
    Ul ul = new Ul().appendChild(new Li().appendText(UserUIContext.getMessage(FileI18nEnum.OPT_SIZE_VALUE,
            FileUtils.getVolumeDisplay(attachment.getSize())))).setStyle("line-height:1.5em");
    ul.appendChild(new Li().appendText(UserUIContext.getMessage(GenericI18Enum.OPT_LAST_MODIFIED,
            UserUIContext.formatPrettyTime(attachment.getLastModified().getTime()))));
    contentTooltip.appendChild(ul);
    thumbnail.setDescription(contentTooltip.write());
    thumbnail.setWidth(WebUIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_WIDTH);
    thumbnailWrap.addComponent(thumbnail);

    attachmentLayout.addComponent(thumbnailWrap, "top: 0px; left: 0px; bottom: 0px; right: 0px; z-index: 0;");

    MCssLayout attachmentNameWrap = new MCssLayout()
            .withWidth(WebUIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_WIDTH).withStyleName("attachment-name-wrap");

    Label attachmentName = new ELabel(docName).withStyleName(UIConstants.TEXT_ELLIPSIS);
    attachmentNameWrap.addComponent(attachmentName);
    attachmentLayout.addComponent(attachmentNameWrap, "bottom: 0px; left: 0px; right: 0px; z-index: 1;");

    MButton trashBtn = new MButton("", clickEvent -> {
        ConfirmDialogExt.show(UI.getCurrent(),
                UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, MyCollabUI.getSiteName()),
                UserUIContext.getMessage(GenericI18Enum.CONFIRM_DELETE_ATTACHMENT),
                UserUIContext.getMessage(GenericI18Enum.BUTTON_YES),
                UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> {
                    if (confirmDialog.isConfirmed()) {
                        ResourceService attachmentService = AppContextUtil.getSpringBean(ResourceService.class);
                        attachmentService.removeResource(attachment.getPath(), UserUIContext.getUsername(),
                                true, MyCollabUI.getAccountId());
                        ((ComponentContainer) attachmentLayout.getParent()).removeComponent(attachmentLayout);
                    }
                });
    }).withIcon(FontAwesome.TRASH_O).withStyleName("attachment-control");
    attachmentLayout.addComponent(trashBtn, "top: 9px; left: 9px; z-index: 1;");

    MButton downloadBtn = new MButton().withIcon(FontAwesome.DOWNLOAD).withStyleName("attachment-control");
    FileDownloader fileDownloader = new FileDownloader(
            VaadinResourceFactory.getInstance().getStreamResource(attachment.getPath()));
    fileDownloader.extend(downloadBtn);
    attachmentLayout.addComponent(downloadBtn, "right: 9px; top: 9px; z-index: 1;");
    this.addComponent(attachmentLayout);
}

From source file:edu.nps.moves.mmowgli.components.Footer.java

License:Open Source License

private Link makeLink(String text, String url, String tooltip) {
    Link l = new Link(text, new ExternalResource(url));
    l.setTargetName(PORTALTARGETWINDOWNAME);
    l.setTargetBorder(BorderStyle.DEFAULT);
    l.setDescription(tooltip + " (opens in new window or tab)");
    return l;//from   w w  w. j a v a 2  s .c om
}

From source file:edu.nps.moves.mmowgli.components.Footer.java

License:Open Source License

public static Link buildFouoNoticeTL() {
    GameLinks gl = GameLinks.getTL();//  w  w  w  . j  a v a  2 s .  c  o  m
    MediaLocator mediaLoc = Mmowgli2UI.getGlobals().getMediaLocator();
    Link fouoLink = new Link(null, new ExternalResource(gl.getFouoLink()));
    Resource icon = mediaLoc.locate(new Media("fouo250w36h.png", // todo, database-ize
            "", "", MediaType.IMAGE, Source.GAME_IMAGES_REPOSITORY));
    fouoLink.setIcon(icon);
    fouoLink.setDescription(Game.getTL().getFouoDescription());
    fouoLink.setTargetName(PORTALTARGETWINDOWNAME);
    fouoLink.setTargetBorder(BorderStyle.DEFAULT);
    return fouoLink;
}

From source file:edu.nps.moves.mmowgli.components.Header.java

License:Open Source License

private Link makeSmallLink(String caption, String tooltip, String url) {
    Link link = new Link(caption, new ExternalResource(url));
    link.setDescription(tooltip);
    link.addStyleName("m-header-link");
    link.setTargetName(PORTALTARGETWINDOWNAME);

    return link;// w ww.  j  ava  2s. c om
}

From source file:edu.nps.moves.mmowgli.modules.registrationlogin.RegistrationPageAgreement.java

License:Open Source License

public RegistrationPageAgreement(Button.ClickListener listener) {
    super(listener);
    super.initGui();

    setTitleString(getTitle()); //"User Agreement 1");

    contentVLayout.setSpacing(true);/*from www .j  a  v a  2s  .c o m*/
    Label lab = new HtmlLabel(getLabelText()); //"First, please confirm your willingness to meet game requirements.  I also confirm that I am at least 18 years of age.");
    lab.addStyleName(topLabelStyle);
    contentVLayout.addComponent(lab);

    HorizontalLayout hlayout = new HorizontalLayout();
    contentVLayout.addComponent(hlayout);
    hlayout.setSpacing(true);
    hlayout.setWidth("100%");
    hlayout.addStyleName(labelStyle);

    String readUrl = getReadUrlTL();
    if (readUrl != null) {
        Link readLink = new Link("Read", new ExternalResource(getReadUrlTL())); //REGISTRATIONCONSENTURL));
        readLink.setTargetName("_agreements");
        readLink.setTargetBorder(BorderStyle.DEFAULT);
        readLink.setDescription("Opens in new window/tab");
        hlayout.addComponent(readLink);
        readLink.setSizeUndefined();
        hlayout.setComponentAlignment(readLink, Alignment.MIDDLE_LEFT);
    }

    lab = new HtmlLabel(getReadLabel()); //"<i>Consent to Participate in Anonymous Survey</i>");
    lab.setSizeUndefined();
    hlayout.addComponent(lab);
    hlayout.setSizeUndefined();
    hlayout.setComponentAlignment(lab, Alignment.TOP_LEFT);

    contentVLayout.addComponent(lab = new Label());
    lab.setHeight("15px");

    HorizontalLayout hl = new HorizontalLayout();
    hl.setWidth("98%"); //"100%");
    contentVLayout.addComponent(hl);

    hl.addComponent(lab = new Label());
    lab.setWidth("20px");

    NativeButton rejectButt = new NativeButton();
    hl.addComponent(rejectButt);
    rejectButt.setStyleName("m-rejectNoThanksButton");
    // Mmowgli2UI.getGlobals().mediaLocator().decorateDialogRejectButton(rejectButt);    
    rejectButt.addClickListener(new RejectListener());

    hl.addComponent(lab = new Label());
    hl.setExpandRatio(lab, 1.0f);

    NativeButton continueButt = new NativeButton();
    hl.addComponent(continueButt);
    //Mmowgli2UI.getGlobals().mediaLocator().decorateDialogAcceptAndContinueButton(continueButt);
    continueButt.setStyleName("m-acceptAndContinueButton");
    continueButt.addClickListener(new MyContinueListener());

    continueButt.setClickShortcut(KeyCode.ENTER);
}

From source file:edu.nps.moves.mmowgli.modules.registrationlogin.RegistrationPageAgreementCombo.java

License:Open Source License

public RegistrationPageAgreementCombo(Button.ClickListener listener) {
    super(listener);
    super.initGui();

    setTitleString("User Agreement");

    contentVLayout.setSpacing(true);/* w  w  w .  j a  v a  2  s.  c o  m*/

    Label lab = new Label("I confirm my willingness to meet game requirements:");
    lab.addStyleName(topLabelStyle);
    contentVLayout.addComponent(lab);

    // First
    contentVLayout.addComponent(lab = new Label());
    lab.setHeight("5px"); // space

    contentVLayout.addComponent(lab = new HtmlLabel(
            "First, I confirm that I am at least 18 years of age, I have been informed of risks<br/>and benefits, and I consent to participate."));
    lab.addStyleName(labelStyle);

    HorizontalLayout hlayout = new HorizontalLayout();
    contentVLayout.addComponent(hlayout);
    hlayout.setSpacing(true);
    hlayout.setWidth("100%");
    hlayout.addStyleName(labelStyle);

    // First read
    hlayout.addComponent(lab = new HtmlLabel("&nbsp;&nbsp;"));
    lab.setHeight("10px");
    GameLinks gl = GameLinks.getTL();
    Link readLink = new Link("Read", new ExternalResource(gl.getInformedConsentLink())); //REGISTRATIONCONSENTURL));
    readLink.setTargetName("_agreements");
    readLink.setTargetBorder(BorderStyle.DEFAULT);
    readLink.setDescription("Opens in new window/tab");
    hlayout.addComponent(readLink);
    readLink.setSizeUndefined();

    lab = new HtmlLabel("<i>Informed Consent to Participate in Research</i>");
    lab.setSizeUndefined();
    hlayout.addComponent(lab);

    hlayout.setSizeUndefined();

    // Second
    contentVLayout.addComponent(lab = new Label());
    lab.setHeight("5px"); // space

    lab = new HtmlLabel(
            "Second, I understand that <b style='color:red;'>no classified or sensitive information can be<br/>posted</b> to the game since participation is open.  Violation of this policy may<br/>lead to serious consequences.");
    lab.addStyleName(labelStyle);
    contentVLayout.addComponent(lab);

    hlayout = new HorizontalLayout();
    contentVLayout.addComponent(hlayout);
    hlayout.setSpacing(true);
    hlayout.setWidth("100%");
    hlayout.addStyleName(labelStyle);

    // Second read
    hlayout.addComponent(lab = new HtmlLabel("&nbsp;&nbsp;"));

    readLink = new Link("Read", new ExternalResource(gl.getUserAgreementLink()));
    readLink.setTargetName("_agreements");
    readLink.setTargetBorder(BorderStyle.DEFAULT);
    readLink.setDescription("Opens in new window/tab");
    hlayout.addComponent(readLink);
    readLink.setSizeUndefined();

    lab = new HtmlLabel("<i>Department of Defense Social Media User Agreement</i>");
    lab.setSizeUndefined();
    hlayout.addComponent(lab);

    hlayout.setSizeUndefined();

    // Third
    contentVLayout.addComponent(lab = new Label());
    lab.setHeight("5px"); // space

    lab = new HtmlLabel(
            "Third, the official language of the MMOWGLI game is English.  Other languages<br/>are not supported in order to ensure that player postings are appropriate.");
    lab.addStyleName(labelStyle);
    contentVLayout.addComponent(lab);

    contentVLayout.addComponent(lab = new Label());
    lab.setHeight("15px");

    HorizontalLayout hl = new HorizontalLayout();
    hl.setWidth("100%");
    contentVLayout.addComponent(hl);

    hl.addComponent(lab = new Label());
    lab.setWidth("20px");

    NativeButton rejectButt = new NativeButton();
    hl.addComponent(rejectButt);
    rejectButt.setStyleName("m-rejectNoThanksButton"); //new way
    rejectButt.addClickListener(new RejectListener());

    hl.addComponent(lab = new Label());
    hl.setExpandRatio(lab, 1.0f);

    NativeButton continueButt = new NativeButton();
    hl.addComponent(continueButt);
    continueButt.setStyleName("m-acceptAndContinueButton"); // new way
    continueButt.addClickListener(new MyContinueListener());

    continueButt.setClickShortcut(KeyCode.ENTER);
}

From source file:jp.primecloud.auto.ui.TopBar.java

License:Open Source License

@Override
public void attach() {
    addStyleName("TopBar");
    setWidth("100%");
    setHeight("30px");
    setMargin(false, true, false, false);

    // PrimeCloud
    Label plbl = new Label(IconUtils.createImageTag(getApplication(), Icons.PCCLOGO), Label.CONTENT_XHTML);
    plbl.addStyleName("logo");
    addComponent(plbl);//from   w  w w  .jav  a2  s. c  o m

    // ??
    String versionProp = Config.getVersionProperty("version");
    if (StringUtils.isNotEmpty(versionProp)) {
        StringBuilder version = new StringBuilder();
        version.append("ver").append(versionProp);
        Label versionNo = new Label("<p>" + version.toString() + "</p>", Label.CONTENT_XHTML);
        versionNo.addStyleName("versionNo");
        addComponent(versionNo);
    } else {
        Label versionNo = new Label("<p></p>", Label.CONTENT_XHTML);
        versionNo.addStyleName("versionNoNone");
        addComponent(versionNo);
    }

    // myCloud?
    Button myCloudButton = new Button(ViewProperties.getCaption("button.myCloudManage"));
    myCloudButton.setDescription(ViewProperties.getCaption("description.myCloudManage"));
    myCloudButton.addStyleName("borderless");
    myCloudButton.addStyleName("mycloud");
    myCloudButton.setIcon(Icons.CLOUDBIG.resource());
    myCloudButton.setVisible(true);
    myCloudButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            showCloudEditWindow();
        }
    });
    addComponent(myCloudButton);

    // (Zabbix)
    String useZabbix = Config.getProperty("zabbix.useZabbix");
    if (useZabbix == null || BooleanUtils.toBoolean(useZabbix)) {
        String url = Config.getProperty("zabbix.display");
        Link zabbix = new Link(ViewProperties.getCaption("link.zabbix"), new ExternalResource(url));
        zabbix.setDescription(ViewProperties.getCaption("description.link.zabbix"));
        zabbix.setIcon(Icons.MNGSYSTEM.resource());
        zabbix.setTargetName("_blank");
        zabbix.addStyleName("zabbix");
        addComponent(zabbix);
    }

    // 
    Button eventLogButton = new Button(ViewProperties.getCaption("link.eventlog"));
    eventLogButton.setDescription(ViewProperties.getCaption("description.link.eventlog"));
    eventLogButton.addStyleName("borderless");
    eventLogButton.addStyleName("eventlog");
    eventLogButton.setIcon(Icons.CUSTOM.resource());
    eventLogButton.setVisible(true);
    eventLogButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            WinLogView window = new WinLogView();
            getApplication().addWindow(window);
            getApplication().getMainWindow().open(new ExternalResource(window.getURL()), "_blank");
        }
    });
    addComponent(eventLogButton);

    // 
    Boolean usePayment = BooleanUtils.toBooleanObject(Config.getProperty("payment.usePayment"));
    if (BooleanUtils.isTrue(usePayment)) {
        String url2 = Config.getProperty("payment.display");
        Link payment = new Link(ViewProperties.getCaption("link.payment"), new ExternalResource(url2));
        payment.setDescription(ViewProperties.getCaption("description.link.payment"));
        payment.setIcon(Icons.PAYSYSTEM.resource());
        payment.setTargetName("_payment");
        payment.addStyleName("payment");
        addComponent(payment);
    }

    // 
    Button logoutButton = new Button(ViewProperties.getCaption("button.logout"));
    logoutButton.setDescription(ViewProperties.getCaption("description.logout"));
    logoutButton.addStyleName("borderless");
    logoutButton.addStyleName("logout");
    logoutButton.setIcon(Icons.LOGOUT.resource());
    logoutButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            DialogConfirm dialog = new DialogConfirm(ViewProperties.getCaption("dialog.dialogConfirm"),
                    ViewMessages.getMessage("IUI-000001"), Buttons.OKCancel);
            Callback callback = new Callback() {
                @Override
                public void onDialogResult(Result result) {
                    if (result == Result.OK) {
                        // ?
                        LoggingUtils.removeContext();
                        ContextUtils.invalidateSession();
                        accountButton.setVisible(false);

                        // ????
                        getApplication().close();
                    }
                }
            };
            dialog.setCallback(callback);
            getApplication().getMainWindow().addWindow(dialog);
        }
    });
    addComponent(logoutButton);

    // ?
    accountButton = new Button(ViewProperties.getCaption("button.account"));
    accountButton.setDescription(ViewProperties.getCaption("description.account"));
    accountButton.addStyleName("borderless");
    accountButton.addStyleName("account");
    accountButton.setIcon(Icons.USER.resource());
    accountButton.setVisible(false);
    addComponent(accountButton);
}

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

License:Open Source License

/**
 * Method to create a link./*from ww w  .j av  a  2 s  .  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;

}