|
@@ -11,17 +11,14 @@ |
11 |
11 |
|
|
12 |
12 |
|
import com.google.gwt.user.client.ui.*; |
13 |
13 |
|
|
14 |
|
- |
public class NewUserEmailDialog<T extends SecurityUserView<T>> extends AbstractNewUserDialog<T> implements NewUserPhoneConfirmationDialog.CallBack |
15 |
|
- |
{ |
16 |
|
- |
public interface CallBack<T extends SecurityUserView<T>> extends DialogCloseCallBack |
17 |
|
- |
{ |
|
14 |
+ |
public class NewUserEmailDialog<T extends SecurityUserView<T>> extends AbstractNewUserDialog<T> implements NewUserPhoneConfirmationDialog.CallBack { |
|
15 |
+ |
public interface CallBack<T extends SecurityUserView<T>> extends DialogCloseCallBack { |
18 |
16 |
|
public void succeeded( String pLogonEmail, T pUserView ); |
19 |
17 |
|
} |
20 |
18 |
|
|
21 |
19 |
|
private CallBack mCallBack; |
22 |
20 |
|
|
23 |
|
- |
public NewUserEmailDialog( String pLogonEmail, String pPhoneNumber, CallBack pCallBack, QBEinputPanelAccessorFactory<T> pUserFieldsPanelFactory ) |
24 |
|
- |
{ |
|
21 |
+ |
public NewUserEmailDialog( String pLogonEmail, String pPhoneNumber, CallBack pCallBack, QBEinputPanelAccessorFactory<T> pUserFieldsPanelFactory ) { |
25 |
22 |
|
super( title( "New User" ), pLogonEmail, pPhoneNumber, null, pUserFieldsPanelFactory ); |
26 |
23 |
|
Objects.assertNotNull( "CallBack", mCallBack = pCallBack ); |
27 |
24 |
|
|
|
@@ -31,38 +28,31 @@ |
31 |
28 |
|
} |
32 |
29 |
|
|
33 |
30 |
|
@Override |
34 |
|
- |
public void aboutToShow() |
35 |
|
- |
{ |
|
31 |
+ |
public void aboutToShow() { |
36 |
32 |
|
super.aboutToShow(); |
37 |
33 |
|
mFE.initialize(); |
38 |
34 |
|
mFE.setNamedComponentValueAsUser( SecurityUserViewNames.aLogonEmail, mLogonEmail ); |
39 |
35 |
|
} |
40 |
36 |
|
|
41 |
|
- |
private Widget createLogonEmail() |
42 |
|
- |
{ |
|
37 |
+ |
private Widget createLogonEmail() { |
43 |
38 |
|
FormBinder<T> zFormBinder = new FormBinder<T>( mFE, mUserViewMetaData ); |
44 |
39 |
|
|
45 |
40 |
|
return zFormBinder.add( SecurityUserViewNames.aLogonEmail ); |
46 |
41 |
|
} |
47 |
42 |
|
|
48 |
43 |
|
@Override |
49 |
|
- |
protected void submitRequested() |
50 |
|
- |
{ |
|
44 |
+ |
protected void submitRequested() { |
51 |
45 |
|
String zLogonEmail = Strings.noEmpty( (String) mFE.getNamedComponentValue( SecurityUserViewNames.aLogonEmail ) ); |
52 |
46 |
|
|
53 |
|
- |
if ( zLogonEmail != null ) |
54 |
|
- |
{ |
55 |
|
- |
mDataProvider.validateLogonEmailAvailable( zLogonEmail, new FetchRowDataProviderCallBack<SecurityUserView>() |
56 |
|
- |
{ |
|
47 |
+ |
if ( zLogonEmail != null ) { |
|
48 |
+ |
mDataProvider.validateLogonEmailAvailable( zLogonEmail, new FetchRowDataProviderCallBack<SecurityUserView>() { |
57 |
49 |
|
@Override |
58 |
|
- |
public void error( String pError ) |
59 |
|
- |
{ |
|
50 |
+ |
public void error( String pError ) { |
60 |
51 |
|
setDialogErrorMessage( pError ); |
61 |
52 |
|
} |
62 |
53 |
|
|
63 |
54 |
|
@Override |
64 |
|
- |
public void success( SecurityUserView pRow ) |
65 |
|
- |
{ |
|
55 |
+ |
public void success( SecurityUserView pRow ) { |
66 |
56 |
|
if ( pRow == null ) // No row found, Go on to Add User |
67 |
57 |
|
{ |
68 |
58 |
|
close(); |
|
@@ -76,35 +66,31 @@ |
76 |
66 |
|
return; |
77 |
67 |
|
} |
78 |
68 |
|
mUserView = (T) pRow; |
79 |
|
- |
new DialogViewDialog( new NewUserPhoneConfirmationDialog( mLogonEmail, mPhoneNumber, mUserView, NewUserEmailDialog.this, mUserFieldsPanelFactory ) ).show(); |
|
69 |
+ |
new DialogViewDialog( |
|
70 |
+ |
new NewUserPhoneConfirmationDialog( mLogonEmail, mPhoneNumber, mUserView, NewUserEmailDialog.this, mUserFieldsPanelFactory ) ).show(); |
80 |
71 |
|
} |
81 |
72 |
|
} ); |
82 |
73 |
|
} |
83 |
74 |
|
} |
84 |
75 |
|
|
85 |
76 |
|
@Override |
86 |
|
- |
public void succeeded() |
87 |
|
- |
{ |
|
77 |
+ |
public void succeeded() { |
88 |
78 |
|
close(); |
89 |
79 |
|
mCallBack.succeeded( (String) mFE.getNamedComponentValue( SecurityUserViewNames.aLogonEmail ), mUserView ); |
90 |
80 |
|
} |
91 |
81 |
|
|
92 |
82 |
|
@Override |
93 |
|
- |
public void cancel() |
94 |
|
- |
{ |
|
83 |
+ |
public void cancel() { |
95 |
84 |
|
super.cancel(); |
96 |
85 |
|
mCallBack.dialogClosed(); |
97 |
86 |
|
} |
98 |
87 |
|
|
99 |
|
- |
protected static String cursoryEmailCheck( String pEmail, String pWhat ) |
100 |
|
- |
{ |
101 |
|
- |
try |
102 |
|
- |
{ |
|
88 |
+ |
protected static String cursoryEmailCheck( String pEmail, String pWhat ) { |
|
89 |
+ |
try { |
103 |
90 |
|
new EmailAddress( pEmail ); |
104 |
91 |
|
return null; |
105 |
92 |
|
} |
106 |
|
- |
catch ( IllegalArgumentException e ) |
107 |
|
- |
{ |
|
93 |
+ |
catch ( IllegalArgumentException e ) { |
108 |
94 |
|
return DeCamelizer.resolve( pWhat ) + " is unacceptable: " + e.getMessage(); |
109 |
95 |
|
} |
110 |
96 |
|
} |