Example usage for com.vaadin.ui Button.ClickListener Button.ClickListener

List of usage examples for com.vaadin.ui Button.ClickListener Button.ClickListener

Introduction

In this page you can find the example usage for com.vaadin.ui Button.ClickListener Button.ClickListener.

Prototype

Button.ClickListener

Source Link

Usage

From source file:org.vaadin.addons.filterbuilder.FilterBuilderUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    getPage().setTitle("FilterBuilder demo");

    HorizontalSplitPanel content = new HorizontalSplitPanel();
    content.setSizeFull();/*from  w ww  .j av a 2  s  . c  o  m*/

    // Left pane
    leftPane = new VerticalLayout();
    {
        leftPane.setSizeFull();
        leftPane.setMargin(true);
        leftPane.setSpacing(true);

        filterField = new TextField();
        filterField.setInputPrompt("Write your filter here");
        filterField.setIcon(FontAwesome.SEARCH);
        filterField.addStyleName("filter-field inline-icon");
        filterField.setWidth(100, Unit.PERCENTAGE);
        filterField.setTextChangeEventMode(TextField.TextChangeEventMode.LAZY);
        filterField.setTextChangeTimeout(1000);
        filterField.addTextChangeListener(this);
        leftPane.addComponent(filterField);

        filterLabel = new Label();
        filterLabel.setWidth(100, Unit.PERCENTAGE);

        try {
            dataSource = new BeanItemContainer<>(TestCaseBean.class, TestCaseBean.loadMockData());
            dataSource.removeContainerProperty("address");
            dataSource.addNestedContainerProperty("address.country");
            dataSource.addNestedContainerProperty("address.city");
            dataSource.addNestedContainerProperty("address.street");
            dataSource.addNestedContainerProperty("address.address");
        } catch (Exception e) {
            logger.error("Could not load mock data");
        }
        table = new Table(null, dataSource);
        table.setSizeFull();
        table.setVisibleColumns("id", "firstName", "lastName", "jobTitle", "dob", "salary", "address.country",
                "address.city", "address.street", "address.address", "unemployed");
        table.setSelectable(true);
        leftPane.addComponent(table);
        leftPane.setExpandRatio(table, 1);

    }
    content.setFirstComponent(leftPane);

    // Right pane
    rightPane = new TabSheet();
    {
        rightPane.setSizeFull();

        VerticalLayout lastUsedFiltersPane = new VerticalLayout();
        lastUsedFiltersPane.setSizeFull();
        lastUsedFiltersPane.setMargin(true);
        lastUsedFiltersPane.setSpacing(true);
        lastUsedFilters = new IndexedContainer();
        lastUsedFilters.addContainerProperty("filter", String.class, null);
        lastUsedFiltersTable = new Table();
        lastUsedFiltersTable.setSizeFull();
        lastUsedFiltersTable.setContainerDataSource(lastUsedFilters);
        lastUsedFiltersTable.setSortEnabled(false);
        lastUsedFiltersTable.setSelectable(true);
        lastUsedFiltersTable.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
        lastUsedFiltersTable.addItemClickListener(this);

        final Button removeFilterButton = new Button("Remove", new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                if (lastUsedFiltersTable.getValue() != null) {
                    lastUsedFilters.removeItem(lastUsedFiltersTable.getValue());
                    lastUsedFiltersTable.setValue(null);
                }
            }
        });
        removeFilterButton.setEnabled(false);
        lastUsedFiltersTable.addValueChangeListener(new Property.ValueChangeListener() {
            @Override
            public void valueChange(Property.ValueChangeEvent event) {
                removeFilterButton.setEnabled(lastUsedFiltersTable.getValue() != null);
            }
        });
        lastUsedFiltersPane.addComponents(lastUsedFiltersTable, removeFilterButton);
        lastUsedFiltersPane.setExpandRatio(lastUsedFiltersTable, 1);
        rightPane.addTab(lastUsedFiltersPane).setCaption("Last used filters");

        VerticalLayout dateFormatsPane = new VerticalLayout();
        dateFormatsPane.setMargin(true);
        dateFormats = new IndexedContainer();
        dateFormats.addContainerProperty("format", String.class, null);
        for (SimpleDateFormat dateFormat : FilterBuilder.DATE_FORMATS) {
            final Item item = dateFormats.addItem(dateFormat.toPattern());
            item.getItemProperty("format").setValue(dateFormat.toPattern());
        }
        dateFormatsTable = new Table();
        dateFormatsTable.setWidth(100, Unit.PERCENTAGE);
        dateFormatsTable.setContainerDataSource(dateFormats);
        dateFormatsTable.setSortEnabled(false);
        dateFormatsTable.setSelectable(true);
        dateFormatsTable.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
        dateFormatsPane.addComponent(dateFormatsTable);
        rightPane.addTab(dateFormatsPane).setCaption("Known date formats");
    }
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    content.setSecondComponent(rightPane);
    content.setSplitPosition(80, Unit.PERCENTAGE);

    setContent(content);
    logger.debug("UI initialized");
}

