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.opennms.features.pluginmgr.vaadin.config.karaf.PluginManagerAdminApplication.java

License:Apache License

@Override
public void init(VaadinRequest request) {

    m_request = request;//from  w w w.j a v a2  s. c o m

    m_rootLayout = new VerticalLayout();
    m_rootLayout.setSizeFull();
    m_rootLayout.addStyleName("root-layout");
    setContent(m_rootLayout);

    // dynamically inject style for non write borders - avoids changing themes css
    // Get the stylesheet of the page
    Styles styles = Page.getCurrent().getStyles();
    // inject the new font size as a style. We need .v-app to override Vaadin's default styles here
    styles.add(".v-app .v-textfield-readonly {border: 1px solid #b6b6b6!important;"
            + " border-top-color: #9d9d9d!important;" + "border-bottom-color: #d6d6d6!important;"
            + "border-right-color: #d6d6d6!important;" + " opacity: 1.0!important;" + "filter: none;  }");
    styles.add(".v-app .v-textarea-readonly {border: 1px solid #b6b6b6!important;"
            + " border-top-color: #9d9d9d!important;" + "border-bottom-color: #d6d6d6!important;"
            + "border-right-color: #d6d6d6!important;" + " opacity: 1.0!important;" + "filter: none;  }");

    // add header if provided
    if (headerComponent != null)
        m_rootLayout.addComponent(headerComponent);

    //add additional header page links if provided
    if (headerLinks != null) {
        // defining 2 horizontal layouts to force links to stay together
        HorizontalLayout horizontalLayout1 = new HorizontalLayout();
        horizontalLayout1.setWidth("100%");
        horizontalLayout1.setDefaultComponentAlignment(Alignment.TOP_RIGHT);
        HorizontalLayout horizontalLayout2 = new HorizontalLayout();
        horizontalLayout1.addComponent(horizontalLayout2);

        for (String name : headerLinks.keySet()) {
            String urlStr = headerLinks.get(name);
            ExternalResource urlResource = new ExternalResource(urlStr);
            Link link = new Link(name, urlResource);
            Label label = new Label("   ", ContentMode.HTML); // adds space between links
            horizontalLayout2.addComponent(link);
            horizontalLayout2.addComponent(label);
        }
        m_rootLayout.addComponent(horizontalLayout1);
    }

    PluginManagerUIMainPanel pluginManagerUIMainPanel = new PluginManagerUIMainPanel(sessionPluginManager);

    m_rootLayout.addComponent(pluginManagerUIMainPanel);

    // this forces the UI panel to use up all the available space below the header
    m_rootLayout.setExpandRatio(pluginManagerUIMainPanel, 1.0f);

}

From source file:org.opennms.features.pluginmgr.vaadin.config.karaf.SimpleIframeApplication.java

License:Apache License

@Override
public void init(VaadinRequest request) {
    if (iframePageUrl == null)
        throw new RuntimeException("iframePageUrl must not be null");

    m_request = request;/*w  w w  . j  av a  2  s  .  c o  m*/

    m_rootLayout = new VerticalLayout();

    m_rootLayout = new VerticalLayout();
    m_rootLayout.setSizeFull();
    m_rootLayout.addStyleName("root-layout");
    setContent(m_rootLayout);

    // add header if provided
    if (headerComponent != null)
        m_rootLayout.addComponent(headerComponent);

    //add additional header page links if provided
    if (headerLinks != null) {
        // defining 2 horizontal layouts to force links to stay together
        HorizontalLayout horizontalLayout1 = new HorizontalLayout();
        horizontalLayout1.setWidth("100%");
        horizontalLayout1.setDefaultComponentAlignment(Alignment.TOP_RIGHT);
        HorizontalLayout horizontalLayout2 = new HorizontalLayout();
        horizontalLayout1.addComponent(horizontalLayout2);

        for (String name : headerLinks.keySet()) {
            String urlStr = headerLinks.get(name);
            ExternalResource urlResource = new ExternalResource(urlStr);
            Link link = new Link(name, urlResource);
            Label label = new Label("   ", ContentMode.HTML); // adds space between links
            horizontalLayout2.addComponent(link);
            horizontalLayout2.addComponent(label);
        }
        m_rootLayout.addComponent(horizontalLayout1);
    }

    ExternalResource iframPageResource = new ExternalResource(iframePageUrl);

    BrowserFrame browser = new BrowserFrame("", iframPageResource);
    browser.setWidth("100%");
    browser.setHeight("100%");
    m_rootLayout.addComponent(browser);

    // this forces the UI panel to use up all the available space below the header
    m_rootLayout.setExpandRatio(browser, 1.0f);

}

