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.peergreen.webconsole.scope.deployment.internal.components.DeployableWindow.java

License:Open Source License

public Component getContent() {
    FormLayout content = new FormLayout();
    content.setSpacing(true);/*from  www. j  a va 2s.c  o m*/
    content.setMargin(true);

    Label name = new Label(deployableEntry.getName());
    name.setCaption("Name");
    content.addComponent(name);
    Label uri = new Label(deployableEntry.getUri().toString());
    uri.setCaption("URI");
    content.addComponent(uri);
    VerticalLayout status = new VerticalLayout();
    status.setCaption("Status");
    content.addComponent(status);
    if (report == null) {
        // is not deployed yet
        status.addComponent(new Label("Ready to be deployed"));
    } else {
        if (report.getExceptions().size() == 0) {
            status.addComponent(new Label("<p style=\"color:#329932\">Deployed</p>", ContentMode.HTML));
        } else {
            for (ArtifactError artifactError : report.getExceptions()) {
                for (ArtifactErrorDetail detail : artifactError.getDetails()) {
                    ExceptionView exceptionView = new ExceptionView(detail);
                    status.addComponent(exceptionView);
                }
            }
        }
        VerticalLayout endPointsLayout = new VerticalLayout();
        for (Endpoint endpoint : report.getEndpoints()) {
            try {
                Link link = new Link(endpoint.getURI().toString(),
                        new ExternalResource(endpoint.getURI().toURL()));
                link.setTargetName("_blank");
                endPointsLayout.addComponent(link);
            } catch (MalformedURLException e) {
                endPointsLayout.addComponent(new Label(endpoint.getURI().toString()));
            }
        }

        if (endPointsLayout.getComponentCount() > 0) {
            content.addComponent(endPointsLayout);
            endPointsLayout.setCaption("End points");
        }
    }
    return content;
}

From source file:com.peergreen.webconsole.scope.deployment.internal.deployed.EndPointsHomeFrame.java

License:Open Source License

private void updateEndPoints() {
    removeAllItems();/*ww  w . j  ava  2s. c  om*/
    int i = 0;
    for (URI uri : artifactModelManager.getDeployedRootURIs()) {
        VerticalLayout endPointsLayout = new VerticalLayout();
        try {
            for (Endpoint endpoint : deploymentManager.getReport(uri.toString()).getEndpoints()) {
                Link link = new Link(endpoint.getURI().toString(),
                        new ExternalResource(endpoint.getURI().toURL()));
                link.setTargetName("_blank");
                endPointsLayout.addComponent(link);
            }
        } catch (ArtifactStatusReportException | MalformedURLException e) {
            e.printStackTrace();
        }

        if (endPointsLayout.getComponentCount() > 0) {
            addItem(new Object[] { endPointsLayout,
                    artifactModelManager.getArtifactModel(uri).getArtifact().name() }, i);
            i++;
        }
    }
}

From source file:com.skysql.manager.ui.AboutSettings.java

License:Open Source License

/**
 * Reads the AboutRecord from the session and populates the panel layout.
 *//*from   ww  w. ja  va2 s. c om*/