From source file:org.vaadin.addons.sitekit.module.content.view.RenderFlowlet.java

License:Apache License

public RenderFlowlet(final Content content) {
    this.content = content;
    topEditButton = getSite().getButton("edit");
    topEditButton.addClickListener(new Button.ClickListener() {
        @Override/*  www.  j  a v  a 2s.c o  m*/
        public void buttonClick(Button.ClickEvent event) {
            final ContentFlowlet contentFlowlet = getFlow().getFlowlet(ContentFlowlet.class);
            contentFlowlet.edit(content, false);
            ((AbstractFlowViewlet) getFlow()).getTopRightLayout().removeComponent(topEditButton);
            ((AbstractFlowViewlet) getFlow()).getBottomRightLayout().removeComponent(bottomEditButton);
            getFlow().forward(ContentFlowlet.class);
        }
    });
    bottomEditButton = getSite().getButton("edit");
    bottomEditButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            final ContentFlowlet contentFlowlet = getFlow().getFlowlet(ContentFlowlet.class);
            contentFlowlet.edit(content, false);
            ((AbstractFlowViewlet) getFlow()).getTopRightLayout().removeComponent(topEditButton);
            ((AbstractFlowViewlet) getFlow()).getBottomRightLayout().removeComponent(bottomEditButton);
            getFlow().forward(ContentFlowlet.class);
        }
    });
}

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

License:Apache License

@Override
protected void initialize() {
    final HorizontalLayout titleLayout = new HorizontalLayout();
    titleLayout.setMargin(new MarginInfo(true, false, true, false));
    titleLayout.setSpacing(true);/*from w w w .ja  v a2 s.  c  o m*/
    final Embedded titleIcon = new Embedded(null, getSite().getIcon("view-icon-privileges"));
    titleIcon.setWidth(32, Unit.PIXELS);
    titleIcon.setHeight(32, Unit.PIXELS);
    titleLayout.addComponent(titleIcon);
    titleLabel = new Label("<h1>" + getSite().localize("view-privileges") + "</h1>", ContentMode.HTML);
    titleLayout.addComponent(titleLabel);

    matrixLayout = new VerticalLayout();
    matrixLayout.setSpacing(true);
    matrixLayout.setMargin(false);

    final HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);
    saveButton = getSite().getButton("save");
    buttonLayout.addComponent(saveButton);
    saveButton.addClickListener(new Button.ClickListener() {
        /** Serial version UID. */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final Button.ClickEvent event) {
            saveGroupMatrix();
            saveUserMatrix();
            PrivilegeCache.flush((Company) Site.getCurrent().getSiteContext().getObject(Company.class));
        }
    });
    discardButton = getSite().getButton("discard");
    buttonLayout.addComponent(discardButton);
    discardButton.addClickListener(new Button.ClickListener() {
        /** Serial version UID. */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final Button.ClickEvent event) {
            refreshGroupMatrix();
            refreshUserMatrix();
        }
    });

    final VerticalLayout panel = new VerticalLayout();
    panel.addComponent(titleLayout);
    panel.addComponent(matrixLayout);
    panel.addComponent(buttonLayout);
    panel.setSpacing(true);
    panel.setMargin(true);

    final Panel mainLayout = new Panel();
    mainLayout.setStyleName(Reindeer.PANEL_LIGHT);
    mainLayout.setContent(panel);

    setCompositionRoot(mainLayout);
}

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

License:Open Source License

