@@ -0,0 +1,3669 @@
+/*%0A * Copyright 2015 Ryan Gilera.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.github.daytron.revworks.ui;%0A%0Aimport com.github.daytron.revworks.authentication.AccessControl;%0Aimport com.github.daytron.revworks.behaviour.login.AdminLoginButtonListener;%0Aimport com.github.daytron.revworks.behaviour.validator.LoginValidatorFactory;%0Aimport com.github.daytron.revworks.data.LoginString;%0Aimport com.github.daytron.revworks.data.LoginValidationNum;%0Aimport com.vaadin.event.ShortcutAction;%0Aimport com.vaadin.ui.Button;%0Aimport com.vaadin.ui.FormLayout;%0Aimport com.vaadin.ui.Label;%0Aimport com.vaadin.ui.PasswordField;%0Aimport com.vaadin.ui.TextField;%0Aimport com.vaadin.ui.VerticalLayout;%0Aimport com.vaadin.ui.Window;%0Aimport com.vaadin.ui.themes.ValoTheme;%0A%0A/**%0A * The popup modal window for Admin login form.%0A *%0A * @author Ryan Gilera%0A */%0Apublic final class AdminLoginPopup extends Window %7B%0A    private static final long serialVersionUID = 1L;%0A    %0A    public AdminLoginPopup(AccessControl uac) %7B%0A        super(LoginString.FORM_ADMIN_WINDOW_LABEL.getText()); // Window label%0A%0A        VerticalLayout popupLayout = new VerticalLayout();%0A        popupLayout.setMargin(true);%0A        popupLayout.setSizeUndefined();%0A        %0A        setSizeUndefined();%0A        setContent(popupLayout);%0A        %0A        setClosable(true);%0A        setModal(true);%0A        %0A        final Label welcomeLabel = new Label();%0A        welcomeLabel.setCaption(LoginString.FORM_ADMIN_LABEL.getText());%0A        %0A        popupLayout.addComponent(welcomeLabel);%0A        popupLayout.addComponent(buildLoginForm(uac));%0A    %7D%0A%0A    /**%0A     * Creates the admin login form.%0A     *%0A     * @return A FormLayout object%0A     */%0A    private FormLayout buildLoginForm(AccessControl uac) %7B%0A%0A        // Username field%0A        TextField userField = new TextField(%0A                LoginString.FORM_ADMIN_EMAIL.getText());%0A        userField.setWidth(15, UNITS_EM);%0A        userField.setMaxLength(%0A                LoginValidationNum.EMAIL_MAX_LENGTH.getValue());%0A        userField.addValidator(%0A                LoginValidatorFactory.buildEmailValidator());%0A        userField.setValidationVisible(false);%0A%0A        // Password field%0A        PasswordField passwordField = new PasswordField(%0A                LoginString.FORM_USER_PASSWORD.getText());%0A        passwordField.setWidth(15, UNITS_EM);%0A        passwordField.setMaxLength(%0A                LoginValidationNum.PASSWORD_MAX_LENGTH.getValue());%0A        passwordField.addValidator(%0A                LoginValidatorFactory.buildPasswordLengthValidator());%0A        passwordField.setValidationVisible(false);%0A%0A        // Login Button%0A        Button loginButton = new Button(%0A                LoginString.FORM_LOGIN_BUTTON.getText());%0A        loginButton.setClickShortcut(ShortcutAction.KeyCode.ENTER);%0A        loginButton.addStyleName(ValoTheme.BUTTON_FRIENDLY);%0A        loginButton.addClickListener(new AdminLoginButtonListener(%0A                userField, passwordField, uac));%0A        %0A        final FormLayout loginFormLayout = new FormLayout(userField, passwordField,%0A                loginButton);%0A        %0A        return loginFormLayout;%0A    %7D%0A    %0A%7D%0A

Create Admin login popup modal window