Example usage for com.vaadin.ui VerticalLayout setStyleName

List of usage examples for com.vaadin.ui VerticalLayout setStyleName

Introduction

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

Prototype

@Override
    public void setStyleName(String style) 

Source Link

Usage

From source file:it.vige.greenarea.bpm.custom.ui.form.dettagliopolicy.DettaglioPolicyField.java

License:Apache License

public DettaglioPolicyField(FormProperty formProperty,
        GreenareaAbstractFormPropertyRenderer<T> greenareaAbstractFormPropertyRenderer,
        FasciaOraria fasciaOraria) {//from  ww  w.  j av  a 2  s .c  o m
    I18nManager i18nManager = get().getI18nManager();
    String caption = i18nManager.getMessage(DETTAGLIO_POLICY_TITLE);
    setSpacing(true);
    setCaption(caption);
    setHeight(Sizeable.SIZE_UNDEFINED, 0);
    validityLabel = new Label();
    validityLabel.setValue(i18nManager.getMessage(DETTAGLIO_POLICY_PERIODO_VALIDITA) + " "
            + (fasciaOraria != null ? fasciaOraria.getValidita() : ""));
    fasciaOrariaLabel = new Label();
    fasciaOrariaLabel.setValue(i18nManager.getMessage(DETTAGLIO_POLICY_FASCIA_ORARIA) + " "
            + (fasciaOraria != null ? fasciaOraria.getNome() : ""));
    VerticalLayout vLayout = new VerticalLayout();
    vLayout.addComponent(validityLabel);
    vLayout.addComponent(fasciaOrariaLabel);
    vLayout.setStyleName("dettaglio-policy-label");

    policyDetailsButton = new Button();
    final String dettaglioPolicy = i18nManager.getMessage(DETTAGLIO_POLICY_DETTAGLIO_POLICY);
    policyDetailsButton.setCaption(i18nManager.getMessage(DETTAGLIO_POLICY_BUTTON));
    final ParametriTable parametriTable = new ParametriTable(formProperty,
            greenareaAbstractFormPropertyRenderer.getGreenareaFormPropertiesForm());
    final PrezziTable prezziTable = new PrezziTable(formProperty,
            greenareaAbstractFormPropertyRenderer.getGreenareaFormPropertiesForm());
    policyDetailsButton.addListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            PopupWindow window = new PopupWindow(dettaglioPolicy);
            VerticalLayout verticalLayout = new VerticalLayout();
            window.setContent(verticalLayout);
            verticalLayout.addComponent(parametriTable);
            verticalLayout.addComponent(parametriTable.createControls());
            verticalLayout.addComponent(prezziTable);
            verticalLayout.addComponent(prezziTable.createControls());
            verticalLayout.addStyleName("main-table");
            window.addListener(new SubmitEventListener() {
                private static final long serialVersionUID = 1L;

                @Override
                protected void submitted(SubmitEvent event) {

                }

                @Override
                protected void cancelled(SubmitEvent event) {
                }
            });
            window.setWidth(900, Sizeable.UNITS_PIXELS);
            window.setHeight(500, Sizeable.UNITS_PIXELS);
            window.setModal(true);
            window.center();
            get().getViewManager().showPopupWindow(window);
        }
    });

    addComponent(vLayout);

    addComponent(policyDetailsButton);

    // Invisible textfield, only used as wrapped field
    wrappedField = new TextField();
    wrappedField.setVisible(false);
    addComponent(wrappedField);
}

From source file:jp.primecloud.auto.ui.WinPassword.java

License:Open Source License

