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.anphat.customer.ui.ImportCustomerUploadForm.java

private GridLayout buildGridUpload() {
    uploadInfoLayout = new GridLayout(4, 1);
    CommonUtils.setBasicAttributeLayout(uploadInfoLayout, null, false);
    choiceTypeUpload = CommonUtils.buildComboBox();
    uploadInfoLayout.addComponent(choiceTypeUpload, 1, 0, 2, 0);
    //        uploadInfoLayout.setComponentAlignment(choiceTypeUpload, Alignment.MIDDLE_LEFT);
    linkTemplate = new Link(LINK_CAPTION, FontAwesome.LINK);
    linkTemplate.setImmediate(true);//www.jav a  2  s. c o m
    uploadInfoLayout.addComponent(linkTemplate, 3, 0);
    //        uploadInfoLayout.setComponentAlignment(linkTemplate, Alignment.MIDDLE_LEFT);

    return uploadInfoLayout;
}

From source file:com.anphat.list.controller.ContractTemplateListController.java

public void initTable() {
    beanItemContainerContractTemplateList = new BeanItemContainer<>(ContractTemplateListDTO.class);
    tblContractTemplateList.addGeneratedColumn("download", new CustomTable.ColumnGenerator() {
        @Override//from  w w  w  .j  ava2  s .c  o  m
        public Object generateCell(CustomTable source, Object itemId, Object columnId) {
            ContractTemplateListDTO ctldto = (ContractTemplateListDTO) itemId;
            Link btnDownload;
            btnDownload = new Link("Ti v?", new ThemeResource(Constants.ICON.DOCX));
            btnDownload.setImmediate(true);
            File file = new File(Constants.PATH_TEMPLATE + ctldto.getPathFile());
            if (file.exists()) {
                FileDownloader downloader = new FileDownloader(file, ctldto.getPathFile());
                btnDownload.setResource(downloader);
                return btnDownload;
            } else {
                return "";
            }
        }
    });
    CommonFunctionTableFilter.initTable(panelContractTemplateList, headerData,
            beanItemContainerContractTemplateList, BundleUtils.getString("table.list.contractTemplateList"), 10,
            "contractTemplateList.header", true, true, false, false, false);
    CommonUtils.convertFieldAppParamTable(panelContractTemplateList.getMainTable(), "status",
            Constants.APP_PARAMS.COMMON_STATUS, mapStatus);
    CommonUtils.convertFieldAppParamTable(panelContractTemplateList.getMainTable(), "service",
            Constants.APP_PARAMS.SERVICE_TYPE, mapService);
    CommonUtils.convertFieldAppParamTable(panelContractTemplateList.getMainTable(), "type",
            Constants.APP_PARAMS.TYPE_CONTRACT, mapType);
    CommonUtils.convertFieldAppParamTable(panelContractTemplateList.getMainTable(), "provider",
            Constants.APP_PARAMS.PROVIDER, mapProvider);
    panelContractTemplateList.getCoppyButton().setVisible(false);
    panelContractTemplateList.getDeleteButton().setVisible(false);
    tblContractTemplateList.setMultiSelect(false);
}

From source file:com.anphat.statistics.ui.StatisticStaffPointUploadDialog.java

private GridLayout buildGridUpload() {
    uploadInfoLayout = new GridLayout(4, 1);
    CommonUtils.setBasicAttributeLayout(uploadInfoLayout, GRID_UPLOAD_CAPTION, true);
    uFileCommonInfo = new Upload();
    uFileCommonInfo.setCaption(Constants.NULL);
    uFileCommonInfo.setWidth("100%");

    uploadInfoLayout.addComponent(uFileCommonInfo, 0, 0, 1, 0);
    uploadInfoLayout.setComponentAlignment(uFileCommonInfo, Alignment.MIDDLE_CENTER);

    linkTemplate = new Link(LINK_CAPTION, FontAwesome.LINK);
    linkTemplate.setImmediate(true);/*from   w  w w .  j a  v  a2s  .c o  m*/
    File file = new File(Constants.PATH_TEMPLATE + "Thong ke diem.xlsx");
    FileDownloader downloader = new FileDownloader(file, "Thong ke diem.xlsx");
    linkTemplate.setResource(downloader);
    uploadInfoLayout.addComponent(linkTemplate, 2, 0);

    return uploadInfoLayout;
}

From source file:com.cavisson.gui.dashboard.components.controls.ButtonsAndLinks.java

License:Apache License