AboutSettings(boolean extraInfo) {
    addStyleName("aboutTab");
    setSizeFull();
    setSpacing(true);
    setMargin(true);

    Label title = new Label("<h3>Welcome to MariaDB Manager<h3/>", ContentMode.HTML);
    title.setSizeUndefined();
    addComponent(title);
    setComponentAlignment(title, Alignment.MIDDLE_CENTER);

    StringBuffer str = new StringBuffer();
    str.append("<table border=0 cellspacing=3 cellpadding=3 summary=\"\">" + "<tr bgcolor=\"#ccccff\">"
            + "<th align=left>Component" + "<th align=left>Release");
    if (extraInfo) {
        str.append("<th align=left>Version" + "<th align=left>Date");
    }
    LinkedHashMap<String, Versions> versionsList = Versions.getVersionsList();
    int i = 0;
    for (Versions component : versionsList.values()) {
        str.append(((i++ & 1) == 0) ? "<tr>" : "<tr bgcolor=\"#eeeeff\">");
        str.append("<td><code>" + component.getName() + "</code><td>" + component.getRelease());
        if (extraInfo) {
            str.append("<td>" + component.getVersion());
            str.append("<td>" + (component.getDate() == null ? " " : component.getDate()));
        }
    }
    str.append("</table>");
    ManagerUI.log(str.toString());
    Label versionsLabel = new Label(str.toString(), ContentMode.HTML);
    versionsLabel.setSizeUndefined();
    addComponent(versionsLabel);
    setComponentAlignment(versionsLabel, Alignment.MIDDLE_CENTER);

    if (extraInfo) {
        Label guiInfo = new Label("WebUI calling API " + APIrestful.apiVERSION + " @ " + APIrestful.getURI());
        guiInfo.setSizeUndefined();
        addComponent(guiInfo);
        setComponentAlignment(guiInfo, Alignment.MIDDLE_CENTER);
    }

    addComponent(new Label(""));
    addComponent(new Label(""));

    Label copyright = new Label("\u00A9 SkySQL Corporation Ab, 2014.");
    copyright.setSizeUndefined();
    addComponent(copyright);
    setComponentAlignment(copyright, Alignment.MIDDLE_CENTER);

    Link link = new Link("MariaDB is a trademark of SkySQL Corporation Ab.",
            new ExternalResource("http://www.mariadb.com/about/legal/trademarks"));
    link.setTargetName("_blank");
    addComponent(link);
    setComponentAlignment(link, Alignment.MIDDLE_CENTER);

}

From source file:com.skysql.manager.ui.PanelTools.java

License:Open Source License

/**
 * Instantiates a new panel tools./*from ww w  . j  ava2  s. c o m*/
 */
PanelTools() {

    // thisTab.setSizeFull();
    // thisTab.setWidth(Sizeable.SIZE_UNDEFINED, 0); // Default
    setHeight("200px");
    setSpacing(true);

    // External Tools Vertical Module
    SystemInfo systemInfo = getSession().getAttribute(SystemInfo.class);
    LinkedHashMap<String, String> properties = systemInfo.getCurrentSystem().getProperties();
    if (properties != null) {
        VerticalLayout externalsLayout = new VerticalLayout();
        externalsLayout.setWidth("150px");
        externalsLayout.addStyleName("externalsLayout");
        externalsLayout.setSpacing(true);

        String EIP = properties.get(SystemInfo.PROPERTY_EIP);
        String MONyog = properties.get(SystemInfo.PROPERTY_MONYOG);
        if (EIP != null && MONyog != null) {
            String url = "http://" + EIP + MONyog;
            monyogLink = new Link("MONyog", new ExternalResource(url));
            monyogLink.setTargetName("_blank");
            monyogLink.setDescription("Open MONyog for the whole system");
            monyogLink.setIcon(new ThemeResource("img/externalLink.png"));
            monyogLink.addStyleName("icon-after-caption");
            externalsLayout.addComponent(monyogLink);
            externalsLayout.setComponentAlignment(monyogLink, Alignment.BOTTOM_CENTER);
        }

        phpUrl = properties.get(SystemInfo.PROPERTY_PHPMYADMIN);
        if (phpUrl != null) {
            phpLink = new Link("phpMyAdmin", null);
            phpLink.setTargetName("_blank");
            phpLink.setDescription("Open phpMyAdmin for the selected node");
            phpLink.setIcon(new ThemeResource("img/externalLink.png"));
            phpLink.addStyleName("icon-after-caption");
            externalsLayout.addComponent(phpLink);
            externalsLayout.setComponentAlignment(phpLink, Alignment.BOTTOM_CENTER);
        }

        addComponent(externalsLayout);
        setComponentAlignment(externalsLayout, Alignment.MIDDLE_CENTER);

    }

    {
        Label spacer = new Label();
        spacer.setWidth("40px");
        addComponent(spacer);
    }

    // Scripting layout placeholder
    VerticalLayout placeholderLayout = new VerticalLayout();
    placeholderLayout.addStyleName("placeholderLayout");
    placeholderLayout.setSizeUndefined();

    Label placeholderLabel = new Label("Links to external tools");
    placeholderLabel.addStyleName("instructions");
    placeholderLayout.addComponent(placeholderLabel);

    addComponent(placeholderLayout);
    setComponentAlignment(placeholderLayout, Alignment.MIDDLE_CENTER);

}

