Subversion Repository Public Repository

litesoft

Diff Revisions 947 vs 948 for /trunk/GWT_Sandbox/InitFrom/src/org/litesoft/initfrom/client/InitFrom.java

Diff revisions: vs.
  @@ -27,8 +27,7 @@
27 27 import com.google.gwt.user.client.ui.*;
28 28
29 29 public class InitFrom extends AbstractClientMainAppEntryPoint implements ViewDefs,
30 - RestrictedResourceSwitcherCallBack
31 - {
30 + RestrictedResourceSwitcherCallBack {
32 31 private VACMproxy mACM = new VACMproxy();
33 32
34 33 // pull in all the factories. This can be broken out into different modules if compile becomes too slow.
  @@ -45,8 +44,7 @@
45 44 // HOME!
46 45 new HomeFactory() );
47 46
48 - public InitFrom()
49 - {
47 + public InitFrom() {
50 48 super( new AppNames( "InitFrom", "InitFrom" ) );
51 49
52 50 // add in all the factory-less screens. This can be broken out into different modules if compile becomes too slow.
  @@ -54,8 +52,7 @@
54 52 }
55 53
56 54 @Override
57 - public void onAppLoad()
58 - {
55 + public void onAppLoad() {
59 56 System.out.println( "DevMode " + Dev.state() );
60 57
61 58 replaceAppPanel();
  @@ -65,8 +62,7 @@
65 62 CScomm.setInstance( new GwtCScomm( null, mVM, new AppInitializationCallback() ) );
66 63 }
67 64
68 - public void finishAppLoad()
69 - {
65 + public void finishAppLoad() {
70 66 ClientContext zContext = ClientContext.get();
71 67
72 68 Dev.init( zContext );
  @@ -105,26 +101,20 @@
105 101 zAppPanel.setInfoMessage( "Hello" );
106 102 }
107 103
108 - protected void initializeLoggerFactory()
109 - {
104 + protected void initializeLoggerFactory() {
110 105 //noinspection NonJREEmulationClassesInClientCode
111 106 LoggerFactory.init( new ConfigurationLoggerLevel(), BrowserAsLogSyncFactory.INSTANCE );
112 107 }
113 108
114 - private class AppInitializationCallback implements AsyncCallback<AppInitializationResult>
115 - {
109 + private class AppInitializationCallback implements AsyncCallback<AppInitializationResult> {
116 110 @Override
117 - public void onFailure( Throwable pThrowable )
118 - {
111 + public void onFailure( Throwable pThrowable ) {
119 112 String message;
120 113
121 - if ( pThrowable instanceof InvocationException )
122 - {
114 + if ( pThrowable instanceof InvocationException ) {
123 115 // see javadoc for InvocationException
124 116 message = "A connection could not be established with the server";
125 - }
126 - else if ( pThrowable instanceof IncompatibleRemoteServiceException )
127 - {
117 + } else if ( pThrowable instanceof IncompatibleRemoteServiceException ) {
128 118 /*
129 119 * This _should_ not happen to users, so long as the .nocache
130 120 * file isn't cached by the client.
  @@ -132,9 +122,7 @@
132 122 message = "Client and server versions are incompatible. Try ctrl-clicking\n" + //
133 123 "or shift-clicking the browser refresh button, or clearing your\n" + //
134 124 "browser's cache in 'Internet Options' / your browser's preferences. ";
135 - }
136 - else
137 - {
125 + } else {
138 126 // probably an application-specific execption on the server
139 127 message = "An application error occured on the server";
140 128 }
  @@ -143,18 +131,15 @@
143 131 }
144 132
145 133 @Override
146 - public void onSuccess( AppInitializationResult result )
147 - {
134 + public void onSuccess( AppInitializationResult result ) {
148 135 System.err.println( new UtilDateAdaptor() + " | Client AppInitialization" );
149 136
150 - if ( result == null )
151 - {
137 + if ( result == null ) {
152 138 UtilsGwt.closeWindowNoConfirm( 5 );
153 139 return;
154 140 }
155 141
156 - try
157 - {
142 + try {
158 143 new ClientConfiguration( result.getClientConfig() ); // This line must preceed the next
159 144 initializeLoggerFactory(); // ......................... This line must follow the previous
160 145
  @@ -162,14 +147,12 @@
162 147
163 148 finishAppLoad();
164 149 }
165 - catch ( RuntimeException e )
166 - {
150 + catch ( RuntimeException e ) {
167 151 reportFailure( e, "onSuccess()", null );
168 152 }
169 153 }
170 154
171 - private void reportFailure( Throwable pThrowable, String method, String message )
172 - {
155 + private void reportFailure( Throwable pThrowable, String method, String message ) {
173 156 pThrowable.printStackTrace(); // prints the trace in the GWT hosted shell
174 157 String html = "<h1>Application Initialization Failed</h1>" + //
175 158 "<p>" + message + "</p>" + //
  @@ -180,16 +163,12 @@
180 163 }
181 164 }
182 165
183 - private static class NextDemoUserRequestHandlerImpl implements NextDemoUserRequestHandler
184 - {
166 + private static class NextDemoUserRequestHandlerImpl implements NextDemoUserRequestHandler {
185 167 @Override
186 - public void nextDemoUser()
187 - {
188 - UserViewDataProvider.getInstance().nextDemoUser( new SimpleDataProviderCallBack()
189 - {
168 + public void nextDemoUser() {
169 + UserViewDataProvider.getInstance().nextDemoUser( new SimpleDataProviderCallBack() {
190 170 @Override
191 - public void error( String pError )
192 - {
171 + public void error( String pError ) {
193 172 new ShowScreenCommand( ViewDefs.HOME, pError ).execute();
194 173 }
195 174 } );
  @@ -197,18 +176,13 @@
197 176 }
198 177
199 178 @Override
200 - public void switchToRestrictedResource( AlternateRestrictedResourceOption pAlternateOption )
201 - {
202 - UserViewDataProvider.getInstance().attemptSwitchToRestrictedResource( (RestrictedResourceView) pAlternateOption, new SimpleDataProviderCallBack()
203 - {
179 + public void switchToRestrictedResource( AlternateRestrictedResourceOption pAlternateOption ) {
180 + UserViewDataProvider.getInstance().attemptSwitchToRestrictedResource( (RestrictedResourceView) pAlternateOption, new SimpleDataProviderCallBack() {
204 181 @Override
205 - public void error( String pError )
206 - {
207 - if ( Strings.isNullOrEmpty( pError ) )
208 - {
182 + public void error( String pError ) {
183 + if ( Strings.isNullOrEmpty( pError ) ) {
209 184 PageRefreshableProxy zRefreshableProxy = ClientContext.get().checkGet( PageRefreshableProxy.class );
210 - if ( zRefreshableProxy != null )
211 - {
185 + if ( zRefreshableProxy != null ) {
212 186 zRefreshableProxy.refreshPage();
213 187 return;
214 188 }