Project

General

Profile

Download (2.52 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
    }
30

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

    
50
        }
51
    }
52

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

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

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

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

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

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

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

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

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

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

    
123

    
124
}
(5-5/6)