/**
* 
*///  w w  w .j ava  2  s .  c  om
public ButtonsAndLinks() {
    setMargin(true);

    Label h1 = new Label("Buttons");
    h1.addStyleName("h1");
    addComponent(h1);

    HorizontalLayout row = new HorizontalLayout();
    row.addStyleName("wrapping");
    row.setSpacing(true);
    addComponent(row);

    Button button = new Button("Normal");
    row.addComponent(button);

    button = new Button("Disabled");
    button.setEnabled(false);
    row.addComponent(button);

    button = new Button("Primary");
    button.addStyleName("primary");
    row.addComponent(button);

    button = new Button("Friendly");
    button.addStyleName("friendly");
    row.addComponent(button);

    button = new Button("Danger");
    button.addStyleName("danger");
    row.addComponent(button);

    TestIcon testIcon = new TestIcon(10);
    button = new Button("Small");
    button.addStyleName("small");
    button.setIcon(testIcon.get());
    row.addComponent(button);

    button = new Button("Large");
    button.addStyleName("large");
    button.setIcon(testIcon.get());
    row.addComponent(button);

    button = new Button("Top");
    button.addStyleName("icon-align-top");
    button.setIcon(testIcon.get());
    row.addComponent(button);

    button = new Button("Image icon");
    button.setIcon(testIcon.get(true, 16));
    row.addComponent(button);

    button = new Button("Image icon");
    button.addStyleName("icon-align-right");
    button.setIcon(testIcon.get(true));
    row.addComponent(button);

    button = new Button("Photos");
    button.setIcon(testIcon.get());
    row.addComponent(button);

    button = new Button();
    button.setIcon(testIcon.get());
    button.addStyleName("icon-only");
    row.addComponent(button);

    button = new Button("Borderless");
    button.setIcon(testIcon.get());
    button.addStyleName("borderless");
    row.addComponent(button);

    button = new Button("Borderless, colored");
    button.setIcon(testIcon.get());
    button.addStyleName("borderless-colored");
    row.addComponent(button);

    button = new Button("Quiet");
    button.setIcon(testIcon.get());
    button.addStyleName("quiet");
    row.addComponent(button);

    button = new Button("Link style");
    button.setIcon(testIcon.get());
    button.addStyleName("link");
    row.addComponent(button);

    button = new Button("Icon on right");
    button.setIcon(testIcon.get());
    button.addStyleName("icon-align-right");
    row.addComponent(button);

    CssLayout group = new CssLayout();
    group.addStyleName("v-component-group");
    row.addComponent(group);

    button = new Button("One");
    group.addComponent(button);
    button = new Button("Two");
    group.addComponent(button);
    button = new Button("Three");
    group.addComponent(button);

    button = new Button("Tiny");
    button.addStyleName("tiny");
    row.addComponent(button);

    button = new Button("Huge");
    button.addStyleName("huge");
    row.addComponent(button);

    NativeButton nbutton = new NativeButton("Native");
    row.addComponent(nbutton);

    h1 = new Label("Links");
    h1.addStyleName("h1");
    addComponent(h1);

    row = new HorizontalLayout();
    row.addStyleName("wrapping");
    row.setSpacing(true);
    addComponent(row);

    Link link = new Link("vaadin.com", new ExternalResource("https://vaadin.com"));
    row.addComponent(link);

    link = new Link("Link with icon", new ExternalResource("https://vaadin.com"));
    link.addStyleName("color3");
    link.setIcon(testIcon.get());
    row.addComponent(link);

    link = new Link("Small", new ExternalResource("https://vaadin.com"));
    link.addStyleName("small");
    row.addComponent(link);

    link = new Link("Large", new ExternalResource("https://vaadin.com"));
    link.addStyleName("large");
    row.addComponent(link);

    link = new Link(null, new ExternalResource("https://vaadin.com"));
    link.setIcon(testIcon.get());
    link.addStyleName("large");
    row.addComponent(link);
}

From source file:com.constellio.app.ui.pages.base.MainLayoutImpl.java

protected Component buildFooter() {

    Link poweredByConstellioLink = new Link(
            $("MainLayout.footerAlt") + "  (" + presenter.getCurrentVersion() + ")",
            new ExternalResource("http://www.constellio.com"));
    poweredByConstellioLink.setTargetName("_blank");
    poweredByConstellioLink.addStyleName(ValoTheme.LINK_LARGE);
    poweredByConstellioLink.addStyleName("footer");
    return poweredByConstellioLink;
}

From source file:com.constellio.app.ui.pages.management.updates.UpdateManagerViewImpl.java