public WinPassword(InstanceDto instanceDto, final Long instanceNo) {
    setCaption(ViewProperties.getCaption("description.getPassword"));
    setModal(true);//ww w.  j av a  2s  .  c  o m
    setWidth("580px");
    setIcon(Icons.EDITMINI.resource());

    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setStyleName("win-password");

    //
    PlatformDto platformDto = instanceDto.getPlatform();
    String keyName = "";
    // TODO CLOUD BRANCHING
    if (PCCConstant.PLATFORM_TYPE_AWS.equals(platformDto.getPlatform().getPlatformType())) {
        keyName = instanceDto.getAwsInstance().getKeyName();
    } else if (PCCConstant.PLATFORM_TYPE_CLOUDSTACK.equals(platformDto.getPlatform().getPlatformType())) {
        keyName = instanceDto.getCloudstackInstance().getKeyName();
    }

    Label privateKeyLabel = new Label(ViewMessages.getMessage("IUI-000099", keyName));
    layout.addComponent(privateKeyLabel);

    privateKeyField = new TextField();
    privateKeyField.setSizeFull();
    privateKeyField.setRows(10);

    privateKeyField.setStyleName("privatekey");
    layout.addComponent(privateKeyField);

    passwordField = new TextField("");
    passwordField.setColumns(20);

    passwordField.setCaption(ViewProperties.getCaption("label.password"));
    passwordField.setStyleName("password");
    layout.addComponent(passwordField);

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

    passwordButton = new Button(ViewProperties.getCaption("button.getPassword"));
    passwordButton.addListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            getPassword(instanceNo);
        }
    });

    horizontalLayout.addComponent(passwordButton);

    closeButton = new Button(ViewProperties.getCaption("button.close"));
    closeButton.addListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            close();
        }
    });
    horizontalLayout.addComponent(closeButton);

    layout.addComponent(horizontalLayout);
    layout.setComponentAlignment(horizontalLayout, Alignment.BOTTOM_RIGHT);
    layout.setComponentAlignment(passwordField, Alignment.MIDDLE_CENTER);

    initValidation();
}

From source file:management.limbr.ui.login.LogInViewImpl.java

License:Open Source License

@PostConstruct
public void init() {
    setSizeFull();/* ww  w  .  j av a2s .  c o m*/

    usernameField = new TextField(messages.get("usernameFieldLabel"));
    usernameField.setWidth(20.0f, Unit.EM);
    usernameField.setRequired(true);
    usernameField.setInputPrompt(messages.get("usernameFieldPrompt"));
    usernameField
            .addValidator(new StringLengthValidator(messages.get("usernameFieldValidation"), 3, 256, false));
    usernameField.setImmediate(true);
    usernameField.setInvalidAllowed(false);

    passwordField = new PasswordField(messages.get("passwordFieldLabel"));
    passwordField.setWidth(20.0f, Unit.EM);
    passwordField.setInputPrompt(messages.get("passwordFieldPrompt"));
    passwordField
            .addValidator(new StringLengthValidator(messages.get("passwordFieldValidation"), 8, 256, false));
    passwordField.setImmediate(true);
    passwordField.setRequired(true);
    passwordField.setNullRepresentation("");

    Button logInButton = new Button(messages.get("logInButtonLabel"));
    logInButton.addClickListener(event -> {
        usernameField.setValidationVisible(false);
        passwordField.setValidationVisible(false);
        try {
            usernameField.commit();
            passwordField.commit();
        } catch (Validator.InvalidValueException e) {
            Notification.show(e.getMessage());
            usernameField.setValidationVisible(true);
            passwordField.setValidationVisible(true);
            LOG.debug("Validation of log in fields failed.", e);
        }
        listeners.forEach(LogInViewListener::logInClicked);
    });

    VerticalLayout fields = new VerticalLayout(usernameField, passwordField, logInButton);
    fields.setCaption(messages.get("logInCaption", LimbrApplication.getApplicationName()));
    fields.setSpacing(true);
    fields.setMargin(new MarginInfo(true, true, true, false));
    fields.setSizeUndefined();

    VerticalLayout mainLayout = new VerticalLayout(fields);
    mainLayout.setSizeFull();
    mainLayout.setComponentAlignment(fields, Alignment.MIDDLE_CENTER);
    mainLayout.setStyleName(ValoTheme.FORMLAYOUT_LIGHT);

    setCompositionRoot(mainLayout);

    listeners.forEach(listener -> listener.viewInitialized(this));
}

From source file:module.pandabox.presentation.PandaBox.java

License:Open Source License

