Example usage for com.vaadin.server ExternalResource ExternalResource

List of usage examples for com.vaadin.server ExternalResource ExternalResource

Introduction

In this page you can find the example usage for com.vaadin.server ExternalResource ExternalResource.

Prototype

public ExternalResource(String sourceURL) 

Source Link

Document

Creates a new download component for downloading directly from given URL.

Usage

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

License:Open Source License

@Override
protected Component initContent() {
    if (StringUtils.isBlank(caption)) {
        Label lbl = new Label(" ");
        lbl.setContentMode(ContentMode.HTML);
        lbl.setWidth("100%");
        return lbl;
    } else {//from ww  w  . j a v  a 2  s .c o m
        linkAccount = (linkAccount == null) ? "" : linkAccount;
        final Link link = new Link();
        link.setResource(new ExternalResource(linkAccount));
        link.setCaption(caption);
        link.setTargetName("_blank");
        link.setWidth(UIConstants.DEFAULT_CONTROL_WIDTH);
        return link;
    }
}

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

License:Open Source License

public LoginScreen() {

    this.twitterLink = new Link();
    this.pinField = new TextField();

    this.submitButton = new Button("Submit");

    setMargin(true);/*  ww  w.  j a  v a  2 s .c o  m*/
    setSpacing(true);
    try {
        twitterLink.setCaption("Get PIN");
        twitterLink.setTargetName("twitterauth");
        twitterLink.setResource(new ExternalResource(TwitterService.get().getAuthenticationUrl()));

        pinField.setInputPrompt("PIN");

        addComponent(twitterLink);
        addComponent(pinField);
        addComponent(submitButton);

        submitButton.addClickListener(new LoginBehaviour(pinField));
    } catch (TwitterException ex) {
        Logger.getLogger(LoginScreen.class.getName()).log(Level.SEVERE, null, ex);
        throw new InstantiationError();

    }
}

From source file:com.github.daytron.twaattin.ui.tabledecorator.ProfileImageColumnGenerator.java

License:Open Source License

/**
 * @return Profile image of the underlying {@link User} as an {@link Image}
 * component//from w w  w .ja v a 2 s .  co m
 */
@Override
public Object generateCell(Table source, Object itemId, Object columnId) {
    User user = getUser(source, itemId);

    String url = user.getMiniProfileImageURL();

    if (url != null) {

        ExternalResource resource = new ExternalResource(url);

        return new Image("", resource);
    }

    return null;
}

From source file:com.github.daytron.twaattin.ui.tabledecorator.ScreenNameColumnGenerator.java

License:Open Source License

/**
 * @param source/*  w  ww .  j  av a  2  s.  c  om*/
 * @param itemId
 * @param columnId
 * @return Screen name of the underlying {@link User} as a {@link Link}
 * component.
 */
@Override
public Object generateCell(Table source, Object itemId, Object columnId) {

    User user = getUser(source, itemId);

    ExternalResource resource = new ExternalResource(TWITTER_USER_URL + user.getScreenName());

    Link link = new Link('@' + user.getScreenName(), resource);

    link.setTargetName("screenname");

    return link;
}

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.
 *///from   w  ww .  j  a v a  2s .  co  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.admin.system.pagemode.AdminMonitoringPageModContentFactoryImpl.java

License:Apache License

@Secured({ "ROLE_ADMIN" })
@Override//www  .j  a  v a2s . c  om
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
    final VerticalLayout content = createPanelContent();

    final String pageId = getPageId(parameters);

    getMenuItemFactory().createMainPageMenuBar(menuBar);

    final BrowserFrame browser = new BrowserFrame(ADMIN_MONITORING,
            new ExternalResource(MONITORING_CONTEXT_PATH));
    browser.setSizeFull();

    content.addComponent(browser);
    content.setExpandRatio(browser, ContentRatio.FULL_SIZE);

    getPageActionEventHelper().createPageEvent(ViewAction.VISIT_ADMIN_MONITORING_VIEW,
            ApplicationEventGroup.ADMIN, NAME, null, pageId);

    return content;

}

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);/*  w  w  w  .  j  a  v  a 2s. com*/
    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;
}