<commit_before>package com.niafikra.meddela.ui.vaadin.login

import com.niafikra.meddela.ui.vaadin.UIManager
import com.vaadin.event.ShortcutAction
import com.vaadin.ui.*

/**
 * This is the view when requesting user to login
 *
 * Author: <NAME> <<EMAIL>>
 * Date: 7/19/12
 * Time: 4:26 PM
 */
class LoginView extends VerticalLayout implements Button.ClickListener {

    Component loginForm
    TextField userField
    PasswordField passwordField
    Button loginButton
    UIManager uiManager

    LoginView(UIManager uiManager) {
        this.uiManager = uiManager
        build()
    }

    def build() {

        loginForm = getLoginForm()
        addComponent(loginForm)
        setComponentAlignment(loginForm, Alignment.MIDDLE_CENTER)
        setSizeFull()

    }
    /**
     * Build the login Form
     * @return
     */
    def getLoginForm() {
        VerticalLayout loginForm = new VerticalLayout()
        loginForm.setWidth("400px")
        loginForm.setHeight("120px")
        loginForm.setStyleName("loginForm")
        loginForm.setSpacing(true)
        loginForm.setMargin(true)

        HorizontalLayout userBoxLay = new HorizontalLayout()
        Label userLabel = new Label("username")
        userLabel.setStyleName("loginLabel")
        userField = new TextField()
        userField.setStyleName("loginBox")
        userBoxLay.addComponent(userLabel)
        userBoxLay.addComponent(userField)
        userBoxLay.setSpacing(true)

        HorizontalLayout passBoxLay = new HorizontalLayout()
        Label passLabel = new Label("password")
        passLabel.setStyleName("loginLabel")
        passwordField = new PasswordField()
        passwordField.setStyleName("loginBox")
        passBoxLay.addComponent(passLabel)
        passBoxLay.addComponent(passwordField)
        passBoxLay.setSpacing(true)

        loginButton = new Button("login")
        loginButton.setWidth("130px")
        loginButton.setHeight("35px")
        loginButton.setStyleName("loginButton")
        loginButton.addListener(this)
        loginButton.setClickShortcut(ShortcutAction.KeyCode.ENTER)
        loginButton.addStyleName("primary")

        loginForm.addComponent(userBoxLay)
        loginForm.addComponent(passBoxLay)
        loginForm.addComponent(loginButton)
        loginForm.setComponentAlignment(loginButton, Alignment.BOTTOM_RIGHT)

        return loginForm
    }

    @Override
    void buttonClick(Button.ClickEvent event) {
        uiManager.login(userField.getValue().toString(), passwordField.getValue().toString())
    }
}<commit_msg>clear login form misallignment<commit_after>package com.niafikra.meddela.ui.vaadin.login

import com.niafikra.meddela.ui.vaadin.UIManager
import com.vaadin.event.ShortcutAction
import com.vaadin.ui.*

/**
 * This is the view when requesting user to login
 *
 * Author: <NAME> <<EMAIL>>
 * Date: 7/19/12
 * Time: 4:26 PM
 */
class LoginView extends VerticalLayout implements Button.ClickListener {

    Component loginForm
    TextField userField
    PasswordField passwordField
    Button loginButton
    UIManager uiManager

    LoginView(UIManager uiManager) {
        this.uiManager = uiManager
        build()
    }

    def build() {

        loginForm = getLoginForm()
        addComponent(loginForm)
        setComponentAlignment(loginForm, Alignment.MIDDLE_CENTER)
        setSizeFull()

    }
    /**
     * Build the login Form
     * @return
     */
    def getLoginForm() {
        VerticalLayout loginForm = new VerticalLayout()
        loginForm.setWidth("400px")
        loginForm.setHeight("140px")
        loginForm.setStyleName("loginForm")
        loginForm.setSpacing(true)
        loginForm.setMargin(true)

        HorizontalLayout userBoxLay = new HorizontalLayout()
        Label userLabel = new Label("username")
        userLabel.setStyleName("loginLabel")
        userField = new TextField()
        userField.setStyleName("loginBox")
        userBoxLay.addComponent(userLabel)
        userBoxLay.addComponent(userField)
        userBoxLay.setSpacing(true)

        HorizontalLayout passBoxLay = new HorizontalLayout()
        Label passLabel = new Label("password")
        passLabel.setStyleName("loginLabel")
        passwordField = new PasswordField()
        passwordField.setStyleName("loginBox")
        passBoxLay.addComponent(passLabel)
        passBoxLay.addComponent(passwordField)
        passBoxLay.setSpacing(true)

        loginButton = new Button("login")
        loginButton.setWidth("130px")
      //  loginButton.setHeight("35px")
      //  loginButton.setStyleName("loginButton")
        loginButton.addListener(this)
        loginButton.setClickShortcut(ShortcutAction.KeyCode.ENTER)
      //  loginButton.addStyleName("primary")

        loginForm.addComponent(userBoxLay)
        loginForm.addComponent(passBoxLay)
        loginForm.addComponent(loginButton)
        loginForm.setComponentAlignment(loginButton, Alignment.BOTTOM_RIGHT)

        return loginForm
    }

    @Override
    void buttonClick(Button.ClickEvent event) {
        uiManager.login(userField.getValue().toString(), passwordField.getValue().toString())
    }
}
{'fraction_non_alphanumeric': 0.09181093172534527, 'fraction_numerical': 0.007391558062633729, 'mean_word_length': 3.0171875, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2405549', 'n_tokens_mistral': 1506, 'n_tokens_neox': 1442, 'n_words': 251}