private void initView() {
    setCompositionRoot(root);//  w  w  w  .  ja v a 2  s.c  o m
    root.setSizeFull();
    root.setSplitPosition(15);
    root.setStyleName("small previews");

    previewArea.setWidth("100%");
    previewTabs = new VerticalLayout();
    previewTabs.setSizeFull();
    previewTabs.setHeight(null);

    compoundTabs = new VerticalLayout();
    compoundTabs.setSizeFull();
    compoundTabs.setHeight(null);

    bennuStylesTabs = new VerticalLayout();
    bennuStylesTabs.setSizeFull();
    bennuStylesTabs.setHeight(null);

    VerticalLayout menu = new VerticalLayout();
    menu.setSizeFull();
    menu.setStyleName("sidebar-menu");

    Button syncThemes = new Button("Sync Themes", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            syncThemes();
        }
    });
    menu.addComponent(syncThemes);
    menu.addComponent(new Label("Single Components"));
    menu.addComponent(previewTabs);
    menu.addComponent(new Label("Compound Styles"));
    menu.addComponent(compoundTabs);

    menu.addComponent(new Label("Bennu Styles"));
    menu.addComponent(bennuStylesTabs);

    root.setFirstComponent(menu);

    CssLayout toolbar = new CssLayout();
    toolbar.setWidth("100%");
    toolbar.setStyleName("toolbar");
    toolbar.addComponent(editorToggle);

    final Window downloadWindow = new Window("Download Theme");
    GridLayout l = new GridLayout(3, 2);
    l.setSizeUndefined();
    l.setMargin(true);
    l.setSpacing(true);
    downloadWindow.setContent(l);
    downloadWindow.setModal(true);
    downloadWindow.setResizable(false);
    downloadWindow.setCloseShortcut(KeyCode.ESCAPE, null);
    downloadWindow.addStyleName("opaque");
    Label caption = new Label("Theme Name");
    l.addComponent(caption);
    l.setComponentAlignment(caption, Alignment.MIDDLE_CENTER);
    final TextField name = new TextField();
    name.setValue("my-chameleon");
    name.addValidator(new RegexpValidator("[a-zA-Z0-9\\-_\\.]+", "Only alpha-numeric characters allowed"));
    name.setRequired(true);
    name.setRequiredError("Please give a name for the theme");
    downloadWindow.addComponent(name);
    Label info = new Label(
            "This is the name you will use to set the theme in your application code, i.e. <code>setTheme(\"my-cameleon\")</code>.",
            Label.CONTENT_XHTML);
    info.addStyleName("tiny");
    info.setWidth("200px");
    l.addComponent(info, 1, 1, 2, 1);

    Button download = new Button(null, new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            getApplication().getMainWindow().addWindow(downloadWindow);
            name.focus();
        }
    });
    download.setDescription("Donwload the current theme");
    download.setIcon(new ThemeResource("download.png"));
    download.setStyleName("icon-only");
    toolbar.addComponent(download);

    menu.addComponent(toolbar);
    menu.setExpandRatio(toolbar, 1);
    menu.setComponentAlignment(toolbar, Alignment.BOTTOM_CENTER);

}

From source file:net.sf.gazpachoquest.questionnaires.views.login.OldLoginView.java

License:Open Source License

public OldLoginView() {
    setSizeFull();//from   w  w  w . j  a  v  a  2  s. c  om

    // Language bar in the top-right corner for selecting
    // invitation interface language
    final HorizontalLayout languageBar = new HorizontalLayout();
    languageBar.setHeight("50px");
    // addComponent(languageBar);
    // setComponentAlignment(languageBar, Alignment.TOP_RIGHT);

    // Allow selecting a language. We are in a constructor of a
    // CustomComponent, so preselecting the current
    // language of the application can not be done before
    // this (and the selection) component are attached to
    // the application.
    final ComboBox languageSelector = new ComboBox("Select a language") {
        @Override
        public void attach() {
            super.attach();
            // setValue(getLocale());
        }
    };

    // for (int i=0; i<locales.length; i++) {
    String locale = "es";
    languageSelector.addItem(locale);
    languageSelector.setItemCaption(locale, "espaol");

    // Automatically select the current locale
    // if (locales[i].equals(getLocale()))
    languageSelector.setValue(locale);

    // }

    // Create the invitation input field
    invitationTextField = new TextField("Invitation key:");
    invitationTextField.setWidth("300px");
    invitationTextField.setRequired(true);
    invitationTextField.setInputPrompt("Your questionnair invitation key (eg. 12345678)");
    invitationTextField.setInvalidAllowed(false);

    // Create login button
    enterButton = new Button("Enter", this);

    // Add both to a panel
    VerticalLayout fields = new VerticalLayout(languageSelector, invitationTextField, enterButton);
    fields.setCaption("Please enter your invitation key to access the questionnair");
    fields.setSpacing(true);
    fields.setMargin(new MarginInfo(true, true, true, false));
    fields.setSizeUndefined();

    // The view root layout
    VerticalLayout viewLayout = new VerticalLayout(fields);
    viewLayout.setSizeFull();
    viewLayout.setComponentAlignment(fields, Alignment.MIDDLE_CENTER);
    viewLayout.setStyleName(Reindeer.LAYOUT_BLUE);
    setCompositionRoot(viewLayout);
}

