|
@@ -18,16 +18,13 @@ |
18 |
18 |
|
import static org.litesoft.uispecification.FormWidgetAspectCtrl.*; |
19 |
19 |
|
import static org.litesoft.uispecification.FormWidgetCtrl.*; |
20 |
20 |
|
|
21 |
|
- |
public class SuspendDialogFactory<T extends SecurityUserView<T>> implements SuspendDialogViewFactory |
22 |
|
- |
{ |
|
21 |
+ |
public class SuspendDialogFactory<T extends SecurityUserView<T>> implements SuspendDialogViewFactory { |
23 |
22 |
|
@Override |
24 |
|
- |
public DialogView createDialog( LogoutCallBack pCallBack ) |
25 |
|
- |
{ |
|
23 |
+ |
public DialogView createDialog( LogoutCallBack pCallBack ) { |
26 |
24 |
|
return new SuspendDialog<T>( pCallBack ); |
27 |
25 |
|
} |
28 |
26 |
|
|
29 |
|
- |
private static class SuspendDialog<T extends SecurityUserView<T>> extends DialogView implements SecurityUserViewNames |
30 |
|
- |
{ |
|
27 |
+ |
private static class SuspendDialog<T extends SecurityUserView<T>> extends DialogView implements SecurityUserViewNames { |
31 |
28 |
|
private FormEngine mFE; |
32 |
29 |
|
|
33 |
30 |
|
private SecurityUserViewDataProvider<T> mDataProvider; |
|
@@ -36,8 +33,7 @@ |
36 |
33 |
|
|
37 |
34 |
|
private LogoutCallBack mLogoutCallBack; |
38 |
35 |
|
|
39 |
|
- |
public SuspendDialog( LogoutCallBack pLogoutCallBack ) |
40 |
|
- |
{ |
|
36 |
+ |
public SuspendDialog( LogoutCallBack pLogoutCallBack ) { |
41 |
37 |
|
super( null, Opaqueness.Full ); |
42 |
38 |
|
Objects.assertNotNull( "LogoutCallBack", mLogoutCallBack = pLogoutCallBack ); |
43 |
39 |
|
|
|
@@ -55,22 +51,18 @@ |
55 |
51 |
|
zWidgetCtrlMap.add( VISIBLE_BUT_DISABLED, aLogonEmail ); |
56 |
52 |
|
zWidgetCtrlMap.add( Visible( Yes ).enable( Edit ).required(), aCurrentPassword ); |
57 |
53 |
|
|
58 |
|
- |
mFE = new FormEngine( zWidgetCtrlMap, FormEngine.Mode.EditRegular, null ) |
59 |
|
- |
{ |
60 |
|
- |
@Override protected void changeOccurredOn( String pName, IFormComponent pComponent, boolean pChanged ) |
61 |
|
- |
{ |
|
54 |
+ |
mFE = new FormEngine( zWidgetCtrlMap, FormEngine.Mode.EditRegular, null ) { |
|
55 |
+ |
@Override |
|
56 |
+ |
protected void changeOccurredOn( String pName, IFormComponent pComponent, boolean pChanged ) { |
62 |
57 |
|
super.changeOccurredOn( pName, pComponent, pChanged ); |
63 |
58 |
|
setDialogErrorMessage( null ); |
64 |
59 |
|
} |
65 |
60 |
|
|
66 |
|
- |
@Override protected void enterPressedOn( String pName, IFormComponent pComponent, KeyboardKeyModifier pModifiers ) |
67 |
|
- |
{ |
68 |
|
- |
if ( pName.equals( aCurrentPassword ) && (mSubmitButton != null) && mSubmitButton.isEnabled() ) |
69 |
|
- |
{ |
|
61 |
+ |
@Override |
|
62 |
+ |
protected void enterPressedOn( String pName, IFormComponent pComponent, KeyboardKeyModifier pModifiers ) { |
|
63 |
+ |
if ( pName.equals( aCurrentPassword ) && (mSubmitButton != null) && mSubmitButton.isEnabled() ) { |
70 |
64 |
|
submitRequested(); |
71 |
|
- |
} |
72 |
|
- |
else |
73 |
|
- |
{ |
|
65 |
+ |
} else { |
74 |
66 |
|
super.enterPressedOn( pName, pComponent, pModifiers ); |
75 |
67 |
|
} |
76 |
68 |
|
} |
|
@@ -86,13 +78,11 @@ |
86 |
78 |
|
} |
87 |
79 |
|
|
88 |
80 |
|
@Override |
89 |
|
- |
public boolean isCancelable() |
90 |
|
- |
{ |
|
81 |
+ |
public boolean isCancelable() { |
91 |
82 |
|
return false; |
92 |
83 |
|
} |
93 |
84 |
|
|
94 |
|
- |
private Widget createLogonAndCurrentPassword() |
95 |
|
- |
{ |
|
85 |
+ |
private Widget createLogonAndCurrentPassword() { |
96 |
86 |
|
SizeableHorizontalPanel zPanel = new SizeableHorizontalPanel().stretchableHorizontally(); |
97 |
87 |
|
zPanel.add( mFormBinder.add( aLogonEmail, 0, LOGON ) ); |
98 |
88 |
|
zPanel.add( mFormBinder.add( aCurrentPassword, PASSWORD_LENGTH, PASSWORD ) ); |
|
@@ -100,14 +90,11 @@ |
100 |
90 |
|
} |
101 |
91 |
|
|
102 |
92 |
|
@Override |
103 |
|
- |
public Widget getBottomBar() |
104 |
|
- |
{ |
|
93 |
+ |
public Widget getBottomBar() { |
105 |
94 |
|
LeftCenterRightHorizontalPanel zActionPanel = new LeftCenterRightHorizontalPanel(); |
106 |
|
- |
zActionPanel.addLeft( LogoutRedButton.factory().add( new ClickHandler() |
107 |
|
- |
{ |
|
95 |
+ |
zActionPanel.addLeft( LogoutRedButton.factory().add( new ClickHandler() { |
108 |
96 |
|
@Override |
109 |
|
- |
public void onClick( ClickEvent event ) |
110 |
|
- |
{ |
|
97 |
+ |
public void onClick( ClickEvent event ) { |
111 |
98 |
|
logoutRequested(); |
112 |
99 |
|
} |
113 |
100 |
|
} ).create() ); |
|
@@ -116,47 +103,36 @@ |
116 |
103 |
|
} |
117 |
104 |
|
|
118 |
105 |
|
@Override |
119 |
|
- |
public void aboutToShow() |
120 |
|
- |
{ |
|
106 |
+ |
public void aboutToShow() { |
121 |
107 |
|
super.aboutToShow(); |
122 |
108 |
|
mFE.initialize(); |
123 |
109 |
|
} |
124 |
110 |
|
|
125 |
111 |
|
@Override |
126 |
|
- |
protected void justLoaded() |
127 |
|
- |
{ |
|
112 |
+ |
protected void justLoaded() { |
128 |
113 |
|
super.justLoaded(); |
129 |
114 |
|
mFE.setFocus(); |
130 |
115 |
|
} |
131 |
116 |
|
|
132 |
|
- |
private void logoutRequested() |
133 |
|
- |
{ |
|
117 |
+ |
private void logoutRequested() { |
134 |
118 |
|
close(); |
135 |
|
- |
Scheduler.get().scheduleDeferred( new Command() |
136 |
|
- |
{ |
|
119 |
+ |
Scheduler.get().scheduleDeferred( new Command() { |
137 |
120 |
|
@Override |
138 |
|
- |
public void execute() |
139 |
|
- |
{ |
|
121 |
+ |
public void execute() { |
140 |
122 |
|
mLogoutCallBack.logoutConfirmed(); |
141 |
123 |
|
} |
142 |
124 |
|
} ); |
143 |
125 |
|
} |
144 |
126 |
|
|
145 |
127 |
|
@Override |
146 |
|
- |
protected void submitRequested() |
147 |
|
- |
{ |
|
128 |
+ |
protected void submitRequested() { |
148 |
129 |
|
mFormBinder.commitForm(); |
149 |
|
- |
mDataProvider.validatePassword( mFormBinder.getObject(), new SimpleDataProviderCallBack() |
150 |
|
- |
{ |
|
130 |
+ |
mDataProvider.validatePassword( mFormBinder.getObject(), new SimpleDataProviderCallBack() { |
151 |
131 |
|
@Override |
152 |
|
- |
public void error( String pError ) |
153 |
|
- |
{ |
154 |
|
- |
if ( Strings.isNotNullOrEmpty( pError ) ) |
155 |
|
- |
{ |
|
132 |
+ |
public void error( String pError ) { |
|
133 |
+ |
if ( Strings.isNotNullOrEmpty( pError ) ) { |
156 |
134 |
|
setDialogErrorMessage( pError ); |
157 |
|
- |
} |
158 |
|
- |
else |
159 |
|
- |
{ |
|
135 |
+ |
} else { |
160 |
136 |
|
close(); |
161 |
137 |
|
} |
162 |
138 |
|
} |