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:org.vaadin.tori.component.Breadcrumbs.java

License:Apache License

private Component getDashboardLink() {
    Link link = new Link(getDashboardTitle(),
            new ExternalResource("#" + ToriNavigator.ApplicationView.DASHBOARD.getUrl()));
    link.setHeight(100.0f, Unit.PERCENTAGE);
    return link;//from  w w  w  .  java  2s.c o  m
}

From source file:org.vaadin.tori.component.Breadcrumbs.java

License:Apache License

private Component getCategoryLink(final Category category) {
    HorizontalLayout result = new HorizontalLayout();
    result.setSpacing(true);//from  w w  w .j  a v a2s.c om
    result.setHeight(100.0f, Unit.PERCENTAGE);
    result.addStyleName("categorylink");
    final Link crumb = new Link(category.getName(), new ExternalResource(
            "#" + ToriNavigator.ApplicationView.CATEGORIES.getUrl() + "/" + category.getId()));
    crumb.setHeight(100.0f, Unit.PERCENTAGE);
    result.addComponent(crumb);
    result.setComponentAlignment(crumb, Alignment.MIDDLE_CENTER);
    Component siblingMenu = getSiblingMenuBar(category);
    siblingMenu.setHeight(100.0f, Unit.PERCENTAGE);
    result.addComponent(siblingMenu);
    result.setComponentAlignment(siblingMenu, Alignment.MIDDLE_CENTER);
    return result;
}

From source file:org.vaadin.tori.component.RecentBar.java

License:Apache License

private void addMyPostsLink(final HorizontalLayout barLayout) {
    Link link = new Link("My Posts",
            new ExternalResource("#" + ToriNavigator.ApplicationView.CATEGORIES.getUrl() + "/"
                    + SpecialCategory.MY_POSTS.getId().toLowerCase()));
    link.addStyleName("mypostslink");
    barLayout.addComponent(link);/*from  w  ww .  j  av  a2  s .  co  m*/
    barLayout.setComponentAlignment(link, Alignment.MIDDLE_RIGHT);
}

From source file:org.vaadin.tori.component.RecentBar.java

License:Apache License

private void addRecentLink(final HorizontalLayout barLayout) {
    Link link = new Link("Recent Posts",
            new ExternalResource("#" + ToriNavigator.ApplicationView.CATEGORIES.getUrl() + "/"
                    + SpecialCategory.RECENT_POSTS.getId().toLowerCase()));
    link.addStyleName("recentlink");
    barLayout.addComponent(link);// ww w  .j a va  2s . com
    barLayout.setComponentAlignment(link, Alignment.MIDDLE_RIGHT);
}

From source file:pt.ist.vaadinframework.ui.ApplicationWindow.java

License:Open Source License