From source file:no.uib.probe.csf.pr.touch.view.core.SearchingField.java

/**
 * Default constructor to initialize the main attributes.
 *///from w  w  w  .  ja  va  2s. c o  m
public SearchingField() {
    this.setSpacing(true);
    this.setHeightUndefined();

    HorizontalLayout searchFieldContainerLayout = new HorizontalLayout();
    searchFieldContainerLayout.setWidthUndefined();
    searchFieldContainerLayout.setHeight(100, Unit.PERCENTAGE);
    searchFieldContainerLayout.setSpacing(true);
    TextField searchField = new TextField();
    searchField.setDescription("Search proteins by name or accession");
    searchField.setImmediate(true);
    searchField.setWidth(100, Unit.PIXELS);
    searchField.setHeight(18, Unit.PIXELS);
    searchField.setInputPrompt("Search...");
    searchFieldContainerLayout.addComponent(searchField);
    searchField.setTextChangeTimeout(1500);
    searchField.setStyleName(ValoTheme.TEXTFIELD_SMALL);
    searchField.addStyleName(ValoTheme.TEXTFIELD_TINY);
    final Button b = new Button();
    searchField.setTextChangeEventMode(AbstractTextField.TextChangeEventMode.LAZY);

    searchField.addShortcutListener(new Button.ClickShortcut(b, ShortcutListener.KeyCode.ENTER));

    VerticalLayout searchingBtn = new VerticalLayout();
    searchingBtn.setWidth(22, Unit.PIXELS);
    searchingBtn.setHeight(18, Unit.PIXELS);
    searchingBtn.setStyleName("tablesearchingbtn");
    searchFieldContainerLayout.addComponent(searchingBtn);
    searchFieldContainerLayout.setComponentAlignment(searchingBtn, Alignment.TOP_CENTER);
    this.addComponent(searchFieldContainerLayout);
    this.setComponentAlignment(searchFieldContainerLayout, Alignment.TOP_CENTER);
    searchingCommentLabel = new Label();
    searchingCommentLabel.setWidth(100, Unit.PERCENTAGE);
    searchingCommentLabel.setHeight(23, Unit.PIXELS);
    searchingCommentLabel.addStyleName(ValoTheme.LABEL_BOLD);
    searchingCommentLabel.addStyleName(ValoTheme.LABEL_SMALL);
    searchingCommentLabel.addStyleName(ValoTheme.LABEL_TINY);
    this.addComponent(searchingCommentLabel);
    this.setComponentAlignment(searchingCommentLabel, Alignment.TOP_CENTER);

    searchingBtn.addLayoutClickListener((LayoutEvents.LayoutClickEvent event) -> {
        b.click();
    });
    searchField.addTextChangeListener((FieldEvents.TextChangeEvent event) -> {
        SearchingField.this.textChanged(event.getText());
    });
    b.addClickListener((Button.ClickEvent event) -> {
        SearchingField.this.textChanged(searchField.getValue());
    });

}

From source file:no.uib.probe.mnpc_2017.view.ApplicationLayout.java