From source file:com.trivago.mail.pigeon.web.components.templates.ModalAddTemplate.java

License:Apache License

private void assembleHelpComponents(final Panel helpRootPanel) {
    VerticalLayout vHelpLayout = new VerticalLayout();

    Link velocityLink = new Link("Velocity User Guide",
            new ExternalResource("http://velocity.apache.org/engine/releases/velocity-1.7/user-guide.html"));
    velocityLink.setTargetName("_blank");
    Label helpText1 = new Label(
            "<p>You can find the basic template language user guide at the vendors homepage.</p>",
            Label.CONTENT_XHTML);
    Label helpText2 = new Label(
            "<p>The standard set of commands is enriched with our application specific variables."
                    + "Those will help you to get the newsletter personalized. See below for a list of variables and and macros.</p>",
            Label.CONTENT_XHTML);

    Accordion accordion = new Accordion();

    // Sender//from  w ww  .j  a  v  a2 s  .  co m
    StringBuilder senderText = new StringBuilder("<dl>");
    senderText.append("<dt>sender.uuid.id</dt><dd>The unique id of the sender</dd>");
    senderText.append("<dt>sender.name</dt><dd>The name of the sender</dd>");
    senderText.append("<dt>sender.email.from</dt><dd>The 'from' eMail of the sender</dd>");
    senderText.append("<dt>sender.email.replyto</dt><dd>The reply-to eMail of the sender</dd>");
    senderText.append("</dl>");
    Label senderLabel = new Label(senderText.toString(), Label.CONTENT_XHTML);
    VerticalLayout senderBox = new VerticalLayout();
    senderBox.addComponent(senderLabel);
    senderBox.setMargin(true);
    accordion.addTab(senderBox).setCaption("Sender");

    // Recipient
    StringBuilder recipientText = new StringBuilder("<dl>");
    recipientText.append("<dt>recipient.uuid.id</dt><dd>The unique id of the recipient</dd>");
    recipientText.append(
            "<dt>recipient.uuid.external</dt><dd>The external (e.g. imported from the live system) id of the recipient</dd>");
    recipientText.append("<dt>recipient.name</dt><dd>The name of the recipient</dd>");
    recipientText.append("<dt>recipient.email</dt><dd>The eMail of the recipient</dd>");
    recipientText.append("<dt>recipient.name.title</dt><dd>The reply-to eMail of the sender</dd>");
    recipientText.append("<dt>recipient.name.first</dt><dd>The reply-to eMail of the sender</dd>");
    recipientText.append("<dt>recipient.name.last</dt><dd>The reply-to eMail of the sender</dd>");
    recipientText.append("<dt>recipient.gender</dt><dd>The reply-to eMail of the sender</dd>");
    recipientText.append("<dt>recipient.birthday</dt><dd>The reply-to eMail of the sender</dd>");
    recipientText.append("<dt>recipient.language</dt><dd>The reply-to eMail of the sender</dd>");
    recipientText.append("<dt>recipient.location.city</dt><dd>The reply-to eMail of the sender</dd>");
    recipientText.append("<dt>recipient.location.country</dt><dd>The reply-to eMail of the sender</dd>");
    recipientText.append("</dl>");
    Label recipientLabel = new Label(recipientText.toString(), Label.CONTENT_XHTML);
    VerticalLayout recipientBox = new VerticalLayout();
    recipientBox.addComponent(recipientLabel);
    recipientBox.setMargin(true);
    accordion.addTab(recipientBox).setCaption("Recipient");

    // Mail
    StringBuilder mailText = new StringBuilder("<dl>");
    mailText.append("<dt>recipient.uuid.id</dt><dd>The unique id of the recipient</dd>");
    mailText.append(
            "<dt>recipient.uuid.external</dt><dd>The external (e.g. imported from the live system) id of the recipient</dd>");
    mailText.append("</dl>");
    Label mailLabel = new Label(mailText.toString(), Label.CONTENT_XHTML);
    VerticalLayout mailBox = new VerticalLayout();
    mailBox.addComponent(mailLabel);
    mailBox.setMargin(true);
    accordion.addTab(mailBox).setCaption("Mail");

    // Campaign
    StringBuilder campaignText = new StringBuilder("<dl>");
    campaignText.append("<dt>recipient.uuid.id</dt><dd>The unique id of the recipient</dd>");
    campaignText.append(
            "<dt>recipient.uuid.external</dt><dd>The external (e.g. imported from the live system) id of the recipient</dd>");
    campaignText.append("<dt>recipient.name</dt><dd>The name of the recipient</dd>");
    campaignText.append("<dt>recipient.email</dt><dd>The eMail of the recipient</dd>");
    campaignText.append("<dt>sender.email.replyto</dt><dd>The reply-to eMail of the sender</dd>");
    campaignText.append("</dl>");
    Label campaignLabel = new Label(campaignText.toString(), Label.CONTENT_XHTML);
    VerticalLayout campaignBox = new VerticalLayout();
    campaignBox.addComponent(campaignLabel);
    campaignBox.setMargin(true);
    accordion.addTab(campaignBox).setCaption("Campaign");

    vHelpLayout.addComponent(helpText1);
    vHelpLayout.addComponent(velocityLink);
    vHelpLayout.addComponent(helpText2);
    vHelpLayout.addComponent(accordion);

    helpRootPanel.addComponent(vHelpLayout);
}

