Subversion Repository Public Repository

litesoft

Diff Revisions 947 vs 948 for /trunk/GWT_Sandbox/Prioritizer/src/org/litesoft/prioritizer/client/Prioritizer.java

Diff revisions: vs.
  @@ -31,10 +31,8 @@
31 31 import com.google.gwt.user.client.ui.*;
32 32
33 33 public class Prioritizer extends AbstractClientMainAppEntryPoint implements ViewDefs,
34 - RestrictedResourceSwitcherCallBack
35 - {
36 - static
37 - {
34 + RestrictedResourceSwitcherCallBack {
35 + static {
38 36 UserViewAccessControlFactory.setViewDefSecuritySets( ViewDefs.SECURITY_SETS );
39 37 }
40 38
  @@ -43,7 +41,7 @@
43 41 // pull in all the factories. This can be broken out into different modules if compile becomes too slow.
44 42 private ViewManagerImpl mVM = new ViewManagerImpl( mACM, //
45 43 // Admin
46 - new ChangePasswordFactory<UserView>(HOME_SECTION_ADMIN, ADMIN_CHANGE_PASSWORD), //
44 + new ChangePasswordFactory<UserView>( HOME_SECTION_ADMIN, ADMIN_CHANGE_PASSWORD ), //
47 45 new MyProfileFactory(), //
48 46 new ReportsFactory(), //
49 47 new UsersFactory(), //
  @@ -57,8 +55,7 @@
57 55 // HOME!
58 56 new HomeFactory() );
59 57
60 - public Prioritizer()
61 - {
58 + public Prioritizer() {
62 59 super( new AppNames( "Prioritizer", "Prioritizer" ) );
63 60
64 61 // add in all the factory-less screens. This can be broken out into different modules if compile becomes too slow.
  @@ -66,8 +63,7 @@
66 63 }
67 64
68 65 @Override
69 - public void onAppLoad()
70 - {
66 + public void onAppLoad() {
71 67 System.out.println( "DevMode " + Dev.state() );
72 68
73 69 replaceAppPanel();
  @@ -77,8 +73,7 @@
77 73 CScomm.setInstance( new GwtCScomm( null, mVM, new AppInitializationCallback() ) );
78 74 }
79 75
80 - public void finishAppLoad()
81 - {
76 + public void finishAppLoad() {
82 77 ClientContext zContext = ClientContext.get();
83 78
84 79 Dev.init( zContext );
  @@ -93,20 +88,25 @@
93 88
94 89 UserViewDataProvider zUserViewDataProvider = UserViewDataProvider.getInstance();
95 90
96 - RestrictedResourcePickerDialogViewFactory zRRPDF = new RestrictedResourcePickerDialogFactory<RestrictedResourceView>( "Select Queue", RestrictedResourceViewDataProvider.getInstance(), RestrictedResourceViewMetaData.getInstance(), new RestrictedResourceViewSupportFactory<RestrictedResourceView>()
97 - {
98 - @Override
99 - public TableDataReloadable createTable( FilteringTableModel<RestrictedResourceView> pFilter, TableClickCommand<RestrictedResourceView> pRestrictedResourceViewTableClickCommand )
100 - {
101 - return new RestrictedResourceViewTable( pFilter, pRestrictedResourceViewTableClickCommand );
102 - }
103 -
104 - @Override
105 - public QBEinputPanelAccessorWithCtrlMap<RestrictedResourceView> createFieldPanel()
106 - {
107 - return new RestrictedResourcePickerFieldsPanel();
108 - }
109 - } );
91 + RestrictedResourcePickerDialogViewFactory zRRPDF =
92 + new RestrictedResourcePickerDialogFactory<RestrictedResourceView>( "Select Queue", RestrictedResourceViewDataProvider.getInstance(),
93 + RestrictedResourceViewMetaData.getInstance(),
94 + new RestrictedResourceViewSupportFactory<RestrictedResourceView>() {
95 + @Override
96 + public TableDataReloadable createTable(
97 + FilteringTableModel<RestrictedResourceView> pFilter,
98 + TableClickCommand<RestrictedResourceView>
99 + pRestrictedResourceViewTableClickCommand ) {
100 + return new RestrictedResourceViewTable( pFilter,
101 + pRestrictedResourceViewTableClickCommand );
102 + }
103 +
104 + @Override
105 + public QBEinputPanelAccessorWithCtrlMap<RestrictedResourceView>
106 + createFieldPanel() {
107 + return new RestrictedResourcePickerFieldsPanel();
108 + }
109 + } );
110 110
111 111 zContext.set( CurrentRestrictedResourceViewAccessor.class, zCSA );
112 112 zContext.set( AbstractCurrentRestrictedResourceViewAccessor.class, zCSA );
  @@ -144,26 +144,20 @@
144 144 zAppPanel.setInfoMessage( "Hello" );
145 145 }
146 146
147 - protected void initializeLoggerFactory()
148 - {
147 + protected void initializeLoggerFactory() {
149 148 //noinspection NonJREEmulationClassesInClientCode
150 149 LoggerFactory.init( new ConfigurationLoggerLevel(), BrowserAsLogSyncFactory.INSTANCE );
151 150 }
152 151
153 - private class AppInitializationCallback implements AsyncCallback<AppInitializationResult>
154 - {
152 + private class AppInitializationCallback implements AsyncCallback<AppInitializationResult> {
155 153 @Override
156 - public void onFailure( Throwable pThrowable )
157 - {
154 + public void onFailure( Throwable pThrowable ) {
158 155 String message;
159 156
160 - if ( pThrowable instanceof InvocationException )
161 - {
157 + if ( pThrowable instanceof InvocationException ) {
162 158 // see javadoc for InvocationException
163 159 message = "A connection could not be established with the server";
164 - }
165 - else if ( pThrowable instanceof IncompatibleRemoteServiceException )
166 - {
160 + } else if ( pThrowable instanceof IncompatibleRemoteServiceException ) {
167 161 /*
168 162 * This _should_ not happen to users, so long as the .nocache
169 163 * file isn't cached by the client.
  @@ -171,9 +165,7 @@
171 165 message = "Client and server versions are incompatible. Try ctrl-clicking\n" + //
172 166 "or shift-clicking the browser refresh button, or clearing your\n" + //
173 167 "browser's cache in 'Internet Options' / your browser's preferences. ";
174 - }
175 - else
176 - {
168 + } else {
177 169 // probably an application-specific execption on the server
178 170 message = "An application error occured on the server";
179 171 }
  @@ -182,18 +174,15 @@
182 174 }
183 175
184 176 @Override
185 - public void onSuccess( AppInitializationResult result )
186 - {
177 + public void onSuccess( AppInitializationResult result ) {
187 178 System.err.println( new UtilDateAdaptor() + " | Client AppInitialization" );
188 179
189 - if ( result == null )
190 - {
180 + if ( result == null ) {
191 181 UtilsGwt.closeWindowNoConfirm( 5 );
192 182 return;
193 183 }
194 184
195 - try
196 - {
185 + try {
197 186 new ClientConfiguration( result.getClientConfig() ); // This line must preceed the next
198 187 initializeLoggerFactory(); // ......................... This line must follow the previous
199 188
  @@ -201,14 +190,12 @@
201 190
202 191 finishAppLoad();
203 192 }
204 - catch ( RuntimeException e )
205 - {
193 + catch ( RuntimeException e ) {
206 194 reportFailure( e, "onSuccess()", null );
207 195 }
208 196 }
209 197
210 - private void reportFailure( Throwable pThrowable, String method, String message )
211 - {
198 + private void reportFailure( Throwable pThrowable, String method, String message ) {
212 199 pThrowable.printStackTrace(); // prints the trace in the GWT hosted shell
213 200 String html = "<h1>Application Initialization Failed</h1>" + //
214 201 "<p>" + message + "</p>" + //
  @@ -219,16 +206,12 @@
219 206 }
220 207 }
221 208
222 - private static class NextDemoUserRequestHandlerImpl implements NextDemoUserRequestHandler
223 - {
209 + private static class NextDemoUserRequestHandlerImpl implements NextDemoUserRequestHandler {
224 210 @Override
225 - public void nextDemoUser()
226 - {
227 - UserViewDataProvider.getInstance().nextDemoUser( new SimpleDataProviderCallBack()
228 - {
211 + public void nextDemoUser() {
212 + UserViewDataProvider.getInstance().nextDemoUser( new SimpleDataProviderCallBack() {
229 213 @Override
230 - public void error( String pError )
231 - {
214 + public void error( String pError ) {
232 215 new ShowScreenCommand( ViewDefs.HOME, pError ).execute();
233 216 }
234 217 } );
  @@ -236,18 +219,13 @@
236 219 }
237 220
238 221 @Override
239 - public void switchToRestrictedResource( AlternateRestrictedResourceOption pAlternateOption )
240 - {
241 - UserViewDataProvider.getInstance().attemptSwitchToRestrictedResource( (RestrictedResourceView) pAlternateOption, new SimpleDataProviderCallBack()
242 - {
222 + public void switchToRestrictedResource( AlternateRestrictedResourceOption pAlternateOption ) {
223 + UserViewDataProvider.getInstance().attemptSwitchToRestrictedResource( (RestrictedResourceView) pAlternateOption, new SimpleDataProviderCallBack() {
243 224 @Override
244 - public void error( String pError )
245 - {
246 - if ( Strings.isNullOrEmpty( pError ) )
247 - {
225 + public void error( String pError ) {
226 + if ( Strings.isNullOrEmpty( pError ) ) {
248 227 PageRefreshableProxy zRefreshableProxy = ClientContext.get().checkGet( PageRefreshableProxy.class );
249 - if ( zRefreshableProxy != null )
250 - {
228 + if ( zRefreshableProxy != null ) {
251 229 zRefreshableProxy.refreshPage();
252 230 return;
253 231 }