From source file:org.opennms.features.pluginmgr.vaadin.config.opennms.PluginManagerAdminApplication.java

License:Open Source License

@Override
public void init(VaadinRequest request) {

    m_rootLayout = new VerticalLayout();
    m_rootLayout.setSizeFull();/*from   w  ww.  ja  v  a  2s  .c om*/
    m_rootLayout.addStyleName("root-layout");
    setContent(m_rootLayout);

    // dynamically inject style for non write borders - avoids changing themes css
    // Get the stylesheet of the page
    Styles styles = Page.getCurrent().getStyles();
    // inject the new font size as a style. We need .v-app to override Vaadin's default styles here
    styles.add(".v-app .v-textfield-readonly {border: 1px solid #b6b6b6!important;"
            + " border-top-color: #9d9d9d!important;" + "border-bottom-color: #d6d6d6!important;"
            + "border-right-color: #d6d6d6!important;" + " opacity: 1.0!important;" + "filter: none;  }");
    styles.add(".v-app .v-textarea-readonly {border: 1px solid #b6b6b6!important;"
            + " border-top-color: #9d9d9d!important;" + "border-bottom-color: #d6d6d6!important;"
            + "border-right-color: #d6d6d6!important;" + " opacity: 1.0!important;" + "filter: none;  }");

    addHeader(request);

    //add diagnostic page links
    if (headerLinks != null) {
        // defining 2 horizontal layouts to force links to stay together
        HorizontalLayout horizontalLayout1 = new HorizontalLayout();
        horizontalLayout1.setWidth("100%");
        horizontalLayout1.setDefaultComponentAlignment(Alignment.TOP_RIGHT);
        HorizontalLayout horizontalLayout2 = new HorizontalLayout();
        horizontalLayout1.addComponent(horizontalLayout2);

        for (String name : headerLinks.keySet()) {
            String urlStr = headerLinks.get(name);
            ExternalResource urlResource = new ExternalResource(urlStr);
            Link link = new Link(name, urlResource);
            Label label = new Label("   ", ContentMode.HTML); // adds space between links
            horizontalLayout2.addComponent(link);
            horizontalLayout2.addComponent(label);
        }
        m_rootLayout.addComponent(horizontalLayout1);
    }

    PluginManagerUIMainPanel pluginManagerUIMainPanel = new PluginManagerUIMainPanel(sessionPluginManager);

    m_rootLayout.addComponent(pluginManagerUIMainPanel);

    // this forces the UI panel to use up all the available space below the header
    m_rootLayout.setExpandRatio(pluginManagerUIMainPanel, 1.0f);

}

From source file:org.opennms.features.pluginmgr.vaadin.config.opennms.SimpleIframeInVaadinApplication.java

License:Open Source License