From source file:de.catma.CatmaApplication.java

License:Open Source License

@Override
public void init() {

    Properties properties = loadProperties();
    backgroundService = new BackgroundService(this);

    final Window mainWindow = new Window("CATMA 4.1 - CLA " + VERSION);
    mainWindow.addParameterHandler(this);
    HorizontalLayout mainLayout = new HorizontalLayout();
    mainLayout.setSizeUndefined();/*from w w  w  .  ja v a 2  s .co  m*/
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);
    mainWindow.addStyleName("catma-mainwindow");

    mainWindow.setContent(mainLayout);
    MenuFactory menuFactory = new MenuFactory();
    try {
        initTempDirectory(properties);
        tagManager = new TagManager();

        repositoryManagerView = new RepositoryManagerView(new RepositoryManager(this, tagManager, properties));

        tagManagerView = new TagManagerView(tagManager);

        taggerManagerView = new TaggerManagerView();

        analyzerManagerView = new AnalyzerManagerView();

        visualizationManagerView = new VisualizationManagerView();

        defaultProgressIndicator = new ProgressIndicator();
        defaultProgressIndicator.setIndeterminate(true);
        defaultProgressIndicator.setEnabled(false);
        defaultProgressIndicator.setPollingInterval(500);
        progressWindow = new ProgressWindow(defaultProgressIndicator);

        menu = menuFactory.createMenu(mainLayout,
                new MenuFactory.MenuEntryDefinition("Repository Manager",
                        new RepositoryManagerWindow(repositoryManagerView)),
                new MenuFactory.MenuEntryDefinition("Tag Manager", new TagManagerWindow(tagManagerView)),
                new MenuFactory.MenuEntryDefinition("Tagger", new TaggerManagerWindow(taggerManagerView)),
                new MenuFactory.MenuEntryDefinition("Analyzer", new AnalyzerManagerWindow(analyzerManagerView)),
                new MenuFactory.MenuEntryDefinition("Visualizer",
                        new VisualizationManagerWindow(visualizationManagerView)));
        Link aboutLink = new Link("About", new ExternalResource("http://www.catma.de"));
        aboutLink.setTargetName("_blank");
        mainLayout.addComponent(aboutLink);
        mainLayout.setComponentAlignment(aboutLink, Alignment.TOP_RIGHT);
        mainLayout.setExpandRatio(aboutLink, 1.0f);

        Link helpLink = new Link("Help", new ExternalResource(getURL() + "manual/"));
        helpLink.setTargetName("_blank");
        mainLayout.addComponent(helpLink);
        mainLayout.setComponentAlignment(helpLink, Alignment.TOP_RIGHT);

        Label helpLabel = new Label();
        helpLabel.setIcon(new ClassResource("ui/resources/icon-help.gif", this));
        helpLabel.setWidth("20px");
        helpLabel.setDescription(
                "<h3>Hints</h3>" + "<p>Watch out for these little question mark icons while navigating "
                        + "through CATMA. They provide useful hints for managing the first "
                        + "steps within a CATMA component.</p>" + "<h4>Login</h4>"
                        + "Once you're logged in, you will see the Repository Manager, "
                        + "which will explain the first steps to you. "
                        + "Just hover your mouse over the question mark icons!");
        VerticalLayout helpWrapper = new VerticalLayout();
        helpWrapper.addComponent(helpLabel);
        helpWrapper.setComponentAlignment(helpLabel, Alignment.TOP_RIGHT);

        Animator helpAnimator = new Animator(helpWrapper);

        helpAnimator.setFadedOut(true);

        mainLayout.addComponent(helpAnimator);
        mainLayout.setComponentAlignment(helpAnimator, Alignment.TOP_RIGHT);
        helpAnimator.fadeIn(2000, 300);

        MenuBar loginLogoutMenu = new MenuBar();
        LoginLogoutCommand loginLogoutCommand = new LoginLogoutCommand(menu, repositoryManagerView, this);
        MenuItem loginLogoutitem = loginLogoutMenu.addItem("Login", loginLogoutCommand);
        loginLogoutCommand.setLoginLogoutItem(loginLogoutitem);

        mainLayout.addComponent(loginLogoutMenu);
        mainLayout.setComponentAlignment(loginLogoutMenu, Alignment.TOP_RIGHT);
        mainLayout.setWidth("100%");
    } catch (Exception e) {
        showAndLogError("The system could not be initialized!", e);
    }

    setMainWindow(mainWindow);

    setTheme("cleatheme");
}

