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:de.mendelson.comm.as2.webclient2.AboutDialog.java

/**Could be overwritten, contains the content to display*/
@Override/*  w w w.ja  v a  2 s.  c om*/
public AbstractComponent getContentPanel() {
    int maxX = 7;
    Panel panel = new Panel();
    GridLayout gridLayout = new GridLayout(maxX, 17);
    gridLayout.setSizeFull();
    Embedded logComm = new Embedded("", new ThemeResource("images/logocommprotocols.gif"));
    logComm.setType(Embedded.TYPE_IMAGE);
    VerticalLayout gapLayout = new VerticalLayout();
    gapLayout.setMargin(false, true, true, false);
    gapLayout.addComponent(logComm);
    gridLayout.addComponent(gapLayout, 0, 0, 1, 3);
    gridLayout.addComponent(
            new Label("<strong>" + AS2ServerVersion.getFullProductName() + "</strong>", Label.CONTENT_XHTML), 2,
            1, maxX - 1, 1);
    gridLayout.addComponent(new Label(AS2ServerVersion.getLastModificationDate()), 2, 2, maxX - 1, 2);
    gridLayout.addComponent(new Label("<hr/>", Label.CONTENT_XHTML), 0, 4, maxX - 1, 4);
    gridLayout.addComponent(new Label(Copyright.getCopyrightMessage(), Label.CONTENT_XHTML), 0, 5, maxX - 1, 5);
    gridLayout.addComponent(new Label(AS2ServerVersion.getStreet(), Label.CONTENT_XHTML), 0, 6, maxX - 1, 6);
    gridLayout.addComponent(new Label(AS2ServerVersion.getZip(), Label.CONTENT_XHTML), 0, 7, maxX - 1, 7);
    gridLayout.addComponent(new Label(AS2ServerVersion.getTelephone(), Label.CONTENT_XHTML), 0, 8, maxX - 1, 8);
    gridLayout.addComponent(new Label(AS2ServerVersion.getInfoEmail(), Label.CONTENT_XHTML), 0, 9, maxX - 1, 9);
    gridLayout.addComponent(new Label("<hr/>", Label.CONTENT_XHTML), 0, 10, 6, 10);
    gridLayout.addComponent(
            new Link("http://www.mendelson.de", new ExternalResource("http://www.mendelson.de")), 0, 11,
            maxX - 1, 11);
    gridLayout.addComponent(
            new Link("http://www.mendelson-e-c.com", new ExternalResource("http://www.mendelson-e-c.com")), 0,
            12, maxX - 1, 12);
    gridLayout.addComponent(new Label("<hr/>", Label.CONTENT_XHTML), 0, 13, maxX - 1, 13);
    gridLayout.addComponent(new Label("<br/>", Label.CONTENT_XHTML), 0, 14, maxX - 1, 14);
    gridLayout.addComponent(
            new Label("[Based on VAADIN " + com.vaadin.terminal.gwt.server.ApplicationServlet.VERSION + "]"), 0,
            16, maxX - 1, 16);
    panel.addComponent(gridLayout);
    return (panel);
}

From source file:de.symeda.sormas.ui.AboutView.java

License:Open Source License

