Example usage for com.vaadin.ui Window Window

List of usage examples for com.vaadin.ui Window Window

Introduction

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

Prototype

public Window(String caption, Component content) 

Source Link

Document

Creates a new, empty window with the given content and title.

Usage

From source file:ui.button.CommentButton.java

License:Apache License

@Override
public void buttonClick(ClickEvent event) {
    final TextArea text = new TextArea(
            Translator.getTranslation("Leave us a comment, suggestion or critics. ", language));
    text.setSizeFull();/*from  w ww .java 2s  . co  m*/
    LifetimeButtonLink go = new LifetimeButtonLink(Translator.getTranslation("Send", language),
            FontAwesome.SEND);
    go.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            String message = text.getValue();
            ServiceLocator.findLifetimeService().addComment(userId, message, language);
            if (ServiceLocator.findLifetimeService().sendMail("vitaelifetime@gmail.com", "New User Comment",
                    message)) {
                Notification.show(
                        Translator.getTranslation("Email sent! Thanks for helping us improve.", language),
                        Notification.Type.TRAY_NOTIFICATION);
            }
            window.close();
        }
    });

    window = new Window(Translator.getTranslation("Your opinion counts!", language),
            new VerticalLayout(text, go));
    window.center();
    window.setModal(true);
    window.setStyleName("window");
    window.addCloseListener(new Window.CloseListener() {

        @Override
        public void windowClose(Window.CloseEvent e) {
            window.close();
        }
    });

    getUI().addWindow(window);
}