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.hack23.cia.web.impl.ui.application.views.common.pagelinks.impl.PageLinkFactoryImpl.java

License:Apache License

@Override
public Link addPartyPageLink(final ViewRiksdagenParty data) {
    final Link pageLink = new Link(PARTY + data.getPartyName(),
            new ExternalResource(PAGE_PREFIX + UserViews.PARTY_VIEW_NAME + PAGE_SEPARATOR + data.getPartyId()));
    pageLink.setId(ViewAction.VISIT_PARTY_VIEW.name() + PAGE_SEPARATOR + data.getPartyId());
    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 createPoliticianPageLink(final PersonData personData) {
    final Link pageLink = new Link(POLITICIAN + personData.getFirstName() + ' ' + personData.getLastName(),
            new ExternalResource(
                    PAGE_PREFIX + UserViews.POLITICIAN_VIEW_NAME + PAGE_SEPARATOR + personData.getId()));
    pageLink.setId(ViewAction.VISIT_POLITICIAN_VIEW.name() + PAGE_SEPARATOR + personData.getId());
    pageLink.setIcon(FontAwesome.BUG);//from   w ww  .j  ava  2s  . 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 createSearchDocumentViewPageLink() {
    final Link pageLink = new Link(SEARCH,
            new ExternalResource(PAGE_PREFIX + UserViews.SEARCH_DOCUMENT_VIEW_NAME));
    pageLink.setId(ViewAction.VISIT_DOCUMENT_VIEW.name());
    pageLink.setIcon(FontAwesome.SEARCH);

    return pageLink;
}

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

License:Apache License

@Override
public Link createAdminPagingLink(final String label, final String page, final String pageId,
        final String pageNr) {
    final Link pageLink = new Link(label,
            new ExternalResource(PAGE_PREFIX + page + PAGE_SEPARATOR + "[" + pageNr + "]"));
    pageLink.setId(page + "ShowPage" + PAGE_SEPARATOR + pageNr);
    pageLink.setIcon(FontAwesome.SERVER);

    return pageLink;
}

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

License:Apache License

@Override
public Link createUserHomeViewPageLink() {
    final Link pageLink = new Link("User account:" + UserContextUtil.getUserNameFromSecurityContext(),
            new ExternalResource(PAGE_PREFIX + UserViews.USERHOME_VIEW_NAME));
    pageLink.setId(ViewAction.VISIT_USER_HOME_VIEW.name());
    pageLink.setIcon(FontAwesome.USER);/* ww w .  jav a2s  .c o  m*/
    return pageLink;
}

From source file:com.hack23.cia.web.impl.ui.application.views.user.politician.pagemode.PoliticianOverviewPageModContentFactoryImpl.java

License:Apache License

/**
 * Creates the overview content./*from   ww  w .j  ava 2s  .  co  m*/
 *
 * @param panelContent
 *            the panel content
 * @param personData
 *            the person data
 * @param viewRiksdagenPolitician
 *            the view riksdagen politician
 * @param pageId
 */
private void createOverviewContent(final VerticalLayout panelContent, final PersonData personData,
        final ViewRiksdagenPolitician viewRiksdagenPolitician, final String pageId) {
    LabelFactory.createHeader2Label(panelContent, OVERVIEW);

    final VerticalLayout overviewLayout = new VerticalLayout();
    overviewLayout.setSizeFull();

    panelContent.addComponent(overviewLayout);
    panelContent.setExpandRatio(overviewLayout, ContentRatio.LARGE_FORM);

    getPoliticianMenuItemFactory().createOverviewPage(overviewLayout, pageId);

    final Link createPoliticianPageLink = getPageLinkFactory().createPoliticianPageLink(personData);
    panelContent.addComponent(createPoliticianPageLink);

    final Image image = new Image("",
            new ExternalResource(personData.getImageUrl192().replace("http://", "https://")));

    final HorizontalLayout horizontalLayout = new HorizontalLayout();
    horizontalLayout.setSizeFull();

    panelContent.addComponent(horizontalLayout);

    horizontalLayout.addComponent(image);

    getFormFactory().addFormPanelTextFields(horizontalLayout, new BeanItem<>(viewRiksdagenPolitician),
            ViewRiksdagenPolitician.class,
            Arrays.asList(new String[] { "firstName", "lastName", "gender", "bornYear", "party", "active",
                    "firstAssignmentDate", "lastAssignmentDate", "currentAssignments",
                    "currentMinistryAssignments", "currentSpeakerAssignments", "currentCommitteeAssignments",
                    "currentPartyAssignments", "totalMinistryAssignments", "totalCommitteeAssignments",
                    "totalSpeakerAssignments", "totalPartyAssignments", "totalAssignments", "totalDaysServed",
                    "activeEu", "totalDaysServedEu", "activeGovernment", "totalDaysServedGovernment",
                    "activeSpeaker", "totalDaysServedSpeaker", "activeCommittee", "totalDaysServedCommittee",
                    "activeParliament", "totalDaysServedParliament", "activeParty", "totalDaysServedParty" }));

    getGridFactory().createBasicBeanItemGrid(panelContent,
            new BeanItemContainer<>(DetailData.class, personData.getPersonDetailData().getDetailList()),
            "Detail", new String[] { "code", "detail" }, new String[] { "hjid", "intressentId", "detailType" },
            null, null, null);

    panelContent.setExpandRatio(createPoliticianPageLink, ContentRatio.SMALL);
    panelContent.setExpandRatio(horizontalLayout, ContentRatio.GRID);

}

From source file:com.haulmont.cuba.web.gui.components.mainwindow.WebNewWindowButton.java

License:Apache License

public WebNewWindowButton() {
    component = new CubaButton();
    component.addStyleName(NEW_WINDOW_BUTTON_STYLENAME);
    component.setDescription(null);/*w  ww . j a  va 2  s.  c o  m*/

    URL pageUrl;
    try {
        pageUrl = Page.getCurrent().getLocation().toURL();
    } catch (MalformedURLException ignored) {
        LoggerFactory.getLogger(WebNewWindowButton.class).warn("Couldn't get URL of current Page");
        return;
    }

    ExternalResource currentPage = new ExternalResource(pageUrl);
    final BrowserWindowOpener opener = new BrowserWindowOpener(currentPage);
    opener.setWindowName("_blank");

    opener.extend(component);
}

From source file:com.haulmont.cuba.web.gui.components.WebEmbedded.java

License:Apache License

@Override
public void setSource(URL src) {
    if (src != null) {
        resource = new ExternalResource(src);
        component.setSource(resource);//from w w w  .  jav  a 2 s.  c om
        setType(Type.BROWSER);
    } else {
        resetSource();
    }
}

From source file:com.haulmont.cuba.web.gui.components.WebEmbedded.java

License:Apache License

@Override
public void setRelativeSource(String src) {
    if (src != null) {
        try {/*from  w  w  w . jav a 2s  .  c om*/
            URL context = new URL(ControllerUtils.getLocationWithoutParams());
            resource = new ExternalResource(new URL(context, src));
            component.setSource(resource);
            setType(Type.BROWSER);
        } catch (MalformedURLException e) {
            throw new RuntimeException("Unable to get external resource for given relative source");
        }
    } else {
        resetSource();
    }
}

From source file:com.haulmont.cuba.web.gui.components.WebLink.java

License:Apache License

@Override
public void setUrl(String url) {
    component.setResource(new ExternalResource(url));
}