Subversion Repository Public Repository

litesoft

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
package org.litesoft.GWT.client.view;

import org.litesoft.GWT.client.*;
import org.litesoft.GWT.client.widgets.*;
import org.litesoft.GWT.forms.client.*;
import org.litesoft.bo.views.*;
import org.litesoft.core.typeutils.*;
import org.litesoft.core.util.*;
import org.litesoft.security.*;

import com.google.gwt.user.client.ui.*;

public class NewUserEmailDialog<T extends SecurityUserView<T>> extends AbstractNewUserDialog<T> implements NewUserPhoneConfirmationDialog.CallBack
{
    public interface CallBack<T extends SecurityUserView<T>> extends DialogCloseCallBack
    {
        public void succeeded( String pLogonEmail, T pUserView );
    }

    private CallBack mCallBack;

    public NewUserEmailDialog( String pLogonEmail, String pPhoneNumber, CallBack pCallBack, QBEinputPanelAccessorFactory<T> pUserFieldsPanelFactory )
    {
        super( title( "New User" ), pLogonEmail, pPhoneNumber, null, pUserFieldsPanelFactory );
        Objects.assertNotNull( "CallBack", mCallBack = pCallBack );

        add( new SizeableSpacer( 5 ).stretchable() );
        add( createLogonEmail() );
        add( new SizeableSpacer( 5 ).stretchable() );
    }

    @Override
    public void aboutToShow()
    {
        super.aboutToShow();
        mFE.initialize();
        mFE.setNamedComponentValueAsUser( SecurityUserViewNames.aLogonEmail, mLogonEmail );
    }

    private Widget createLogonEmail()
    {
        FormBinder<T> zFormBinder = new FormBinder<T>( mFE, mUserViewMetaData );

        return zFormBinder.add( SecurityUserViewNames.aLogonEmail );
    }

    @Override
    protected void submitRequested()
    {
        String zLogonEmail = Strings.noEmpty( (String) mFE.getNamedComponentValue( SecurityUserViewNames.aLogonEmail ) );

        if ( zLogonEmail != null )
        {
            mDataProvider.validateLogonEmailAvailable( zLogonEmail, new FetchRowDataProviderCallBack<SecurityUserView>()
            {
                @Override
                public void error( String pError )
                {
                    setDialogErrorMessage( pError );
                }

                @Override
                public void success( SecurityUserView pRow )
                {
                    if ( pRow == null ) // No row found, Go on to Add User
                    {
                        close();
                        mCallBack.succeeded( (String) mFE.getNamedComponentValue( SecurityUserViewNames.aLogonEmail ), null );
                        return;
                    }
                    if ( mPhoneNumber.equals( pRow.getPhoneNumber() ) )  // User found with same Logon & same entered PhoneNumber: Go on to Add User
                    {
                        close();
                        mCallBack.succeeded( (String) mFE.getNamedComponentValue( SecurityUserViewNames.aLogonEmail ), pRow );
                        return;
                    }
                    mUserView = (T) pRow;
                    new DialogViewDialog( new NewUserPhoneConfirmationDialog( mLogonEmail, mPhoneNumber, mUserView, NewUserEmailDialog.this, mUserFieldsPanelFactory ) ).show();
                }
            } );
        }
    }

    @Override
    public void succeeded()
    {
        close();
        mCallBack.succeeded( (String) mFE.getNamedComponentValue( SecurityUserViewNames.aLogonEmail ), mUserView );
    }

    @Override
    public void cancel()
    {
        super.cancel();
        mCallBack.dialogClosed();
    }

    protected static String cursoryEmailCheck( String pEmail, String pWhat )
    {
        try
        {
            new EmailAddress( pEmail );
            return null;
        }
        catch ( IllegalArgumentException e )
        {
            return DeCamelizer.resolve( pWhat ) + " is unacceptable: " + e.getMessage();
        }
    }
}

Commits for litesoft/trunk/Java/GWT/Client/src/org/litesoft/GWT/client/view/NewUserEmailDialog.java

Diff revisions: vs.
Revision Author Commited Message
804 Diff Diff GeorgeS picture GeorgeS Wed 15 Aug, 2012 12:48:51 +0000
801 Diff Diff GeorgeS picture GeorgeS Wed 15 Aug, 2012 03:59:02 +0000
487 Diff Diff GeorgeS picture GeorgeS Thu 08 Sep, 2011 12:06:30 +0000

More elimination of uniqueness

486 Diff Diff GeorgeS picture GeorgeS Tue 06 Sep, 2011 03:00:59 +0000
480 Diff Diff GeorgeS picture GeorgeS Sun 04 Sep, 2011 02:38:20 +0000

Progress on common User Support...

398 GeorgeS picture GeorgeS Mon 15 Aug, 2011 19:57:47 +0000