@Override
public void init(VaadinRequest request) {
    if (iframePageUrl == null)
        throw new RuntimeException("iframePageUrl must not be null");

    m_rootLayout = new VerticalLayout();
    m_rootLayout.setSizeFull();/* ww w.  j a v  a  2 s.  co  m*/
    m_rootLayout.addStyleName("root-layout");
    setContent(m_rootLayout);
    addHeader(request);

    //add diagnostic page links
    if (headerLinks != null) {
        // defining 2 horizontal layouts to force links to stay together
        HorizontalLayout horizontalLayout1 = new HorizontalLayout();
        horizontalLayout1.setWidth("100%");
        horizontalLayout1.setDefaultComponentAlignment(Alignment.TOP_RIGHT);
        HorizontalLayout horizontalLayout2 = new HorizontalLayout();
        horizontalLayout1.addComponent(horizontalLayout2);

        for (String name : headerLinks.keySet()) {
            String urlStr = headerLinks.get(name);
            ExternalResource urlResource = new ExternalResource(urlStr);
            Link link = new Link(name, urlResource);
            Label label = new Label("   ", ContentMode.HTML); // adds space between links
            horizontalLayout2.addComponent(link);
            horizontalLayout2.addComponent(label);
        }
        m_rootLayout.addComponent(horizontalLayout1);
    }

    ExternalResource iframPageResource = new ExternalResource(iframePageUrl);

    BrowserFrame browser = new BrowserFrame("", iframPageResource);
    browser.setWidth("100%");
    browser.setHeight("100%");
    m_rootLayout.addComponent(browser);

    // this forces the UI panel to use up all the available space below the header
    m_rootLayout.setExpandRatio(browser, 1.0f);

}

From source file:org.opennms.netmgt.bsm.vaadin.adminpage.BusinessServiceTreeTable.java

License:Open Source License

public BusinessServiceTreeTable(BusinessServiceManager businessServiceManager) {
    this.businessServiceManager = Objects.requireNonNull(businessServiceManager);

    setSizeFull();/*w ww  .  j  av  a  2  s .co  m*/
    setContainerDataSource(new BusinessServiceContainer());

    // Add the "LINKS" columns
    addGeneratedColumn("links", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 7113848887128656685L;

        @Override
        public Object generateCell(Table source, Object itemId, Object columnId) {
            final HorizontalLayout layout = new HorizontalLayout();
            final BusinessServiceStateMachine stateMachine = businessServiceManager.getStateMachine();
            final BusinessService businessService = getItem(itemId).getBean().getBusinessService();
            final Status status = stateMachine.getOperationalStatus(businessService);
            if (status != null) {
                // Build the query string
                final List<BasicNameValuePair> urlParms = Lists.newArrayList(
                        new BasicNameValuePair("focus-vertices", businessService.getId().toString()),
                        new BasicNameValuePair("szl", "1"),
                        new BasicNameValuePair("layout", "Hierarchy Layout"),
                        new BasicNameValuePair("provider", "Business Services"));
                final String queryString = URLEncodedUtils.format(urlParms, Charset.forName("UTF-8"));

                // Generate the link
                final Link link = new Link("View in Topology UI",
                        new ExternalResource(String.format("/opennms/topology?%s", queryString)));
                link.setIcon(FontAwesome.EXTERNAL_LINK_SQUARE);
                // This app is typically access in an iframe, so we open the URL in a new window/tab
                link.setTargetName("_blank");
                layout.addComponent(link);
                layout.setComponentAlignment(link, Alignment.MIDDLE_CENTER);
            } else {
                Label label = new Label("N/A");
                label.setDescription("Try reloading the daemon and refreshing the table.");
                label.setWidth(null);
                layout.addComponent(label);
            }
            return layout;
        }
    });

    // add edit and delete buttons
    addGeneratedColumn("edit / delete", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 7113848887128656685L;

        @Override
        public Object generateCell(Table source, Object itemId, Object columnId) {
            HorizontalLayout layout = new HorizontalLayout();
            layout.setSpacing(true);

            Button editButton = new Button("Edit", FontAwesome.PENCIL_SQUARE_O);
            editButton.setId("editButton-" + getItem(itemId).getBean().getName());

            editButton.addClickListener(UIHelper.getCurrent(TransactionAwareUI.class)
                    .wrapInTransactionProxy((Button.ClickListener) event -> {
                        final Long businessServiceId = getItem(itemId).getBean().getBusinessService().getId();
                        BusinessService businessService = businessServiceManager
                                .getBusinessServiceById(businessServiceId);
                        final BusinessServiceEditWindow window = new BusinessServiceEditWindow(businessService,
                                businessServiceManager);
                        window.addCloseListener(e -> refresh());

                        getUI().addWindow(window);
                    }));
            layout.addComponent(editButton);

            Button deleteButton = new Button("Delete", FontAwesome.TRASH_O);
            deleteButton.setId("deleteButton-" + getItem(itemId).getBean().getName());

            deleteButton.addClickListener((Button.ClickListener) event -> {
                final Long businessServiceId = getItem(itemId).getBean().getBusinessService().getId();
                BusinessService businessService = businessServiceManager
                        .getBusinessServiceById(businessServiceId);
                if (businessService.getParentServices().isEmpty()
                        && businessService.getChildEdges().isEmpty()) {
                    UIHelper.getCurrent(TransactionAwareUI.class).runInTransaction(() -> {
                        businessServiceManager.getBusinessServiceById(businessServiceId).delete();
                        refresh();
                    });
                } else {
                    new org.opennms.netmgt.vaadin.core.ConfirmationDialog()
                            .withOkAction((org.opennms.netmgt.vaadin.core.ConfirmationDialog.Action) UIHelper
                                    .getCurrent(TransactionAwareUI.class).wrapInTransactionProxy(
                                            new org.opennms.netmgt.vaadin.core.ConfirmationDialog.Action() {
                                                @Override
                                                public void execute(
                                                        org.opennms.netmgt.vaadin.core.ConfirmationDialog window) {
                                                    businessServiceManager
                                                            .getBusinessServiceById(businessServiceId).delete();
                                                    refresh();
                                                }
                                            }))
                            .withOkLabel("Delete anyway").withCancelLabel("Cancel").withCaption("Warning")
                            .withDescription(
                                    "This entry is referencing or is referenced by other Business Services! Do you really want to delete this entry?")
                            .open();
                }
            });
            layout.addComponent(deleteButton);

            return layout;
        }
    });

    setColumnExpandRatio("name", 5);
    setColumnExpandRatio("links", 1);
    setColumnExpandRatio("edit / delete", 1);
}