public MainMenuView() {
    setWidth("100%");
    setMargin(true);/*from   ww w  . jav a 2s. 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);

}

From source file:org.vaadin.alump.offlinebuilder.demo.DemoUI.java

License:Open Source License

@Override
protected void init(VaadinRequest vaadinRequest) {

    OfflineUIExtension offlineExtension = OfflineUIExtension.get(this);

    // As Panel is half legacy component, using OfflineCssLayout to make content scrollable
    OfflineCssLayout panel = new OfflineCssLayout();
    panel.addStyleName("scrollable-wrapper");
    panel.setSizeFull();/*  w  w  w  .  java 2 s  .  com*/
    setContent(panel);
    offlineExtension.setOfflineRoot(panel);

    VerticalLayout layout = new OfflineVerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.addStyleName("main-layout");
    panel.addComponent(layout);

    Label header = new OfflineLabel("OfflineBuilder");
    header.addStyleName("header-label");
    layout.addComponent(header);

    Label info = new OfflineLabel("OfflineBuilder allows to define offline UI without need of writing GWT"
            + " code. Add-on offers offline extended versions of basic Vaadin UI components and layouts. This way"
            + " your server defined UI can be used on offline mode too.");
    info.addStyleName("info-label");
    layout.addComponent(info);

    info = new OfflineLabel(
            "To test offline functionality. Turn on flight mode on your device or just disconnect"
                    + " from your network connection. Offline UI should look identical with online UI.");
    info.addStyleName("info-label");
    layout.addComponent(info);

    Image image = new OfflineImage();
    image.setWidth("300px");
    image.addStyleName("extra-stylename-image");
    image.setSource(new ThemeResource("img/offline.png"));
    image.setDescription("Example image");
    layout.addComponent(image);

    HorizontalLayout buttonLayout = new OfflineHorizontalLayout();
    buttonLayout.setSpacing(true);
    layout.addComponent(buttonLayout);

    OfflineButton pingButton = new OfflineButton("Ping server");
    pingButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            Notification.show("Server says pong!");
        }
    });
    pingButton.setDescription("Button that will be automatically disabled on offline mode");
    buttonLayout.addComponent(pingButton);

    OfflineButton writeButton = new OfflineButton("Store value (TODO)");
    writeButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            Notification.show("No need to store, in online mode.");
        }
    });
    buttonLayout.addComponent(writeButton);

    /*
    OfflineFormLayout formTest = new OfflineFormLayout();
    OfflineCheckBox checkbox = new OfflineCheckBox("Flag me");
    checkbox.setOfflineValueKey("flag");
    formTest.addComponent(checkbox);
    layout.addComponent(formTest);
    */

    Link link = new OfflineLink("Open project's GitHub page",
            new ExternalResource("https://github.com/alump/OfflineBuilder"));
    link.addStyleName("github-link");
    layout.addComponent(link);
}

From source file:org.vaadin.alump.scaleimage.demo.DemoUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    VerticalLayout layout = new VerticalLayout();
    layout.setWidth(100, Unit.PERCENTAGE);
    layout.setMargin(true);/*  w w w. ja v  a  2  s . c  o m*/
    layout.setSpacing(true);
    setContent(layout);

    // Big image that will scale to match with your page width, will
    // show the center of given picture. See SCSS file.
    ScaleImage bigCenterImage = new ScaleImage();
    bigCenterImage.setWidth("100%");
    bigCenterImage.setHeight("200px");
    bigCenterImage.setStyleName("big-center-image");
    bigCenterImage.setSource(new ThemeResource("images/big-center-image.jpg"));
    bigCenterImage.addClickListener(new MouseEvents.ClickListener() {
        @Override
        public void click(MouseEvents.ClickEvent clickEvent) {
            Notification.show("Big center image clicked!");
        }
    });
    layout.addComponent(bigCenterImage);

    // Tile with image, where images will be scaled to match with tile size.
    // tileimage will cover space of tile and indicator image will be at
    // top left corner.
    // Uses absolute left/right/top/down positioning. See SCSS file.
    final CssLayout tile = new CssLayout();
    tile.setStyleName("tile");
    tile.setWidth(100, Unit.PIXELS);
    tile.setHeight(100, Unit.PIXELS);
    layout.addComponent(tile);
    tile.addLayoutClickListener(new LayoutClickListener() {

        @Override
        public void layoutClick(LayoutClickEvent event) {
            int size = (int) Math.round(100.0 + Math.random() * 100.0);
            tile.setWidth(size, Unit.PIXELS);
            tile.setHeight(size, Unit.PIXELS);
        }

    });

    ScaleImage tileImage = new ScaleImage();
    tileImage.setSource(new ThemeResource("images/tile-image.jpg"));
    tileImage.setStyleName("tile-image");
    tile.addComponent(tileImage);
    ScaleImage indicatorImage = new ScaleImage();
    indicatorImage.setSource(new ThemeResource("images/tile-indicator.png"));
    indicatorImage.setStyleName("tile-indicator");
    tile.addComponent(indicatorImage);
    Label tileLabel = new Label("Click tile to scale it.");
    tile.addComponent(tileLabel);

    extendedImage = new ExtendedScaleImage();
    extendedImage.setSource(new ThemeResource("images/tile-indicator.png"));
    extendedImage.setWidth("200px");
    extendedImage.setHeight("400px");
    extendedImage.setStyleName("extended-image");
    layout.addComponent(extendedImage);

    Button moveButton = new Button("Move background", new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            Boolean val = extendedImage.getPosition();
            if (val == null) {
                val = true;
            }

            extendedImage.setPosition(!val.booleanValue());

        }
    });
    layout.addComponent(moveButton);

    // Test how well scale image behaves inside alignment layout

    HorizontalLayout alignLayout = new HorizontalLayout();
    alignLayout.setSpacing(true);
    alignLayout.setWidth("200px");
    layout.addComponent(alignLayout);

    Label label = new Label("Alignment test:");
    label.addStyleName("align-label");
    alignLayout.addComponent(label);
    alignLayout.setExpandRatio(label, 1.0f);
    alignLayout.setComponentAlignment(label, Alignment.MIDDLE_CENTER);

    ScaleImage alignImage = new ScaleImage();
    alignImage.setSource(new ThemeResource("images/tile-image.jpg"));
    alignImage.setWidth("20px");
    alignImage.setHeight("20px");
    alignLayout.addComponent(alignImage);
    alignLayout.setComponentAlignment(alignImage, Alignment.BOTTOM_CENTER);
}

