Project

General

Profile

Download (2.59 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2017 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.vaadin.component;
10

    
11
import com.vaadin.ui.Button;
12
import com.vaadin.ui.PasswordField;
13
import com.vaadin.ui.TabSheet;
14
import com.vaadin.ui.TextField;
15

    
16
import eu.etaxonomy.cdm.vaadin.design.LoginDialogDesign;
17

    
18
/**
19
 * @author a.kohlbecker
20
 * @since Apr 25, 2017
21
 *
22
 */
23
public class LoginDialog extends LoginDialogDesign {
24

    
25
    private static final long serialVersionUID = 6792455534312958806L;
26

    
27
    public LoginDialog() {
28
        addSelectedTabChangeListener(e -> focusFirstElement(e.getTabSheet()));
29
        getTab(1).setEnabled(false);
30
        getTab(2).setEnabled(false);
31
    }
32

    
33
    /**
34
     * @param tabSheet
35
     * @return
36
     */
37
    private void focusFirstElement(TabSheet tabSheet) {
38
        switch (tabSheet.getTabIndex()){
39
        case 0: // login
40
            getUserName().focus();
41
            break;
42
        case 1: // Register
43
            getUserNameSuggestion().focus();
44
            break;
45
        case 2: // Password Recovery
46
            getUserNameOrEmail().focus();
47
            break;
48
        default:
49
            // Ignore
50
            break;
51

    
52
        }
53
    }
54

    
55
    /**
56
     * @return the userName
57
     */
58
    public TextField getUserName() {
59
        return userName;
60
    }
61

    
62
    /**
63
     * @return the password
64
     */
65
    public PasswordField getPassword() {
66
        return password;
67
    }
68

    
69
    /**
70
     * @return the loginButton
71
     */
72
    public Button getLoginButton() {
73
        return loginButton;
74
    }
75

    
76
    /**
77
     * @return the cancelLoginButton
78
     */
79
    public Button getCancelLoginButton() {
80
        return cancelLoginButton;
81
    }
82

    
83
    /**
84
     * @return the userNameSuggestion
85
     */
86
    public TextField getUserNameSuggestion() {
87
        return userNameSuggestion;
88
    }
89

    
90
    /**
91
     * @return the email
92
     */
93
    public TextField getEmail() {
94
        return email;
95
    }
96

    
97
    /**
98
     * @return the registerButton
99
     */
100
    public Button getRegisterButton() {
101
        return registerButton;
102
    }
103

    
104
    /**
105
     * @return the cancelRegistrationButton
106
     */
107
    public Button getCancelRegistrationButton() {
108
        return cancelRegistrationButton;
109
    }
110

    
111
    /**
112
     * @return the userNameOrEmail
113
     */
114
    public TextField getUserNameOrEmail() {
115
        return userNameOrEmail;
116
    }
117

    
118
    /**
119
     * @return the sendOnetimeLogin
120
     */
121
    public Button getSendOnetimeLogin() {
122
        return sendOnetimeLogin;
123
    }
124

    
125

    
126
}
(5-5/6)