From source file:de.catma.ui.CatmaApplication.java

License:Open Source License

@Override
protected void init(VaadinRequest request) {
    backgroundService = new UIBackgroundService(true);

    storeParameters(request.getParameterMap());

    Page.getCurrent().setTitle("CATMA 5.0 " + MINORVERSION);

    mainLayout = new VerticalLayout();
    mainLayout.setSizeFull();//from ww w .j av a  2 s .c  om

    menuPanel = new Panel();
    menuPanel.addStyleName("menuPanel");
    mainLayout.addComponent(menuPanel);

    contentPanel = new Panel();
    contentPanel.setHeight("100%");
    contentPanel.addStyleName("contentPanel");

    defaultContentPanelLabel = new Label("Please log in to get started");
    defaultContentPanelLabel.addStyleName("defaultContentPanelLabel");
    contentPanel.setContent(defaultContentPanelLabel);

    mainLayout.addComponent(contentPanel);
    mainLayout.setExpandRatio(contentPanel, 1.0f);

    menuLayout = new HorizontalLayout();
    menuLayout.setMargin(true);
    menuLayout.setSpacing(true);

    logoResource = new ThemeResource("catma-logo.png");
    Link logoImage = new Link(null, new ExternalResource("http://www.catma.de"));
    logoImage.setIcon(logoResource);
    logoImage.setTargetName("_blank");
    menuLayout.addComponent(logoImage);

    MenuFactory menuFactory = new MenuFactory();
    try {

        initTempDirectory();
        tagManager = new TagManager();

        repositoryManagerView = new RepositoryManagerView(
                new RepositoryManager(this, tagManager, RepositoryProperties.INSTANCE.getProperties()));

        tagManagerView = new TagManagerView(tagManager);

        taggerManagerView = new TaggerManagerView();

        analyzerManagerView = new AnalyzerManagerView();

        visualizationManagerView = new VisualizationManagerView();

        menu = menuFactory.createMenu(menuLayout, contentPanel,
                new MenuFactory.MenuEntryDefinition("Repository Manager", repositoryManagerView),
                new MenuFactory.MenuEntryDefinition("Tag Type Manager", tagManagerView),
                new MenuFactory.MenuEntryDefinition("Tagger", taggerManagerView),
                new MenuFactory.MenuEntryDefinition("Analyzer", analyzerManagerView),
                new MenuFactory.MenuEntryDefinition("Visualizer", visualizationManagerView));
        addPropertyChangeListener(CatmaApplicationEvent.userChange, menu.userChangeListener);

        Link latestFeaturesLink = new Link("Latest Features",
                new ExternalResource("http://www.catma.de/latestfeatures"));
        latestFeaturesLink.setTargetName("_blank");
        menuLayout.addComponent(latestFeaturesLink);
        menuLayout.setComponentAlignment(latestFeaturesLink, Alignment.TOP_RIGHT);
        menuLayout.setExpandRatio(latestFeaturesLink, 1.0f);

        Link aboutLink = new Link("About", new ExternalResource("http://www.catma.de"));
        aboutLink.setTargetName("_blank");
        menuLayout.addComponent(aboutLink);
        menuLayout.setComponentAlignment(aboutLink, Alignment.TOP_RIGHT);

        Link termsOfUseLink = new Link("Terms of Use", new ExternalResource("http://www.catma.de/termsofuse"));
        termsOfUseLink.setTargetName("_blank");
        menuLayout.addComponent(termsOfUseLink);
        menuLayout.setComponentAlignment(termsOfUseLink, Alignment.TOP_RIGHT);

        Link manualLink = new Link("Manual", new ExternalResource(request.getContextPath() + "/manual/"));
        manualLink.setTargetName("_blank");
        menuLayout.addComponent(manualLink);
        menuLayout.setComponentAlignment(manualLink, Alignment.TOP_RIGHT);

        Link helpLink = new Link("Helpdesk", new ExternalResource("http://www.catma.de/helpdesk/"));
        helpLink.setTargetName("_blank");
        menuLayout.addComponent(helpLink);
        menuLayout.setComponentAlignment(helpLink, Alignment.TOP_RIGHT);
        helpLink.setVisible(false);

        btHelp = new Button(FontAwesome.QUESTION_CIRCLE);
        btHelp.addStyleName("help-button");
        btHelp.addStyleName("application-help-button");

        menuLayout.addComponent(btHelp);

        btHelp.addClickListener(new ClickListener() {

            public void buttonClick(ClickEvent event) {

                if (uiHelpWindow.getParent() == null) {
                    UI.getCurrent().addWindow(uiHelpWindow);
                } else {
                    UI.getCurrent().removeWindow(uiHelpWindow);
                }

            }
        });

        LoginLogoutCommand loginLogoutCommand = new LoginLogoutCommand(menu, repositoryManagerView);
        Button btloginLogout = new Button("Sign in", event -> loginLogoutCommand.menuSelected(null));
        btloginLogout.setStyleName(BaseTheme.BUTTON_LINK);
        btloginLogout.addStyleName("application-loginlink");

        loginLogoutCommand.setLoginLogoutButton(btloginLogout);

        menuLayout.addComponent(btloginLogout);
        menuLayout.setComponentAlignment(btloginLogout, Alignment.TOP_RIGHT);
        menuLayout.setWidth("100%");

        menuPanel.setContent(menuLayout);

        setContent(mainLayout);

        if (getParameter(Parameter.USER_IDENTIFIER) != null) {
            btloginLogout.click();
        }

        setPollInterval(10000);

        if ((getParameter(Parameter.AUTOLOGIN) != null) && (getUser() == null)) {
            getPage().setLocation(repositoryManagerView.createAuthenticationDialog().createLogInClick(this,
                    RepositoryPropertyKey.CATMA_oauthAuthorizationCodeRequestURL.getValue(),
                    RepositoryPropertyKey.CATMA_oauthAccessTokenRequestURL.getValue(),
                    RepositoryPropertyKey.CATMA_oauthClientId.getValue(),
                    RepositoryPropertyKey.CATMA_oauthClientSecret.getValue(), URLEncoder.encode("/", "UTF-8")));
        }

    } catch (Exception e) {
        showAndLogError("The system could not be initialized!", e);
    }

}