From source file:org.vaadin.notifique.Notifique.java

License:Apache License

/**
 * Create a close button for a message.//from   w  w  w  .j av  a 2s.  c  om
 */
protected Button createCloseButtonFor(final Message i) {
    Button b = new Button();
    b.addListener(new Button.ClickListener() {
        private static final long serialVersionUID = -1932127150282887613L;

        public void buttonClick(ClickEvent event) {
            i.hide();

        }
    });
    b.setStyleName(Reindeer.BUTTON_LINK);
    b.addStyleName(STYLE_CLOSE);
    return b;
}

From source file:org.vaadin.notifique.sample.NotifiqueSampleApplicationUI.java

License:Apache License

@Override
public void init(VaadinRequest request) {
    VerticalLayout view = new VerticalLayout();
    stack = new Notifique(false);
    stack.setClickListener(this);
    stack.setHideListener(this);
    stack.setWidth("100%");
    view.addComponent(stack);//  w  ww . j av  a 2s.com

    HorizontalLayout btns = new HorizontalLayout();
    view.addComponent(btns);

    String[] styles = new String[] { Notifique.Styles.INFO, Notifique.Styles.SUCCESS, Notifique.Styles.WARNING,
            Notifique.Styles.ERROR, Notifique.Styles.MESSAGE, Notifique.Styles.MAGIC_BLACK,
            Notifique.Styles.MAGIC_GRAY, Notifique.Styles.MAGIC_WHITE, Notifique.Styles.BROWSER_FF,
            Notifique.Styles.BROWSER_FF3, Notifique.Styles.BROWSER_IE, Notifique.Styles.BROWSER_CHROME,
            Notifique.Styles.VAADIN_BLACK, Notifique.Styles.VAADIN_BEIGE, Notifique.Styles.VAADIN_RED,
            Notifique.Styles.VAADIN_GREEN, Notifique.Styles.VAADIN_BLUE, Notifique.Styles.VAADIN_ORANGE };
    for (int i = 0; i < styles.length; i++) {
        final String s = styles[i];
        btns.addComponent(new Button("" + s, new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            public void buttonClick(ClickEvent event) {
                stack.add(themeIcon("email", 32),
                        "This is a message at <b>" + new Date() + "</b>. This is something longer with this.",
                        s);
            }
        }));
    }
    btns.addComponent(new Button("Clear", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            stack.clear();
        }
    }));

    final Resource icon = new ThemeResource("../runo/icons/32/email.png");

    flow = new Notifique(true);
    flow.setFillFromTop(true);
    flow.setClickListener(this);
    flow.setHideListener(this);
    flow.setVisibleCount(4);
    flow.setWidth("200px");
    flow.setHeight("400px");
    view.addComponent(flow);
    view.addComponent(new Button("add", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            flow.add(icon,
                    "This is a message at <b>" + new Date() + "</b>. This is something longer with this.", true,
                    null, false);
        }
    }));

    setContent(view);
}