From source file:org.rubicone.poc.vpush.uil.sending.SendingUI.java

License:Apache License

private Panel createInstructionsPanel() {
    Panel instructionsPanel = new Panel("instructions");

    VerticalLayout instructionsLayout = new VerticalLayout();
    instructionsPanel.setContent(instructionsLayout);

    Label instructionsLabel = new Label(
            "open another UI receiving notifications from server using following transport:");
    instructionsLayout.addComponent(instructionsLabel);

    Link websocketsUILink = new Link("websockets", new ExternalResource("./receive-messages-websockets"));
    websocketsUILink.setIcon(VaadinIcons.CHEVRON_RIGHT_SMALL);
    websocketsUILink.setTargetName("_blank");
    instructionsLayout.addComponent(websocketsUILink);

    Link websocketsXhrUILink = new Link("websockets + XHR",
            new ExternalResource("./receive-messages-websocketsxhr"));
    websocketsXhrUILink.setIcon(VaadinIcons.CHEVRON_RIGHT_SMALL);
    websocketsXhrUILink.setTargetName("_blank");
    instructionsLayout.addComponent(websocketsXhrUILink);

    Link httpLongPollingUILink = new Link("HTTP long polling",
            new ExternalResource("./receive-messages-httplongpolling"));
    httpLongPollingUILink.setIcon(VaadinIcons.CHEVRON_RIGHT_SMALL);
    httpLongPollingUILink.setTargetName("_blank");
    instructionsLayout.addComponent(httpLongPollingUILink);

    Label noteLabel = new Label(
            "<i>" + VaadinIcons.INFO_CIRCLE_O.getHtml()
                    + " note: you may open several UIs at the same time to receive push notifications</i>",
            ContentMode.HTML);/*from w  w  w  . j a v  a  2  s.  c o  m*/
    noteLabel.addStyleName(ValoTheme.LABEL_TINY);
    instructionsLayout.addComponents(noteLabel);

    return instructionsPanel;
}