From source file:de.catma.ui.repository.AuthenticationDialog.java

License:Open Source License

private Link createLogInLink(final Application application) {
    try {/*  w  w  w.j ava2 s .  c  o  m*/
        ConsumerManager consumerManager = new ConsumerManager();

        String returnURL = application.getURL().toString() + new IDGenerator().generate();
        logger.info("return url in login link creation " + returnURL);

        @SuppressWarnings("rawtypes")
        List discoveries = consumerManager.discover(this.providerIdent);
        final DiscoveryInformation discovered = consumerManager.associate(discoveries);
        logger.info("endpoint from consumer manager: " + discovered.getOPEndpoint().toString());
        Association assoc = consumerManager.getAssociations().load(discovered.getOPEndpoint().toString());
        final String handle = assoc.getHandle();
        logger.info("handle from consumer manager: " + handle);

        AuthRequest authReq = consumerManager.authenticate(discovered, returnURL);
        FetchRequest fetch = FetchRequest.createFetchRequest();
        fetch.addAttribute("email",
                // attribute alias
                "http://schema.openid.net/contact/email", // type URI
                true); // required

        // attach the extension to the authentication request
        authReq.addExtension(fetch);

        ClassResource icon = new ClassResource("ui/repository/resources/google.png", application);
        Link logInLink = new Link("Log in via Google", new ExternalResource(authReq.getDestinationUrl(true)));
        logInLink.setIcon(icon);

        final AuthenticationParamHandler authenticationParamHandler = new AuthenticationParamHandler(
                application, returnURL, consumerManager, discovered, repositoryReference, repositoryManager,
                dialogWindow, handle);

        application.getMainWindow().addParameterHandler(authenticationParamHandler);
        application.getMainWindow().addURIHandler(authenticationParamHandler);

        btCancel.addListener(new ClickListener() {

            public void buttonClick(ClickEvent event) {
                application.getMainWindow().removeParameterHandler(authenticationParamHandler);
                application.getMainWindow().removeURIHandler(authenticationParamHandler);
                application.getMainWindow().removeWindow(dialogWindow);
            }
        });

        return logInLink;
    } catch (Exception e) {
        e.printStackTrace(); //TODO: handle
    }
    return null;
}