From source file:org.vaadin.overlay.sample.OverlaySampleApplication.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    VerticalLayout layout = new VerticalLayout();

    final Label label = new Label("Alignment.TOP_LEFT");
    layout.addComponent(label);/*from  w ww . ja v  a2s.  com*/

    for (int i = 0; i < 20; i++) {

        Button button = new Button("Sample Button");
        layout.addComponent(button);

        final ImageOverlay io = new ImageOverlay(button);

        Resource res = new ClassResource(this.getClass(), "../icon-new.png");
        io.setImage(res);
        io.setComponentAnchor(Alignment.TOP_LEFT); // Top left of the button
        io.setOverlayAnchor(Alignment.MIDDLE_CENTER); // Center of the image
        io.setClickListener(new OverlayClickListener() {
            public void overlayClicked(CustomClickableOverlay overlay) {
                Notification.show("ImageOverlay Clicked!");
            }
        });
        layout.addComponent(io);
        io.setEnabled(true);

        final TextOverlay to = new TextOverlay(button, "New!");
        to.setComponentAnchor(Alignment.MIDDLE_RIGHT); // Top right of the button
        to.setOverlayAnchor(Alignment.MIDDLE_CENTER); // Center of the image
        to.setClickListener(new OverlayClickListener() {
            public void overlayClicked(CustomClickableOverlay overlay) {
                Notification.show("TextOverlay Clicked!");
            }
        });
        layout.addComponent(to);

        button.addClickListener(new Button.ClickListener() {
            public void buttonClick(ClickEvent event) {
                Alignment a = io.getComponentAnchor();
                String s = "";
                if (Alignment.TOP_LEFT.equals(a)) {
                    a = Alignment.TOP_CENTER;
                    s = "TOP_CENTER";
                } else if (Alignment.TOP_CENTER.equals(a)) {
                    a = Alignment.TOP_RIGHT;
                    s = "TOP_RIGHT";
                } else if (Alignment.TOP_RIGHT.equals(a)) {
                    a = Alignment.MIDDLE_RIGHT;
                    s = "MIDDLE_RIGHT";
                } else if (Alignment.MIDDLE_RIGHT.equals(a)) {
                    a = Alignment.BOTTOM_RIGHT;
                    s = "BOTTOM_RIGHT";
                } else if (Alignment.BOTTOM_RIGHT.equals(a)) {
                    a = Alignment.BOTTOM_CENTER;
                    s = "BOTTOM_CENTER";
                } else if (Alignment.BOTTOM_CENTER.equals(a)) {
                    a = Alignment.BOTTOM_LEFT;
                    s = "BOTTOM_LEFT";
                } else if (Alignment.BOTTOM_LEFT.equals(a)) {
                    a = Alignment.MIDDLE_LEFT;
                    s = "MIDDLE_LEFT";
                } else if (Alignment.MIDDLE_LEFT.equals(a)) {
                    a = Alignment.TOP_LEFT;
                    s = "TOP_LEFT";
                }
                io.setComponentAnchor(a);
                label.setValue("Alignment." + s);
            }
        });
    }

    setContent(layout);
}

From source file:org.vaadin.spring.samples.security.shared.LoginUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    getPage().setTitle("Vaadin Shared Security Demo Login");

    FormLayout loginForm = new FormLayout();
    loginForm.setSizeUndefined();/*from   w  w  w.j  a va2s .  c o m*/

    userName = new TextField("Username");
    passwordField = new PasswordField("Password");
    rememberMe = new CheckBox("Remember me");
    login = new Button("Login");
    loginForm.addComponent(userName);
    loginForm.addComponent(passwordField);
    loginForm.addComponent(rememberMe);
    loginForm.addComponent(login);
    login.addStyleName(ValoTheme.BUTTON_PRIMARY);
    login.setDisableOnClick(true);
    login.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    login.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            login();
        }
    });

    VerticalLayout loginLayout = new VerticalLayout();
    loginLayout.setSpacing(true);
    loginLayout.setSizeUndefined();

    if (request.getParameter("logout") != null) {
        loggedOutLabel = new Label("You have been logged out!");
        loggedOutLabel.addStyleName(ValoTheme.LABEL_SUCCESS);
        loggedOutLabel.setSizeUndefined();
        loginLayout.addComponent(loggedOutLabel);
        loginLayout.setComponentAlignment(loggedOutLabel, Alignment.BOTTOM_CENTER);
    }

    loginLayout.addComponent(loginFailedLabel = new Label());
    loginLayout.setComponentAlignment(loginFailedLabel, Alignment.BOTTOM_CENTER);
    loginFailedLabel.setSizeUndefined();
    loginFailedLabel.addStyleName(ValoTheme.LABEL_FAILURE);
    loginFailedLabel.setVisible(false);

    loginLayout.addComponent(loginForm);
    loginLayout.setComponentAlignment(loginForm, Alignment.TOP_CENTER);

    VerticalLayout rootLayout = new VerticalLayout(loginLayout);
    rootLayout.setSizeFull();
    rootLayout.setComponentAlignment(loginLayout, Alignment.MIDDLE_CENTER);
    setContent(rootLayout);
    setSizeFull();
}