Example usage for com.vaadin.ui CustomLayout setCaption

List of usage examples for com.vaadin.ui CustomLayout setCaption

Introduction

In this page you can find the example usage for com.vaadin.ui CustomLayout setCaption.

Prototype

@Override
    public void setCaption(String caption) 

Source Link

Usage

From source file:org.bubblecloud.ilves.ui.anonymous.login.LoginFlowlet.java

License:Apache License

@SuppressWarnings("serial")
@Override/* ww w . j  a  va  2 s .co m*/
public void initialize() {

    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);

    final Company company = getSite().getSiteContext().getObject(Company.class);
    if (company.isOpenIdLogin()) {
        final VerticalLayout mainPanel = new VerticalLayout();
        mainPanel.setCaption(getSite().localize("header-open-id-login"));
        layout.addComponent(mainPanel);
        final HorizontalLayout openIdLayout = new HorizontalLayout();
        mainPanel.addComponent(openIdLayout);
        openIdLayout.setMargin(new MarginInfo(false, false, true, false));
        openIdLayout.setSpacing(true);
        final String returnViewName = "openidlogin";
        final Map<String, String> urlIconMap = OpenIdUtil.getOpenIdProviderUrlIconMap();
        for (final String url : urlIconMap.keySet()) {
            openIdLayout.addComponent(OpenIdUtil.getLoginButton(url, urlIconMap.get(url), returnViewName));
        }
    }

    try {
        final CustomLayout loginFormLayout = new CustomLayout(
                JadeUtil.parse("/VAADIN/themes/ilves/layouts/login.jade"));
        Responsive.makeResponsive(loginFormLayout);
        loginFormLayout.setCaption(getSite().localize("header-email-and-password-login"));
        layout.addComponent(loginFormLayout);
    } catch (final IOException e) {
        throw new SiteException("Error loading login form.", e);
    }

    if (company.isSelfRegistration()) {
        final Button registerButton = new Button(getSite().localize("button-register") + " >>");
        registerButton.addClickListener(new ClickListener() {
            @Override
            public void buttonClick(final ClickEvent event) {
                getFlow().forward(RegisterFlowlet.class);
            }
        });
        layout.addComponent(registerButton);
    }

    if (company.isEmailPasswordReset()) {
        final Button forgotPasswordButton = new Button(getSite().localize("button-forgot-password") + " >>");
        forgotPasswordButton.addClickListener(new ClickListener() {
            @Override
            public void buttonClick(final ClickEvent event) {
                getFlow().forward(ForgotPasswordFlowlet.class);
            }
        });
        layout.addComponent(forgotPasswordButton);
    }

    final Panel panel = new Panel();
    panel.setSizeUndefined();
    panel.setContent(layout);

    setViewContent(panel);

}