From source file:org.vaadin.addon.ewopener.demo.DemoUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {

    EnhancedBrowserWindowOpener opener1 = new EnhancedBrowserWindowOpener().popupBlockerWorkaround(true);
    Button button1 = new Button("Click me");
    button1.addClickListener(e -> {//from ww w . ja v a  2s . c  o m
        opener1.open(generateResource());
    });
    opener1.extend(button1);

    EnhancedBrowserWindowOpener opener4 = new EnhancedBrowserWindowOpener().popupBlockerWorkaround(true);
    Button button4 = new Button("Nothing to open here");
    button4.addClickListener(e -> {
        opener4.open((Resource) null);
    });
    opener4.extend(button4);

    Button button2 = new Button("Click me");
    button2.addClickListener(e -> {
        EnhancedBrowserWindowOpener.extendOnce(button2).open(generateResource());
    });

    Button button3 = new Button("Click me");
    EnhancedBrowserWindowOpener opener3 = new EnhancedBrowserWindowOpener().popupBlockerWorkaround(true)
            .withGeneratedContent("myFileName.txt", this::generateContent).doExtend(button3);
    button3.addClickListener(opener3::open);

    Link link = new Link("Click me", null);
    new EnhancedBrowserWindowOpener().clientSide(true)
            .withGeneratedContent("myFileName.txt", this::generateContent).doExtend(link);

    Link link2 = new Link("Click me", null);
    new EnhancedBrowserWindowOpener().clientSide(true)
            .withGeneratedContent("myFileName.txt", this::generateContent, resource -> {
                resource.setCacheTime(0);
                resource.setFilename("runtimeFileName-" + Instant.now().getEpochSecond() + ".txt");
            }).doExtend(link2);

    EnhancedBrowserWindowOpener opener5 = new EnhancedBrowserWindowOpener(
            new ClassResource(DemoUI.class, "static.txt"));
    CssLayout hiddenComponent = new MCssLayout().withWidth("0").withHeight("0");
    opener5.extend(hiddenComponent);
    CompletableFuture.runAsync(this::doSomeLongProcessing).thenRun(() -> getUI().access(opener5::open));

    table = new Table("Select items to download",
            new BeanItemContainer<>(DummyService.Person.class, DummyService.data()));
    table.setImmediate(true);
    table.setVisibleColumns("name", "age");
    table.setColumnHeaders("Name", "Age");
    table.setWidth("100%");
    table.setPageLength(20);
    table.setMultiSelectMode(MultiSelectMode.DEFAULT);
    table.setMultiSelect(true);
    table.setSelectable(true);

    final MyPopupContent popupContent = new MyPopupContent();
    Button popupButton = new Button("Open modal", event -> {
        Window window = new Window("Test", popupContent);
        window.setWidth(40, Sizeable.Unit.PERCENTAGE);
        window.setHeight(200, Sizeable.Unit.PIXELS);
        window.setModal(true);
        window.setDraggable(false);
        window.setResizable(false);
        window.center();
        getUI().addWindow(window);
    });

    MenuBar.Command cmd = selectedItem -> Notification.show("Item clicked",
            "Item is " + selectedItem.getDescription(), Notification.Type.TRAY_NOTIFICATION);
    MenuBar menuBar = new MenuBar();
    menuBar.setSizeFull();
    EnhancedBrowserWindowOpener opener6 = new EnhancedBrowserWindowOpener()
            .withGeneratedContent("menu-item-serverside.txt", this::generateContent)
            .popupBlockerWorkaround(true);
    EnhancedBrowserWindowOpener opener7 = new EnhancedBrowserWindowOpener()
            .withGeneratedContent("menu-item-clientside-1.txt", this::generateContent).clientSide(true);
    EnhancedBrowserWindowOpener opener8 = new EnhancedBrowserWindowOpener()
            .withGeneratedContent("menu-item-clientside-2.txt", this::generateContent).clientSide(true);
    MenuBar.MenuItem menuItem = menuBar.addItem("Download from Menu (Client side)", selectedItem -> {
        System.out.println("OK, Invoked");
    });
    MenuBar.MenuItem subMenu = menuBar.addItem("Sub menu", null);
    subMenu.addItem("Item 1", cmd);
    subMenu.addItem("Item 2", cmd);
    MenuBar.MenuItem subItem = subMenu.addItem("Download (client side)", cmd);
    MenuBar.MenuItem subItem2 = subMenu.addItem("Download (server side)", selectedItem -> opener6.open());
    opener7.doExtend(menuBar, menuItem);
    opener6.doExtend(menuBar, subItem2);
    opener8.doExtend(menuBar, subItem);

    // Show it in the middle of the screen
    final Layout layout = new MVerticalLayout(
            new MLabel("Enhanced Window Opener Demo").withStyleName(ValoTheme.LABEL_COLORED,
                    ValoTheme.LABEL_H1),
            new MHorizontalLayout().add(table, 1)
                    .add(new MCssLayout(menuBar, readMarkdown("code_menu.md").withFullWidth(),
                            new MVerticalLayout(readMarkdown("code1.md"), button1)
                                    .alignAll(Alignment.MIDDLE_CENTER).withWidthUndefined().withMargin(false),
                            new MVerticalLayout(readMarkdown("code2.md"), button2)
                                    .alignAll(Alignment.MIDDLE_CENTER).withWidthUndefined().withMargin(false),
                            new MVerticalLayout(readMarkdown("code7.md"), button3)
                                    .alignAll(Alignment.MIDDLE_CENTER).withWidthUndefined().withMargin(false),
                            new MVerticalLayout(readMarkdown("code5.md"), link)
                                    .alignAll(Alignment.MIDDLE_CENTER).withWidthUndefined().withMargin(false),
                            new MVerticalLayout(readMarkdown("code6.md"), link2)
                                    .alignAll(Alignment.MIDDLE_CENTER).withWidthUndefined().withMargin(false),
                            new MVerticalLayout(readMarkdown("code3.md"), button4)
                                    .alignAll(Alignment.MIDDLE_CENTER).withWidthUndefined().withMargin(false),
                            new MVerticalLayout(readMarkdown("code8.md"), popupButton)
                                    .alignAll(Alignment.MIDDLE_CENTER).withWidthUndefined().withMargin(false),
                            new MVerticalLayout(readMarkdown("code4.md"), hiddenComponent)
                                    .alignAll(Alignment.MIDDLE_CENTER).withWidthUndefined().withMargin(false))
                                            .withFullWidth().withStyleName("demo-samples"),
                            5)
                    .withFullWidth()).withFullWidth().withMargin(true);

    setContent(layout);

}

