Project

General

Profile

Download (2.73 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.Label;
13
import com.vaadin.ui.PasswordField;
14
import com.vaadin.ui.TabSheet;
15
import com.vaadin.ui.TextField;
16

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

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

    
26
    private static final long serialVersionUID = 6792455534312958806L;
27

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

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

    
54
        }
55
    }
56

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

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

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

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

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

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

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

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

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

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

    
127
    public Label getMessageLabel() {
128
        return message;
129
    }
130

    
131

    
132
}
(6-6/8)