public AboutView() {
    CustomLayout aboutContent = new CustomLayout("aboutview");
    aboutContent.setStyleName("about-content");

    // Info section
    VerticalLayout infoLayout = new VerticalLayout();
    infoLayout.setSpacing(false);/*from  ww  w  .ja  v  a2s . c  o  m*/
    infoLayout.setMargin(false);
    aboutContent.addComponent(infoLayout, "info");

    Label versionLabel = new Label(VaadinIcons.INFO_CIRCLE.getHtml() + " "
            + I18nProperties.getCaption(Captions.aboutSormasVersion) + ": " + InfoProvider.get().getVersion(),
            ContentMode.HTML);
    infoLayout.addComponent(versionLabel);

    Link whatsNewLink = new Link(I18nProperties.getCaption(Captions.aboutWhatsNew),
            new ExternalResource(
                    "https://github.com/hzi-braunschweig/SORMAS-Project/releases/tag/releases%2Fversion-"
                            + InfoProvider.get().getBaseVersion()));
    whatsNewLink.setTargetName("_blank");
    infoLayout.addComponent(whatsNewLink);

    Link sormasWebsiteLink = new Link(I18nProperties.getCaption(Captions.aboutSormasWebsite),
            new ExternalResource("https://sormasorg.helmholtz-hzi.de/"));
    sormasWebsiteLink.setTargetName("_blank");
    infoLayout.addComponent(sormasWebsiteLink);

    Link sormasGithubLink = new Link("SORMAS Github",
            new ExternalResource("https://github.com/hzi-braunschweig/SORMAS-Project"));
    sormasGithubLink.setTargetName("_blank");
    infoLayout.addComponent(sormasGithubLink);

    Link changelogLink = new Link(I18nProperties.getCaption(Captions.aboutChangelog),
            new ExternalResource("https://github.com/hzi-braunschweig/SORMAS-Project/releases"));
    changelogLink.setTargetName("_blank");
    infoLayout.addComponent(changelogLink);

    // Documents section
    VerticalLayout documentsLayout = new VerticalLayout();
    documentsLayout.setSpacing(false);
    documentsLayout.setMargin(false);
    aboutContent.addComponent(documentsLayout, "documents");

    Button classificationDocumentButton = new Button(
            I18nProperties.getCaption(Captions.aboutCaseClassificationRules));
    CssStyles.style(classificationDocumentButton, ValoTheme.BUTTON_LINK, CssStyles.BUTTON_COMPACT);
    documentsLayout.addComponent(classificationDocumentButton);

    try {
        String serverUrl = new URL(((VaadinServletRequest) VaadinService.getCurrentRequest())
                .getHttpServletRequest().getRequestURL().toString()).getAuthority();
        StreamResource classificationResource = DownloadUtil.createStringStreamResource(
                ClassificationHtmlRenderer.createHtmlForDownload(serverUrl,
                        FacadeProvider.getDiseaseConfigurationFacade().getAllActivePrimaryDiseases()),
                "classification_rules.html", "text/html");
        new FileDownloader(classificationResource).extend(classificationDocumentButton);
    } catch (MalformedURLException e) {

    }

    Button dataDictionaryButton = new Button(I18nProperties.getCaption(Captions.aboutDataDictionary));
    CssStyles.style(dataDictionaryButton, ValoTheme.BUTTON_LINK, CssStyles.BUTTON_COMPACT);
    documentsLayout.addComponent(dataDictionaryButton);
    FileDownloader dataDictionaryDownloader = new FileDownloader(
            new ClassResource("/doc/SORMAS_Data_Dictionary.xlsx"));
    dataDictionaryDownloader.extend(dataDictionaryButton);

    Link technicalManualLink = new Link(I18nProperties.getCaption(Captions.aboutTechnicalManual),
            new ExternalResource(
                    "https://github.com/hzi-braunschweig/SORMAS-Project/files/2585973/SORMAS_Technical_Manual_Webversion_20180911.pdf"));
    technicalManualLink.setTargetName("_blank");
    documentsLayout.addComponent(technicalManualLink);

    setSizeFull();
    setStyleName("about-view");
    addComponent(aboutContent);
    setComponentAlignment(aboutContent, Alignment.MIDDLE_CENTER);
}

From source file:de.symeda.sormas.ui.caze.CaseController.java

License:Open Source License

public Link createLinkToData(String caseUuid, String caption) {
    Link link = new Link(caption, new ExternalResource("#!" + CaseDataView.VIEW_NAME + "/" + caseUuid));
    return link;//  w  w  w.  j a v a2s  . c  o  m
}

From source file:de.symeda.sormas.ui.SubMenu.java

License:Open Source License

public void addView(final String name, String caption, String params, boolean isBackNavigation) {
    String target = "#!" + name + (params != null ? "/" + params : "");

    CssLayout tabItemCell = new CssLayout();
    tabItemCell.setSizeUndefined();/*  w ww.  j a  v  a 2s . c o  m*/
    tabItemCell.setPrimaryStyleName("v-tabsheet-tabitemcell");

    CssLayout tabItem = new CssLayout();
    tabItem.setSizeUndefined();
    tabItem.setPrimaryStyleName("v-tabsheet-tabitem");
    if (isBackNavigation) {
        tabItem.addStyleName("back");
    }
    tabItemCell.addComponent(tabItem);

    Link link = new Link(caption, new ExternalResource(target));
    link.addStyleName("v-caption");
    if (isBackNavigation)
        link.setIcon(VaadinIcons.ARROW_CIRCLE_LEFT);
    tabItem.addComponent(link);

    menuItemsLayout.addComponent(tabItemCell);
    viewMenuItemMap.put(name, tabItem);
}

From source file:de.symeda.sormas.ui.SubMenu.java

License:Open Source License

public void addView(final String name, String caption, LayoutClickListener onClick) {
    CssLayout tabItemCell = new CssLayout();
    tabItemCell.setSizeUndefined();/*from  www . j a v a 2 s  . com*/
    tabItemCell.setPrimaryStyleName("v-tabsheet-tabitemcell");

    CssLayout tabItem = new CssLayout();
    tabItem.setSizeUndefined();
    tabItem.setPrimaryStyleName("v-tabsheet-tabitem");
    tabItemCell.addComponent(tabItem);

    Link link = new Link(caption, null);
    link.addStyleName("v-caption");

    tabItem.addComponent(link);
    tabItem.addLayoutClickListener(onClick);
    tabItem.addLayoutClickListener((e) -> {
        this.setActiveView(name);
    });

    menuItemsLayout.addComponent(tabItemCell);
    viewMenuItemMap.put(name, tabItem);
}