public ApplicationWindow(String theme, Property applicationTitle, Property applicationSubtitle,
        Property copyright) {//from w  ww . jav a 2 s. c  om
    setTheme(theme);
    this.applicationTitle = applicationTitle;
    this.applicationSubtitle = applicationSubtitle;
    this.copyright = copyright;
    VerticalLayout main = new VerticalLayout();
    main.setWidth(90, UNITS_PERCENTAGE);
    main.setHeight(98, UNITS_PERCENTAGE);
    main.addStyleName("application-container");

    VerticalLayout header = new VerticalLayout();
    header.setMargin(true, true, false, true);
    header.setSpacing(true);
    main.addComponent(header);
    HorizontalLayout iconAndTitle = new HorizontalLayout();
    iconAndTitle.setSizeFull();
    iconAndTitle.setSpacing(true);
    header.addComponent(iconAndTitle);
    Embedded logo = new Embedded(null, new ThemeResource("../runo/icons/64/globe.png"));
    iconAndTitle.addComponent(logo);
    iconAndTitle.setComponentAlignment(logo, Alignment.MIDDLE_LEFT);

    VerticalLayout titles = new VerticalLayout();
    titles.setSpacing(true);
    iconAndTitle.addComponent(titles);
    iconAndTitle.setExpandRatio(titles, 0.8f);
    Label title = new Label(applicationTitle);
    title.addStyleName("application-title");
    titles.addComponent(title);
    Label subtitle = new Label(applicationSubtitle);
    subtitle.addStyleName("application-subtitle");
    titles.addComponent(subtitle);

    HorizontalLayout controls = new HorizontalLayout();
    controls.setSpacing(true);
    iconAndTitle.addComponent(controls);
    iconAndTitle.setComponentAlignment(controls, Alignment.TOP_RIGHT);
    Label user = new Label("ist148357");
    controls.addComponent(user);
    Link logout = new Link("logout", new ExternalResource("#"));
    controls.addComponent(logout);

    MenuBar menu = new MenuBar();
    menu.addStyleName("application-menu");
    header.addComponent(menu);
    MenuItem hello = menu.addItem("hello", null);
    hello.addItem("sdgjk", new Command() {
        @Override
        public void menuSelected(MenuItem selectedItem) {
            getWindow().showNotification("skjhfgksjdfhglksdjh");
        }
    });
    MenuItem hello1 = menu.addItem("hello", null);
    hello1.addItem("sdgjk", new Command() {
        @Override
        public void menuSelected(MenuItem selectedItem) {
            getWindow().showNotification("skjhfgksjdfhglksdjh");
        }
    });
    MenuItem hello2 = menu.addItem("hello", null);
    hello2.addItem("sdgjk", new Command() {
        @Override
        public void menuSelected(MenuItem selectedItem) {
            getWindow().showNotification("skjhfgksjdfhglksdjh");
        }
    });

    body = new VerticalLayout();
    body.setSizeFull();
    body.setMargin(true);
    body.addStyleName("application-body");
    main.addComponent(body);
    main.setExpandRatio(body, 1f);
    body.addComponent(createDefaultPageBody());

    VerticalLayout footer = new VerticalLayout();
    main.addComponent(footer);
    main.setComponentAlignment(footer, Alignment.MIDDLE_CENTER);
    Label copyrightLabel = new Label(copyright);
    copyrightLabel.setSizeUndefined();
    copyrightLabel.addStyleName("application-footer");
    footer.addComponent(copyrightLabel);
    footer.setComponentAlignment(copyrightLabel, Alignment.MIDDLE_CENTER);

    VerticalLayout outer = (VerticalLayout) getContent();
    outer.setSizeFull();
    outer.addComponent(main);
    outer.setComponentAlignment(main, Alignment.MIDDLE_CENTER);
}

From source file:songstock.web.extensions.download.DownloadsView.java

License:Open Source License

/**
 * Loads and displays the download links.
 * @param links to display/*from w  w w  .jav  a 2s  . c o  m*/
 */
public void loadLinks(HashMap<Object[], String> links) {
    tableDownloadLinks.removeAllItems();

    for (Map.Entry<Object[], String> entry : links.entrySet()) {
        Link link = new Link("Download", new ExternalResource(entry.getValue()));
        int length = 35; //BASE_PATH length
        String songName = entry.getValue().substring(length + 1).split("[/.]")[2];
        tableDownloadLinks.addItem(new Object[] { songName, ((IItem) entry.getKey()[0]).getArtist(), link },
                entry.getKey());
    }
}

From source file:ubu.digit.ui.components.Footer.java

License:Creative Commons License

/**
 * Aade la informacin del proyecto./*from  ww  w. ja  v a2  s . c  o m*/
 */
private void addInformation() {
    VerticalLayout information = new VerticalLayout();
    information.setMargin(false);
    information.setSpacing(true);

    Label subtitle = new Label(INFORMACION);
    subtitle.setStyleName(SUBTITLE_STYLE);

    Label version2 = new Label("Versin 2.0 creada por Javier de la Fuente Barrios");
    Link link2 = new Link("jfb0019@alu.ubu.es", new ExternalResource("mailto:jfb0019@alu.ubu.es"));
    link2.setIcon(FontAwesome.ENVELOPE);

    Label version1 = new Label("Versin 1.0 creada por Beatriz Zurera Martnez-Acitores");
    Link link1 = new Link("bzm0001@alu.ubu.es", new ExternalResource("mailto:bzm0001@alu.ubu.es"));
    link1.setIcon(FontAwesome.ENVELOPE);

    Label tutor = new Label("Tutorizado por Carlos Lpez Nozal");
    Link linkT = new Link("clopezno@ubu.es", new ExternalResource("mailto:clopezno@alu.ubu.es"));
    linkT.setIcon(FontAwesome.ENVELOPE);

    Label copyright = new Label("Copyright @ LSI");

    information.addComponents(subtitle, version2, link2, version1, link1, tutor, linkT, copyright);
    content.addComponent(information);
}

From source file:ubu.digit.ui.components.Footer.java

License:Creative Commons License

/**
 * Aade la informacin de la licencia del proyecto.
 *///from  w w  w  . j  av  a2  s.c  o m