From source file:de.fatalix.timeline.web.root.block.TimelineConfigLayout.java

private Layout createRightSide() {
    status = new Label("STATUS");

    timelineURL = new Link("Timeline Link", new ExternalResource("http://"));
    timelineURL.setTargetName("_blank");
    saveTimeline = new Button("Save Timeline", new Button.ClickListener() {

        @Override/*from  ww w. jav  a 2 s .c  o  m*/
        public void buttonClick(Button.ClickEvent event) {

            saveEvent.select(new AnnotationLiteral<RootViewPresenter.Save>() {
            }).fire(new TimelineCallback.SaveTimeline() {

                @Override
                public void showResult(String message) {
                    status.setValue(message);
                }

                @Override
                public Timeline getTimelineData() {
                    data.setHeadline(headline.getValue());
                    data.setText(text.getValue());
                    data.setStartDate(startDate.getValue());
                    Collection<TimelineEvent> events = new ArrayList<>();
                    for (TimelineEventLayout eventLayout : eventLayouts) {
                        events.add(eventLayout.getTimelineEventData());
                    }
                    data.setEvents(events);
                    return data;
                }
            });

            loadEvent.select(new AnnotationLiteral<RootViewPresenter.Load>() {
            }).fire(new TimelineCallback.LoadTimeline() {
                @Override
                public void loadTimeline(Timeline data) {
                    loadTimelineData(data);
                }

                @Override
                public int getTimelineId() {
                    return data.getId();
                }
            });
        }
    });

    exportTimeline = new Button("export", new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            exportEvent.select(new AnnotationLiteral<RootViewPresenter.Export>() {
            }).fire(new TimelineCallback.ExportTimeline() {

                @Override
                public int getTimelineId() {
                    return data.getId();
                }

                @Override
                public void showJsonResult(String json) {
                    Window dialog = new Window("JSON Format", new Label(json, ContentMode.PREFORMATTED));
                    dialog.setModal(true);
                    UI.getCurrent().addWindow(dialog);
                }
            });
        }
    });

    return new VerticalLayout(saveTimeline, status, timelineURL, exportTimeline);
}

From source file:de.gedoplan.webclients.vaadin.views.CustomersView.java

@Override
protected void configureTable() {
    table.addGeneratedColumn(Customer_.customerID.getName(),
            (source, itemId, columnId) -> new Link(itemId.toString(),
                    new ExternalResource("#!" + Konstanten.VAADIN_VIEW_CUSTOMER_DETAILS + "/" + itemId)));
    //        table.getColumn(Customer_.customerID.getName()).setRenderer(new ButtonRenderer(e -> navigator.navigateTo(Konstanten.VAADIN_VIEW_CUSTOMER_DETAILS + "/" + e.getItemId())));
}