From source file:org.vaadin.addons.sitekit.viewlet.user.ProfileImageViewlet.java

License:Apache License

@Override
public void enter(final String parameters) {
    final String user = getSite().getSecurityProvider().getUser();
    if (user == null) {
        final VerticalLayout layout = new VerticalLayout();
        layout.setMargin(false);//from  w w  w  .  j ava 2s  .com
        final Link link = new Link(null, new ExternalResource("#!login"));
        link.setStyleName("gravatar");
        link.setIcon(getSite().getIcon("view-icon-login"));
        link.setWidth(32, UNITS_PIXELS);
        link.setHeight(32, UNITS_PIXELS);
        layout.addComponent(link);
        layout.setComponentAlignment(link, Alignment.MIDDLE_CENTER);
        this.setCompositionRoot(layout);
        return;
    }
    try {
        final VerticalLayout layout = new VerticalLayout();
        layout.setMargin(false);
        if (getSite().getSiteContext().getObject("gravatar-url") == null) {
            getSite().getSiteContext().putObject("gravatar-url", getGravatarUrl(user));
        }
        final URL gravatarUrl = new URL((String) getSite().getSiteContext().getObject("gravatar-url"));
        //final Embedded embedded = new Embedded(null, new ExternalResource(gravatarUrl));
        final Link link = new Link(null, new ExternalResource("http://www.gravatar.com/"));
        link.setStyleName("gravatar");
        link.setIcon(new ExternalResource(gravatarUrl));
        link.setWidth(32, UNITS_PIXELS);
        link.setHeight(32, UNITS_PIXELS);
        layout.addComponent(link);
        layout.setComponentAlignment(link, Alignment.MIDDLE_CENTER);
        this.setCompositionRoot(layout);
    } catch (final Exception e) {
        LOGGER.warn("Error reading gravatar image for user: " + user, e);
    }
}

