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:com.github.daytron.twaattin.ui.tabledecorator.SourceColumnDecorator.java

License:Open Source License

/**
 * @return Source of the tweet as a {@link Link} component.
 *///w ww  .j  a  v a2s. c  o m
@Override
public Object generateCell(Table source, Object itemId, Object columnId) {

    Item item = source.getItem(itemId);

    @SuppressWarnings("unchecked")
    Property<String> property = item.getItemProperty(columnId);

    Document document = Jsoup.parseBodyFragment(property.getValue());

    Elements elements = document.getElementsByTag("a");

    if (elements.size() > 0) {

        Element element = elements.get(0);

        String text = element.text();

        String url = element.absUrl("href");

        ExternalResource resource = new ExternalResource(url);

        Link link = new Link(text, resource);

        link.setTargetName("source");

        return link;
    }

    return null;
}

From source file:com.hack23.cia.web.impl.ui.application.views.common.pagelinks.impl.PageLinkFactoryImpl.java

License:Apache License

@Override
public Link createMainViewPageLink() {
    final Link pageLink = new Link(MAIN_VIEW_LINK_TEXT,
            new ExternalResource(LINK_SEPARATOR + CommonsViews.MAIN_VIEW_NAME));
    pageLink.setId(ViewAction.VISIT_MAIN_VIEW.name());
    pageLink.setIcon(FontAwesome.STAR);/* www  .j  a va2 s . c o m*/
    return pageLink;
}

From source file:com.hack23.cia.web.impl.ui.application.views.common.pagelinks.impl.PageLinkFactoryImpl.java

License:Apache License

@Override
public Link createRegisterPageLink() {
    final Link pageLink = new Link("Register", new ExternalResource(
            LINK_SEPARATOR + CommonsViews.MAIN_VIEW_NAME + PAGE_SEPARATOR + ApplicationPageMode.REGISTER));
    pageLink.setId(ViewAction.VISIT_REGISTER.name());
    pageLink.setIcon(FontAwesome.USER_PLUS);
    return pageLink;
}

From source file:com.hack23.cia.web.impl.ui.application.views.common.pagelinks.impl.PageLinkFactoryImpl.java

License:Apache License

@Override
public Link createLoginPageLink() {
    final Link pageLink = new Link("Login", new ExternalResource(
            LINK_SEPARATOR + CommonsViews.MAIN_VIEW_NAME + PAGE_SEPARATOR + ApplicationPageMode.LOGIN));
    pageLink.setId(ViewAction.VISIT_LOGIN.name());
    pageLink.setIcon(FontAwesome.SIGN_IN);
    return pageLink;
}

From source file:com.hack23.cia.web.impl.ui.application.views.common.pagelinks.impl.PageLinkFactoryImpl.java

License:Apache License

@Override
public Link createCountryRankingViewPageLink() {
    final Link pageLink = new Link(COUNTRY_RANKING_LINK_TEXT,
            new ExternalResource(LINK_SEPARATOR + UserViews.COUNTRY_RANKING_VIEW_NAME));
    pageLink.setId(ViewAction.VISIT_TEST_CHART_VIEW.name());
    pageLink.setIcon(FontAwesome.FLAG);/*from  ww  w .j  a va 2  s  .  c  om*/
    return pageLink;
}

From source file:com.hack23.cia.web.impl.ui.application.views.common.pagelinks.impl.PageLinkFactoryImpl.java

License:Apache License

@Override
public Link createParliamentViewPageLink() {
    final Link pageLink = new Link(PARLIAMENT_RANKING_LINK_TEXT,
            new ExternalResource(LINK_SEPARATOR + UserViews.PARLIAMENT_RANKING_VIEW_NAME));
    pageLink.setId(ViewAction.VISIT_TEST_CHART_VIEW.name());
    pageLink.setIcon(FontAwesome.INSTITUTION);
    return pageLink;
}

From source file:com.hack23.cia.web.impl.ui.application.views.common.pagelinks.impl.PageLinkFactoryImpl.java

License:Apache License

@Override
public Link createMinistryRankingViewPageLink() {
    final Link pageLink = new Link(MINISTRY_RANKING_LINK_TEXT,
            new ExternalResource(LINK_SEPARATOR + UserViews.MINISTRY_RANKING_VIEW_NAME));
    pageLink.setId(ViewAction.VISIT_MINISTRY_RANKING_VIEW.name());
    pageLink.setIcon(FontAwesome.GROUP);
    return pageLink;
}

From source file:com.hack23.cia.web.impl.ui.application.views.common.pagelinks.impl.PageLinkFactoryImpl.java

License:Apache License

@Override
public Link createCommitteeRankingViewPageLink() {
    final Link pageLink = new Link(COMMITTEE_RANKING_LINK_TEXT,
            new ExternalResource(LINK_SEPARATOR + UserViews.COMMITTEE_RANKING_VIEW_NAME));
    pageLink.setId(ViewAction.VISIT_COMMITTEE_RANKING_VIEW.name());
    pageLink.setIcon(FontAwesome.GROUP);
    return pageLink;
}

From source file:com.hack23.cia.web.impl.ui.application.views.common.pagelinks.impl.PageLinkFactoryImpl.java

License:Apache License

@Override
public Link createPartyRankingViewPageLink() {
    final Link pageLink = new Link(PARTY_RANKING_LINK_TEXT,
            new ExternalResource(LINK_SEPARATOR + UserViews.PARTY_RANKING_VIEW_NAME));
    pageLink.setId(ViewAction.VISIT_PARTY_RANKING_VIEW.name());
    pageLink.setIcon(FontAwesome.GROUP);
    return pageLink;
}

From source file:com.hack23.cia.web.impl.ui.application.views.common.pagelinks.impl.PageLinkFactoryImpl.java

License:Apache License

@Override
public Link createPoliticianRankingViewPageLink() {
    final Link pageLink = new Link(POLITICIAN_RANKING_LINK_TEXT,
            new ExternalResource(LINK_SEPARATOR + UserViews.POLITICIAN_RANKING_VIEW_NAME));
    pageLink.setId(ViewAction.VISIT_POLITICIAN_RANKING_VIEW.name());
    pageLink.setIcon(FontAwesome.BUG);//from w w  w  .  ja  v  a  2s .  co  m
    return pageLink;
}