public ApplicationLayout() {
    this.setWidth("100%");
    this.setHeightUndefined();
    //        this.setStyleName(Reindeer.LAYOUT_WHITE);
    this.setMargin(false);
    this.setSpacing(true);

    VerticalLayout headerLayout = new VerticalLayout();
    headerLayout.setWidth("100%");
    headerLayout.setHeight("77px");
    this.addComponent(headerLayout);

    Panel mainBodyPanel = new Panel();
    //        headerLayout.setStyleName(Reindeer.LAYOUT_BLUE);

    HorizontalLayout topLayoutContainer = new HorizontalLayout();
    headerLayout.addComponent(topLayoutContainer);
    headerLayout.setComponentAlignment(topLayoutContainer, Alignment.MIDDLE_CENTER);
    topLayoutContainer.setWidthUndefined();
    topLayoutContainer.setHeight("100%");

    VerticalLayout logoLayout = new VerticalLayout();
    logoLayout.setWidth("200px");
    logoLayout.setHeight("100%");
    logoLayout.setStyleName("starlogo");
    logoLayout.setMargin(new MarginInfo(false, true, false, false));

    Label title = new Label("NPC 2017");
    logoLayout.addComponent(title);//from   w  w w  . j a  v  a 2s  .  c  o m

    topLayoutContainer.addComponent(logoLayout);
    topLayoutContainer.setComponentAlignment(logoLayout, Alignment.MIDDLE_RIGHT);

    HorizontalLayout mainMenuContainer = new HorizontalLayout();
    mainMenuContainer.setWidth("780px");
    topLayoutContainer.addComponent(mainMenuContainer);
    topLayoutContainer.setComponentAlignment(mainMenuContainer, Alignment.MIDDLE_RIGHT);

    VerticalLayout layoutI = new VerticalLayout();
    mainMenuContainer.addComponent(generateMenuBtn("Home", layoutI));

    VerticalLayout layoutII = new VerticalLayout();
    mainMenuContainer.addComponent(generateMenuBtn("Programme", layoutII));

    VerticalLayout layoutIII = new VerticalLayout();
    mainMenuContainer.addComponent(generateMenuBtn("Practical Information", layoutIII));

    VerticalLayout layoutIV = new VerticalLayout();
    mainMenuContainer.addComponent(generateMenuBtn("Exhibition & Sponsorship", layoutIV));

    VerticalLayout layoutV = new VerticalLayout();
    mainMenuContainer.addComponent(generateMenuBtn("Registration", layoutV));

    VerticalLayout layoutVI = new VerticalLayout();
    mainMenuContainer.addComponent(generateMenuBtn("Contact", layoutVI));

}

From source file:no.uib.probe.mnpc_2017.view.ApplicationLayout.java

private VerticalLayout generateMenuBtn(String title, VerticalLayout targetComponent) {

    VerticalLayout btn = new VerticalLayout();
    Label btnLabel = new Label(title);
    btn.setStyleName("menubtn");
    btn.addComponent(btnLabel);/*  w ww  . ja v  a  2 s.c o  m*/
    btn.addLayoutClickListener((LayoutEvents.LayoutClickEvent event) -> {
        UI.getCurrent().scrollIntoView(targetComponent);
    });

    return btn;

}

From source file:org.accelerators.activiti.admin.ui.LoginView.java

License:Open Source License