private void addLicense() {
    VerticalLayout license = new VerticalLayout();
    license.setMargin(false);
    license.setSpacing(true);

    Link ccImage = new Link(null, new ExternalResource("https://creativecommons.org/licenses/by/4.0/"));
    ccImage.setIcon(new ThemeResource("img/cc.png"));

    Label licenseText = new Label("This work is licensed under a: ");
    Link ccLink = new Link("Creative Commons Attribution 4.0 International License.",
            new ExternalResource("https://creativecommons.org/licenses/by/4.0/"));

    license.addComponents(ccImage, licenseText, ccLink);

    if (fileName != null) {
        String lastModified = getLastModified(fileName);
        license.addComponent(new Label("Ultima actualizacin: " + lastModified));
    }

    Button login = new Button("Actualizar");
    login.addClickListener(new LoginClickListener());
    license.addComponent(login);
    content.addComponent(license);
}

From source file:v7cr.ReviewTab.java

License:Open Source License

private Panel getBasicInfo(V7CR v7, Review r, Project proj, String linkUrl) {

    Panel p = new Panel(v7.getMessage("reviewTab.review"));
    p.setWidth("600px");
    GridLayout grid = new GridLayout(3, 4);
    grid.setSizeFull();//ww w  .j  a v a  2 s.  c  o  m
    p.setContent(grid);
    grid.setSpacing(true);
    Locale l = v7.getLocale();
    SchemaDefinition sd = r.getSchemaDefinition();
    grid.addComponent(new Label(sd.getFieldCaption("s", l)), 0, 0, 1, 0);
    p.addComponent(new Label("<b>" + LocalizedString
            .get(sd.getFieldDefinition("s").getPossibleValueMetaData(r.getStatus()), "caption", l) + "</b>",
            Label.CONTENT_XHTML));
    p.addComponent(new Label(sd.getFieldCaption("p", l)));
    p.addComponent(new Label("[" + proj.getId() + "]"));
    grid.addComponent(new Label(proj.getName()));
    p.addComponent(new Label(sd.getFieldCaption("reviewee", l)));
    p.addComponent(new Label(r.getReviewee().getId()));
    grid.addComponent(new Label(r.getReviewee().getName()));
    p.addComponent(new Label(sd.getFieldCaption("t", l)));
    grid.addComponent(new Label(r.getTitle()), 1, 3, 2, 3);
    p.addComponent(new Label(v7.getMessage("reviewTab.directLink")));
    Link link = new Link(linkUrl, new ExternalResource(linkUrl));
    link.setTargetName("_blank");
    link.setIcon(new ThemeResource("../runo/icons/16/arrow-right.png"));
    grid.addComponent(link);
    return p;

}

From source file:v7cr.ReviewTab.java

License:Open Source License

private Panel getSVNPanel(V7CR v7, SchemaDefinition sd, SVNLogEntry svn, Project proj) {
    if (svn == null)
        return null;
    Locale l = v7.getLocale();//from w w  w .j a  v a  2  s . c om
    Panel p = new Panel(v7.getMessage("reviewTab.subversion"));
    p.setWidth("600px");
    GridLayout grid = new GridLayout(4, 4);
    grid.setSizeFull();
    p.setContent(grid);
    grid.setSpacing(true);
    p.addComponent(new Label(sd.getFieldCaption("svn.rev", l)));
    p.addComponent(new Label("" + svn.getRevision()));
    p.addComponent(new Label(DateFormat.getDateTimeInstance().format(svn.getDate())));
    p.addComponent(new Label(svn.getAuthor()));
    Link link = new Link(v7.getMessage("reviewTab.viewChanges"),
            new ExternalResource(proj.getChangesetViewUrl(svn.getRevision())));
    link.setTargetName("_blank");
    link.setIcon(new ThemeResource("../runo/icons/16/arrow-right.png"));
    p.addComponent(link);
    grid.addComponent(new Label(svn.getMessage()), 1, 1, 3, 1);

    Map<String, SVNLogEntryPath> changed = svn.getChangedPaths();

    if (changed != null) {
        Tree changeTree = new Tree(sd.getFieldCaption("svn.changed", l) + "(" + changed.size() + ")");
        Set<String> paths = changed.keySet();
        for (String s : changed.keySet()) {
            changeTree.addItem(s);
            changeTree.setChildrenAllowed(s, false);
            changeTree.setItemCaption(s, changed.get(s).getType() + " " + s);
        }
        if (paths.size() > 5) {
            compressTree(changeTree, paths);
        }

        grid.addComponent(changeTree, 0, 2, 3, 2);
    }
    return p;
}