From source file:de.unioninvestment.eai.portal.portlet.crud.CrudUI.java

License:Apache License

private ComponentContainer initializeHelpPage() {

    DatasourceInfos datasourceInfos = new DatasourceInfos();
    DatasourceInfoView datasourceInfoView = new DatasourceInfoView(datasourceInfos.getContainer());
    this.datasourceInfo = new DatasourceInfoPresenter(datasourceInfoView, datasourceInfos);

    VerticalLayout help = new VerticalLayout();
    help.setSpacing(true);/*from w ww  .  j  a va 2 s . co  m*/
    help.addComponent(new Link(Context.getMessage("portlet.crud.page.help.message"),
            new ExternalResource(settings.getHelpUrl())));
    help.addComponent(new Label(
            Context.getMessage("portlet.crud.page.help.buildNumberLabel", settings.getBuildNumber())));
    help.addComponent(this.datasourceInfo.getView());

    return help;
}

From source file:de.unioninvestment.eai.portal.portlet.crud.mvp.views.configuration.DefaultPortletRolesView.java

License:Apache License

@Override
public void display(List<PortletRoleTO> roles) {
    for (PortletRoleTO portletRole : roles) {
        ExternalResource res = new ExternalResource(permissionsUrl(portletRole));
        rolesLayout.addComponent(new Link(portletRole.getName(), res));
    }/*w ww  .  ja  v  a2 s. c o m*/
}

From source file:de.unioninvestment.eai.portal.portlet.crud.mvp.views.ui.BusinessExceptionMessage.java

License:Apache License

private void buildUi(String message) {
    try {/*  w  w w  . ja  v a2  s. com*/
        PortletURL url = ((MimeResponse) VaadinPortletService.getCurrentResponse().getPortletResponse())
                .createRenderURL();
        url.setPortletMode(PortletMode.EDIT);
        ExternalResource editUrl = new ExternalResource(url.toString());
        setCompositionRoot(new Link(message, editUrl));

    } catch (PortletModeException e1) {
        // not allowed
        setCompositionRoot(new Label(message));
    }
}

From source file:de.unioninvestment.eai.portal.support.vaadin.support.UnconfiguredMessage.java

License:Apache License

/**
 * Konstruktor.//from  w  w  w  .  j a  va  2  s. com
 */
public UnconfiguredMessage() {
    String message = Context.getMessage("portlet.crud.info.unconfigured");
    try {
        PortletResponse portletResponse = VaadinPortletService.getCurrentResponse().getPortletResponse();
        PortletURL url = ((MimeResponse) portletResponse).createRenderURL();
        url.setPortletMode(PortletMode.EDIT);
        ExternalResource editUrl = new ExternalResource(url.toString());
        setCompositionRoot(new Link(message, editUrl));

    } catch (PortletModeException e) {
        // not allowed
        setCompositionRoot(new Label(message));
    }
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.QbicmainportletUI.java

License:Open Source License

/**
 * builds page if user is not logged in//from  w w w  .jav a  2 s .co m
 */
private void buildNotLoggedinLayout() {
    // Mail to qbic
    ExternalResource resource = new ExternalResource("mailto:info@qbic.uni-tuebingen.de");
    Link mailToQbicLink = new Link("", resource);
    mailToQbicLink.setIcon(new ThemeResource("mail9.png"));

    ThemeDisplay themedisplay = (ThemeDisplay) VaadinService.getCurrentRequest()
            .getAttribute(WebKeys.THEME_DISPLAY);

    // redirect to liferay login page
    Link loginPortalLink = new Link("", new ExternalResource(themedisplay.getURLSignIn()));
    loginPortalLink.setIcon(new ThemeResource("lock12.png"));

    // left part of the page
    VerticalLayout signIn = new VerticalLayout();
    signIn.addComponent(
            new Label("<h3>Sign in to manage your projects and access your data:</h3>", ContentMode.HTML));
    signIn.addComponent(loginPortalLink);
    signIn.setStyleName("no-user-login");
    // right part of the page
    VerticalLayout contact = new VerticalLayout();
    contact.addComponent(
            new Label("<h3>If you are interested in doing projects get in contact:</h3>", ContentMode.HTML));
    contact.addComponent(mailToQbicLink);
    contact.setStyleName("no-user-login");

    // build final layout, with some gaps between
    HorizontalLayout notSignedInLayout = new HorizontalLayout();
    Label expandingGap1 = new Label();
    expandingGap1.setWidth("100%");
    notSignedInLayout.addComponent(expandingGap1);
    notSignedInLayout.addComponent(signIn);

    notSignedInLayout.addComponent(contact);
    notSignedInLayout.setExpandRatio(expandingGap1, 0.16f);
    notSignedInLayout.setExpandRatio(signIn, 0.36f);

    notSignedInLayout.setExpandRatio(contact, 0.36f);

    notSignedInLayout.setWidth("100%");
    notSignedInLayout.setSpacing(true);
    setContent(notSignedInLayout);
}