private Component buildUnlicensedLayout() {
    Label message = new Label($("UpdateManagerViewImpl.unlicensed"));
    message.addStyleName(ValoTheme.LABEL_BOLD);

    Link request = new Link($("UpdateManagerViewImpl.requestLicense"),
            new ExternalResource("mailto:sales@constellio.com?Subject=Demande de license Constellio"));

    VerticalLayout layout = new VerticalLayout(message, request);
    layout.setSpacing(true);// w  w w  . j a  v  a2 s .c  om

    return layout;
}

From source file:com.esofthead.mycollab.shell.view.MainView.java

License:Open Source License

private CustomLayout createFooter() {
    final CustomLayout footer = CustomLayoutExt.createLayout("footer");

    Link companyLink = new Link("eSoftHead", new ExternalResource("http://www.esofthead.com"));
    companyLink.setTargetName("_blank");

    footer.addComponent(companyLink, "company-url");

    Calendar currentCal = Calendar.getInstance();

    Label currentYear = new Label(String.valueOf(currentCal.get(Calendar.YEAR)));
    currentYear.setSizeUndefined();/*from  ww w  .  ja  v  a 2s .c  om*/
    footer.addComponent(currentYear, "current-year");

    HorizontalLayout footerRight = new HorizontalLayout();
    footerRight.setSpacing(true);

    final Button sendFeedback = new Button("Feedback");
    sendFeedback.setStyleName("link");
    sendFeedback.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            UI.getCurrent().addWindow(new FeedbackWindow());
        }
    });
    Link blogLink = new Link("Blog", new ExternalResource("https://www.mycollab.com/blog"));
    blogLink.setTargetName("_blank");

    Link forumLink = new Link("Forum", new ExternalResource("http://forum.mycollab.com"));
    forumLink.setTargetName("_blank");

    Link wikiLink = new Link("Knowledge Base", new ExternalResource("https://www.mycollab.com/help/"));
    wikiLink.setTargetName("_blank");

    footerRight.addComponent(blogLink);
    footerRight.addComponent(forumLink);
    footerRight.addComponent(wikiLink);
    footerRight.addComponent(sendFeedback);

    footer.addComponent(footerRight, "footer-right");
    return footer;
}

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

License:Open Source License

@Override
protected Component initContent() {
    final Link emailLink = new Link(email, new ExternalResource("mailto:" + email));
    return emailLink;
}

From source file:com.expressui.core.MainApplication.java

License:Open Source License

@Override
public void init() {
    currentInstance.set(this);

    setTheme(getCustomTheme());//from  www.j a  va2s .  c  o m
    customizeConfirmDialogStyle();

    Window mainWindow = new Window();
    setMainWindow(mainWindow);
    mainWindow.addStyleName("e-main-window");
    mainWindow.setCaption(getTypeCaption());

    VerticalLayout mainLayout = new VerticalLayout();
    String id = StringUtil.generateDebugId("e", this, mainLayout, "mainLayout");
    mainLayout.setDebugId(id);

    mainWindow.setSizeFull();
    mainLayout.setSizeFull();
    mainWindow.setContent(mainLayout);

    setLogoutURL(getApplicationProperties().getRestartApplicationUrl());

    configureLeftMenuBar(mainMenuBar.getLeftMenuBarRoot());
    configureRightMenuBar(mainMenuBar.getRightMenuBarRoot());
    mainLayout.addComponent(mainMenuBar);

    pageLayoutTabSheet = new TabSheet();
    id = StringUtil.generateDebugId("e", this, pageLayoutTabSheet, "pageLayoutTabSheet");
    pageLayoutTabSheet.setDebugId(id);

    pageLayoutTabSheet.addStyleName("e-main-page-layout");
    pageLayoutTabSheet.setSizeFull();
    mainLayout.addComponent(pageLayoutTabSheet);
    mainLayout.setExpandRatio(pageLayoutTabSheet, 1.0f);

    Link expressUILink = new Link(uiMessageSource.getMessage("mainApplication.footerMessage"),
            new ExternalResource(uiMessageSource.getMessage("mainApplication.footerLink")));
    expressUILink.setTargetName("_blank");
    expressUILink.setIcon(new ThemeResource("../expressui/favicon.png"));
    expressUILink.setSizeUndefined();
    mainLayout.addComponent(expressUILink);
    mainLayout.setComponentAlignment(expressUILink, Alignment.TOP_CENTER);

    configureSessionTimeout(mainWindow);
    postWire();
    onDisplay();
}

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

License:Open Source License

/**
 * @param source//ww  w  .  j a v  a2 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;
}