litesoft
@ 486
litesoft / trunk / GWT_Sandbox / Prioritizer / src / org / litesoft / prioritizer / client / ui / views / AbstractPrioritizerscreenView.java
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 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
package org.litesoft.prioritizer.client.ui.views; import org.litesoft.GWT.client.*; import org.litesoft.GWT.client.command.*; import org.litesoft.GWT.client.view.*; import org.litesoft.core.*; import org.litesoft.prioritizer.client.*; import org.litesoft.prioritizer.client.boviews.*; import org.litesoft.uispecification.*; import com.google.gwt.event.dom.client.*; import com.google.gwt.user.client.*; import static org.litesoft.uispecification.FormWidgetCtrl.*; public abstract class AbstractPrioritizerscreenView extends ScreenView implements LogoutCallBack, SuspendCallBack { protected AbstractPrioritizerscreenView() { super(); } protected AbstractPrioritizerscreenView( String pSection, ViewDef pViewDef ) { super( pSection, pViewDef ); } protected AbstractPrioritizerscreenView( String pSection, String pViewSubTitle ) { super( pSection, pViewSubTitle ); } protected void addStandardTitleBar() { styleTitleBar(); addHome(); addLogout(); } protected void addLogout() { addLogout( new ClickHandler() { @Override public void onClick( ClickEvent event ) { logoutButtonClicked(); } } ); } protected void logoutButtonClicked() { if ( UtilsGwt.wasAltKeyDownOnCurrentEvent() ) { switchUserRequested(); } else { logoutRequested(); } } protected void switchUserRequested() { new DialogViewDialog( ClientContext.get().get( LoginDialogViewFactory.class ).createDialog( true, createLoginOnSuccessCommand() ) ).show(); } private Command createLoginOnSuccessCommand() { return new Command() { @Override public void execute() { refreshPage(); } }; } @Override public void refreshPage() { if ( mViewDef == null ) { new ShowScreenCommand( ViewDefs.HOME ).execute(); } else { new ShowScreenCommand( mViewDef, createRefreshParams() ).execute(); } } abstract protected UriFragmentIdParams createRefreshParams(); protected void logoutRequested() { new LogoutSuspendDialog( this, this ).show(); } @Override public void logoutConfirmed() { UserViewDataProvider.getInstance().logoutUser(); new ShowScreenCommand( ViewDefs.HOME ).execute(); } @Override public void suspendRequested() { new DialogViewDialog( new SuspendDialog<UserView>( this ) ).show(); } protected FormWidgetCtrl userViewable( boolean pFlag ) { return pFlag ? VISIBLE_BUT_DISABLED : HIDDEN; } protected FormWidgetCtrl userEditable( boolean pFlag ) { return pFlag ? EDIT_ONLY : HIDDEN; } } |