|
@@ -1,13 +1,8 @@ |
1 |
1 |
|
package org.litesoft.GWT.client.view; |
2 |
2 |
|
|
3 |
|
- |
import org.litesoft.GWT.client.*; |
4 |
|
- |
import org.litesoft.GWT.client.context.*; |
5 |
3 |
|
import org.litesoft.GWT.client.widgets.*; |
6 |
|
- |
import org.litesoft.GWT.forms.client.*; |
7 |
|
- |
import org.litesoft.GWT.forms.client.components.*; |
8 |
4 |
|
import org.litesoft.bo.views.*; |
9 |
5 |
|
import org.litesoft.commonfoundation.base.*; |
10 |
|
- |
import org.litesoft.commonfoundation.independence.*; |
11 |
6 |
|
import org.litesoft.security.*; |
12 |
7 |
|
|
13 |
8 |
|
import com.google.gwt.core.client.*; |
|
@@ -25,53 +20,35 @@ |
25 |
20 |
|
} |
26 |
21 |
|
|
27 |
22 |
|
private static class SuspendDialog<T extends SecurityUserView<T>> extends AbstractSecurityDialogView<T> implements SecurityUserViewNames { |
28 |
|
- |
private FormBinder<T> mFormBinder; |
29 |
|
- |
private ButtonBase mSubmitButton; |
30 |
|
- |
|
31 |
|
- |
private LogoutCallBack mLogoutCallBack; |
|
23 |
+ |
private final LogoutCallBack mLogoutCallBack; |
32 |
24 |
|
|
33 |
25 |
|
public SuspendDialog( LogoutCallBack pLogoutCallBack ) { |
34 |
|
- |
super( null, Opaqueness.Full ); |
35 |
|
- |
Confirm.isNotNull( "LogoutCallBack", mLogoutCallBack = pLogoutCallBack ); |
36 |
|
- |
|
37 |
|
- |
T zUser = Cast.it( Instance.of( AbstractCurrentUserViewAccessor.class ).getUser() ); |
|
26 |
+ |
super( null, Opaqueness.Full, true ); |
|
27 |
+ |
mLogoutCallBack = Confirm.isNotNull( "LogoutCallBack", pLogoutCallBack ); |
38 |
28 |
|
|
39 |
|
- |
setViewTitle( "Locked by " + zUser ); |
|
29 |
+ |
centerContent(); |
40 |
30 |
|
|
41 |
|
- |
WidgetCtrlMap zWidgetCtrlMap = new WidgetCtrlMap( VISIBLE_AND_ACTIVE_ENABLED ); |
42 |
|
- |
|
43 |
|
- |
zWidgetCtrlMap.add( VISIBLE_BUT_DISABLED, aLogonEmail ); |
44 |
|
- |
zWidgetCtrlMap.add( Visible( Yes ).enable( Edit ).required(), aCurrentPassword ); |
45 |
|
- |
|
46 |
|
- |
mFE = new FormEngine( zWidgetCtrlMap, FormEngine.Mode.EditRegular, null ) { |
47 |
|
- |
@Override |
48 |
|
- |
protected void changeOccurredOn( String pName, IFormComponent pComponent, boolean pChanged ) { |
49 |
|
- |
super.changeOccurredOn( pName, pComponent, pChanged ); |
50 |
|
- |
setDialogErrorMessage( null ); |
51 |
|
- |
} |
52 |
|
- |
|
53 |
|
- |
@Override |
54 |
|
- |
protected void enterPressedOn( String pName, IFormComponent pComponent, KeyboardKeyModifier pModifiers ) { |
55 |
|
- |
if ( pName.equals( aCurrentPassword ) && (mSubmitButton != null) && mSubmitButton.isEnabled() ) { |
56 |
|
- |
submitRequested(); |
57 |
|
- |
} else { |
58 |
|
- |
super.enterPressedOn( pName, pComponent, pModifiers ); |
59 |
|
- |
} |
60 |
|
- |
} |
61 |
|
- |
}; |
62 |
|
- |
mFormBinder = new FormBinder<T>( mFE, mUserViewMetaData ); |
63 |
|
- |
|
64 |
|
- |
mContent.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_CENTER ); |
|
31 |
+ |
initializeFormInfrastructure( null ) |
|
32 |
+ |
.add( VISIBLE_BUT_DISABLED, aLogonEmail ) |
|
33 |
+ |
.add( Visible( Yes ).enable( Edit ).required(), aCurrentPassword ); |
65 |
34 |
|
|
66 |
35 |
|
add( createLogonAndCurrentPassword() ); |
67 |
36 |
|
add( new SizeableSpacer( 5 ).stretchable() ); |
68 |
37 |
|
|
69 |
|
- |
mFormBinder.setExistingObject( mDataProvider.copyIntoNewTS( zUser ), FormEngine.Mode.EditRegular ); |
|
38 |
+ |
T zUser = getUserView(); |
|
39 |
+ |
|
|
40 |
+ |
setViewTitle( "Locked by " + zUser ); |
|
41 |
+ |
|
|
42 |
+ |
setEditUser( mDataProvider.copyIntoNewTS( zUser ) ); |
70 |
43 |
|
} |
71 |
44 |
|
|
72 |
45 |
|
@Override |
73 |
|
- |
public boolean isCancelable() { |
74 |
|
- |
return false; |
|
46 |
+ |
protected boolean processEnterPressedOn( String pName ) { |
|
47 |
+ |
if ( pName.equals( aCurrentPassword ) && (mSubmitButton != null) && mSubmitButton.isEnabled() ) { |
|
48 |
+ |
submitRequested(); |
|
49 |
+ |
return false; |
|
50 |
+ |
} |
|
51 |
+ |
return true; |
75 |
52 |
|
} |
76 |
53 |
|
|
77 |
54 |
|
private Widget createLogonAndCurrentPassword() { |
|
@@ -82,28 +59,18 @@ |
82 |
59 |
|
} |
83 |
60 |
|
|
84 |
61 |
|
@Override |
85 |
|
- |
public Widget getBottomBar() { |
86 |
|
- |
LeftCenterRightHorizontalPanel zActionPanel = new LeftCenterRightHorizontalPanel(); |
87 |
|
- |
zActionPanel.addLeft( LogoutRedButton.factory().add( new ClickHandler() { |
|
62 |
+ |
protected ButtonBase createLeftButton() { |
|
63 |
+ |
return LogoutRedButton.factory().add( new ClickHandler() { |
88 |
64 |
|
@Override |
89 |
65 |
|
public void onClick( ClickEvent event ) { |
90 |
66 |
|
logoutRequested(); |
91 |
67 |
|
} |
92 |
|
- |
} ).create() ); |
93 |
|
- |
zActionPanel.addRight( mFE.addEditSubmitButton( mSubmitButton = UnlockButton.factory().add( createSubmitClickHandler() ).create() ) ); |
94 |
|
- |
return zActionPanel; |
95 |
|
- |
} |
96 |
|
- |
|
97 |
|
- |
@Override |
98 |
|
- |
public void aboutToShow() { |
99 |
|
- |
super.aboutToShow(); |
100 |
|
- |
mFE.initialize(); |
|
68 |
+ |
} ).create(); |
101 |
69 |
|
} |
102 |
70 |
|
|
103 |
71 |
|
@Override |
104 |
|
- |
protected void justLoaded() { |
105 |
|
- |
super.justLoaded(); |
106 |
|
- |
mFE.setFocus(); |
|
72 |
+ |
protected ButtonBase createSubmitButton() { |
|
73 |
+ |
return UnlockButton.factory().add( createSubmitClickHandler() ).create(); |
107 |
74 |
|
} |
108 |
75 |
|
|
109 |
76 |
|
private void logoutRequested() { |