From source file:org.vaadin.alump.fancylayouts.demo.FancyLayoutsUI.java

License:Apache License

private ComponentContainer buildWelcome() {

    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);//w w  w.  jav a  2 s. c o  m
    layout.setSpacing(true);
    layout.setWidth("100%");

    Label header = new Label("This is online demo for FancyLayouts Vaadin AddOn.");
    header.addStyleName("demo-header");
    layout.addComponent(header);

    StringBuilder sb = new StringBuilder();
    sb.append(
            "FancyLayouts adds transitions to UI when you replace content with new. This allows you to have fancier UI in your vaadin based application.");
    sb.append(
            " Currently package contains Image widget that can be used to present multiple images in one component slot. And Panel widget which is useful");
    sb.append(" if you have to replace content inside your UI often.");

    Label desc = new Label(sb.toString());
    desc.addStyleName("demo-desc");
    layout.addComponent(desc);
    layout.setExpandRatio(desc, 1.0f);

    Link link = new Link("Source code of this demo application", new ExternalResource(
            "https://github.com/alump/FancyLayouts/blob/master/fancylayouts-demo/src/main/java/org/vaadin/alump/fancylayouts/demo/FancyLayoutsUI.java"));
    layout.addComponent(link);

    Button sourceLink = new Button();
    sourceLink.addStyleName(BaseTheme.BUTTON_LINK);

    return layout;
}

From source file:org.vaadin.alump.masonry.demo.MainMenuView.java

License:Open Source License

public MainMenuView() {
    setWidth("100%");
    setMargin(true);/* ww w  . java2 s  . c o  m*/
    setSpacing(true);

    VerticalLayout infoLayout = new VerticalLayout();
    infoLayout.setWidth("100%");
    addComponent(infoLayout);

    Label label = new Label("Masonry addon adds cascading grid layout to Vaadin.");
    infoLayout.addComponent(label);

    Link link = new Link("This addon is based on David DeSandro's Masonry JavaScript library (MIT license).",
            new ExternalResource("http://masonry.desandro.com/"));
    infoLayout.addComponent(link);

    link = new Link("Source code and issue tracker, of this addon, are available in GitHub.",
            new ExternalResource("https://github.com/alump/Masonry"));
    infoLayout.addComponent(link);

    Button basicTests = new Button("Basic Demo", new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            UI.getCurrent().getNavigator().navigateTo(BasicTestsView.VIEW_NAME);
        }
    });
    addComponent(basicTests);

    Button dndTests = new Button("Drag and Drop Reordering Demo", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            UI.getCurrent().getNavigator().navigateTo(DnDTestsView.VIEW_NAME);
        }
    });
    addComponent(dndTests);

    Button sizerTests = new Button("Dynamic styles Grid Size Demo", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            UI.getCurrent().getNavigator().navigateTo(GridSizerTestsView.VIEW_NAME);
        }
    });
    addComponent(sizerTests);

}