@SuppressWarnings("serial")
public LoginView(AdminApp application) {

    // Set application reference
    this.app = application;

    // Init window caption
    app.getMainWindow().setCaption(app.getMessage(Messages.Title));

    // Set layout to full size
    setSizeFull();/*from   w w  w. ja  v a 2s  . c  o  m*/

    // Set style
    this.setStyleName("login-background");

    // Add header bar
    final HorizontalLayout header = new HorizontalLayout();
    header.setHeight("50px");
    header.setWidth("100%");
    addComponent(header);
    setComponentAlignment(header, Alignment.MIDDLE_CENTER);

    // Setup grid
    GridLayout loginGrid = new GridLayout(1, 2);
    loginGrid.setWidth("250px");
    addComponent(loginGrid);
    setComponentAlignment(loginGrid, Alignment.MIDDLE_CENTER);

    // Add title to header
    GridLayout logoGrid = new GridLayout(1, 1);
    loginGrid.addComponent(logoGrid, 0, 0);
    loginGrid.setComponentAlignment(logoGrid, Alignment.MIDDLE_CENTER);

    Embedded logoImage = new Embedded(null, new ThemeResource("img/login-logo.png"));
    logoImage.setType(Embedded.TYPE_IMAGE);
    logoImage.addStyleName("login-image");
    logoGrid.addComponent(logoImage, 0, 0);
    logoGrid.setComponentAlignment(logoImage, Alignment.MIDDLE_CENTER);

    // Add field and button layout
    VerticalLayout buttonLayout = new VerticalLayout();
    buttonLayout.setSizeFull();
    buttonLayout.setSpacing(true);
    buttonLayout.setMargin(false);
    buttonLayout.setStyleName("login-form");
    loginGrid.addComponent(buttonLayout, 0, 1);
    loginGrid.setComponentAlignment(buttonLayout, Alignment.MIDDLE_CENTER);

    // Add username field
    username = new TextField(app.getMessage(Messages.Username));
    username.setWidth("100%");
    buttonLayout.addComponent(username);

    // Add password field
    password = new PasswordField(app.getMessage(Messages.Password));
    password.setWidth("100%");
    buttonLayout.addComponent(password);

    // Add Login button
    buttonLayout.addComponent(login);
    buttonLayout.setComponentAlignment(login, Alignment.BOTTOM_RIGHT);

    // Set focus to this component
    username.focus();

    // Add shortcut to login button
    login.setClickShortcut(KeyCode.ENTER);

    login.addListener(new Button.ClickListener() {
        public void buttonClick(Button.ClickEvent event) {
            try {

                // Athenticate the user
                authenticate((String) username.getValue(), (String) password.getValue());

                // Switch to the main view
                app.getViewManager().switchScreen(MainView.class.getName(), new MainView(app));

            } catch (Exception e) {
                getWindow().showNotification(e.toString());
            }
        }
    });

    HorizontalLayout footer = new HorizontalLayout();
    footer.setHeight("50px");
    footer.setWidth("100%");
    addComponent(footer);

}

From source file:org.activiti.administrator.ui.LoginView.java

License:Apache License

@SuppressWarnings("serial")
public LoginView(AdminApp application) {

    // Set application reference
    this.app = application;

    // Init window caption
    app.getMainWindow().setCaption(app.getMessage(Messages.Title));

    // Set style//from  w  w  w . ja va  2s.co m
    setStyleName(Reindeer.LAYOUT_WHITE);

    // Set layout to full size
    setSizeFull();

    // Create main layout
    VerticalLayout mainLayout = new VerticalLayout();

    // Add layout styles
    mainLayout.setStyleName(Reindeer.LAYOUT_WHITE);
    mainLayout.setWidth("100%");
    mainLayout.setHeight("100%");
    mainLayout.setMargin(false);
    mainLayout.setSpacing(false);

    // Add layout
    addComponent(mainLayout);
    setComponentAlignment(mainLayout, Alignment.TOP_LEFT);

    // Add field and button layout
    VerticalLayout buttonLayout = new VerticalLayout();
    buttonLayout.setSpacing(true);
    buttonLayout.setMargin(true);
    buttonLayout.setWidth("200px");
    buttonLayout.setStyleName("login-form");

    // Add username field
    username = new TextField(app.getMessage(Messages.Username));
    username.setWidth("100%");
    buttonLayout.addComponent(username);

    // Add password field
    password = new PasswordField(app.getMessage(Messages.Password));
    password.setWidth("100%");
    buttonLayout.addComponent(password);

    // Add Login button
    buttonLayout.addComponent(login);
    buttonLayout.setComponentAlignment(login, Alignment.BOTTOM_LEFT);

    // Add button layout
    mainLayout.addComponent(buttonLayout);

    // Add footer text
    Label footerText = new Label(app.getMessage(Messages.Footer));
    footerText.setSizeUndefined();
    footerText.setStyleName(Reindeer.LABEL_SMALL);
    footerText.addStyleName("footer");
    mainLayout.addComponent(footerText);
    mainLayout.setComponentAlignment(footerText, Alignment.BOTTOM_CENTER);

    // Set focus to this component
    username.focus();

    // Add shortcut to login button
    login.setClickShortcut(KeyCode.ENTER);

    login.addListener(new Button.ClickListener() {

        public void buttonClick(Button.ClickEvent event) {
            try {

                // Athenticate the user
                authenticate((String) username.getValue(), (String) password.getValue());

                // Switch to the main view
                app.switchView(MainView.class.getName(), new MainView(app));

            } catch (Exception e) {
                getWindow().showNotification(e.toString());
            }
        }
    });

}