Subversion Repository Public Repository

litesoft

Diff Revisions 949 vs 950 for /trunk/GWT_Sandbox/Prioritizer/src/org/litesoft/prioritizer/client/Prioritizer.java

Diff revisions: vs.
  @@ -1,237 +1,237 @@
1 - package org.litesoft.prioritizer.client;
2 -
3 - import org.litesoft.GWT.client.*;
4 - import org.litesoft.GWT.client.command.*;
5 - import org.litesoft.GWT.client.command.queue.*;
6 - import org.litesoft.GWT.client.context.*;
7 - import org.litesoft.GWT.client.dev.*;
8 - import org.litesoft.GWT.client.logging.*;
9 - import org.litesoft.GWT.client.rpc.*;
10 - import org.litesoft.GWT.client.view.*;
11 - import org.litesoft.GWT.client.widgets.*;
12 - import org.litesoft.GWT.client.widgets.datatables.*;
13 - import org.litesoft.bo.views.*;
14 - import org.litesoft.bo.views.communication.*;
15 - import org.litesoft.commonfoundation.typeutils.*;
16 - import org.litesoft.commonfoundation.typeutils.gregorian.*;
17 - import org.litesoft.core.*;
18 - import org.litesoft.logger.*;
19 - import org.litesoft.loggerconfig.*;
20 - import org.litesoft.prioritizer.client.accessors.*;
21 - import org.litesoft.prioritizer.client.boviews.*;
22 - import org.litesoft.prioritizer.client.ui.views.admin.*;
23 - import org.litesoft.prioritizer.client.ui.views.home.*;
24 - import org.litesoft.prioritizer.client.ui.views.stories.*;
25 - import org.litesoft.prioritizer.client.ui.widgets.*;
26 - import org.litesoft.security.*;
27 - import org.litesoft.uispecification.*;
28 -
29 - import com.google.gwt.user.client.*;
30 - import com.google.gwt.user.client.rpc.*;
31 - import com.google.gwt.user.client.ui.*;
32 -
33 - public class Prioritizer extends AbstractClientMainAppEntryPoint implements ViewDefs,
34 - RestrictedResourceSwitcherCallBack {
35 - static {
36 - UserViewAccessControlFactory.setViewDefSecuritySets( ViewDefs.SECURITY_SETS );
37 - }
38 -
39 - private VACMproxy mACM = new VACMproxy();
40 -
41 - // pull in all the factories. This can be broken out into different modules if compile becomes too slow.
42 - private ViewManagerImpl mVM = new ViewManagerImpl( mACM, //
43 - // Admin
44 - new ChangePasswordFactory<UserView>( HOME_SECTION_ADMIN, ADMIN_CHANGE_PASSWORD ), //
45 - new MyProfileFactory(), //
46 - new ReportsFactory(), //
47 - new UsersFactory(), //
48 - new StoriesFactory(), //
49 - new ReprioritizeFactory(), //
50 - new InitialPrioritizingFactory(), //
51 - new RestrictedResourceEditorFactory(), //
52 - new RestrictedResourceManagementFactory(), //
53 - // Reports...
54 - // new MedicationTrackingReportFactory(), //
55 - // HOME!
56 - new HomeFactory() );
57 -
58 - public Prioritizer() {
59 - super( new AppNames( "Prioritizer", "Prioritizer" ) );
60 -
61 - // add in all the factory-less screens. This can be broken out into different modules if compile becomes too slow.
62 - // mVM.add( ADMIN_RESTRICTED_RESOURCE_MANAGEMENT );
63 - }
64 -
65 - @Override
66 - public void onAppLoad() {
67 - System.out.println( "DevMode " + Dev.state() );
68 -
69 - replaceAppPanel();
70 -
71 - super.onAppLoad();
72 -
73 - CScomm.setInstance( new GwtCScomm( null, mVM, new AppInitializationCallback() ) );
74 - }
75 -
76 - public void finishAppLoad() {
77 - ClientContext zContext = ClientContext.get();
78 -
79 - Dev.init( zContext );
80 -
81 - AppPanel zAppPanel = new AppPanel( Dev.isDevMode() ? 1 : 0 ); // 1 = see Red Line
82 -
83 - CurrentUserViewAccessor zCUA = new CurrentUserViewAccessor( zAppPanel, mACM );
84 - CurrentRestrictedResourceViewAccessor zCSA = new CurrentRestrictedResourceViewAccessor( zAppPanel );
85 - CurrentRestrictedResourceOptionsAccessor zCRROA = new CurrentRestrictedResourceOptionsAccessor( new RestrictedResourceSwitcher( zAppPanel, this ) );
86 -
87 - WindowSizingPanel.setContent( zAppPanel );
88 -
89 - UserViewDataProvider zUserViewDataProvider = UserViewDataProvider.getInstance();
90 -
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 -
111 - zContext.set( CurrentRestrictedResourceViewAccessor.class, zCSA );
112 - zContext.set( AbstractCurrentRestrictedResourceViewAccessor.class, zCSA );
113 -
114 - zContext.set( CurrentUserViewAccessor.class, zCUA );
115 - zContext.set( AbstractCurrentUserViewAccessor.class, zCUA );
116 -
117 - zContext.set( LoginServerStateChecker.class, zUserViewDataProvider );
118 - zContext.set( SecurityUserViewDataProvider.class, zUserViewDataProvider );
119 -
120 - zContext.set( SecurityUserViewMetaData.class, UserViewMetaData.getInstance() );
121 -
122 - zContext.set( SuspendDialogViewFactory.class, new SuspendDialogFactory<UserView>() );
123 - zContext.set( LoginDialogViewFactory.class, new LoginDialogFactory<UserView>() );
124 - zContext.set( LoginPasswordResetDialogViewFactory.class, new ResetPasswordDialogFactory<UserView>() );
125 - zContext.set( ViewAccessControlManager.class, mACM );
126 - zContext.set( CurrentRestrictedResourceOptionsAccessor.class, zCRROA );
127 - zContext.set( RestrictedResourcePickerDialogViewFactory.class, zRRPDF );
128 - zContext.set( LoginPasswordResetAccessor.class, zCUA );
129 - zContext.set( StatusMessageSinc.class, zAppPanel );
130 - zContext.set( SingleWidgetPanel.class, zAppPanel );
131 - zContext.set( PageRefreshableProxy.class, zAppPanel );
132 - zContext.set( CommandQueue.class, new CommandQueue() );
133 - zContext.set( ScreenViewShower.class, mVM );
134 - zContext.set( DialogViewShower.class, mVM );
135 - zContext.set( ViewFactoryAccessor.class, mVM );
136 - zContext.set( NextDemoUserRequestHandler.class, new NextDemoUserRequestHandlerImpl() );
137 -
138 - mVM.initialize();
139 -
140 - System.err.println( new UtilDateAdaptor() + " | Application Client Ready" );
141 -
142 - PaddingProperty.setDefaults( 2, 10, 2, 6 );
143 -
144 - zAppPanel.setInfoMessage( "Hello" );
145 - }
146 -
147 - protected void initializeLoggerFactory() {
148 - //noinspection NonJREEmulationClassesInClientCode
149 - LoggerFactory.init( new ConfigurationLoggerLevel(), BrowserAsLogSyncFactory.INSTANCE );
150 - }
151 -
152 - private class AppInitializationCallback implements AsyncCallback<AppInitializationResult> {
153 - @Override
154 - public void onFailure( Throwable pThrowable ) {
155 - String message;
156 -
157 - if ( pThrowable instanceof InvocationException ) {
158 - // see javadoc for InvocationException
159 - message = "A connection could not be established with the server";
160 - } else if ( pThrowable instanceof IncompatibleRemoteServiceException ) {
161 - /*
162 - * This _should_ not happen to users, so long as the .nocache
163 - * file isn't cached by the client.
164 - */
165 - message = "Client and server versions are incompatible. Try ctrl-clicking\n" + //
166 - "or shift-clicking the browser refresh button, or clearing your\n" + //
167 - "browser's cache in 'Internet Options' / your browser's preferences. ";
168 - } else {
169 - // probably an application-specific execption on the server
170 - message = "An application error occured on the server";
171 - }
172 -
173 - reportFailure( pThrowable, "onFailure()", message );
174 - }
175 -
176 - @Override
177 - public void onSuccess( AppInitializationResult result ) {
178 - System.err.println( new UtilDateAdaptor() + " | Client AppInitialization" );
179 -
180 - if ( result == null ) {
181 - UtilsGwt.closeWindowNoConfirm( 5 );
182 - return;
183 - }
184 -
185 - try {
186 - new ClientConfiguration( result.getClientConfig() ); // This line must preceed the next
187 - initializeLoggerFactory(); // ......................... This line must follow the previous
188 -
189 - AlertManager.setVersion( "Version " + result.getApplicationVersion() );
190 -
191 - finishAppLoad();
192 - }
193 - catch ( RuntimeException e ) {
194 - reportFailure( e, "onSuccess()", null );
195 - }
196 - }
197 -
198 - private void reportFailure( Throwable pThrowable, String method, String message ) {
199 - pThrowable.printStackTrace(); // prints the trace in the GWT hosted shell
200 - String html = "<h1>Application Initialization Failed</h1>" + //
201 - "<p>" + message + "</p>" + //
202 - "<p>at " + mAppName + "." + method + "</p>" + //
203 - "<p>Exception: </p>" + //
204 - "<p><pre>" + pThrowable + "</pre></p>";
205 - DOM.setInnerHTML( RootPanel.getBodyElement(), html );
206 - }
207 - }
208 -
209 - private static class NextDemoUserRequestHandlerImpl implements NextDemoUserRequestHandler {
210 - @Override
211 - public void nextDemoUser() {
212 - UserViewDataProvider.getInstance().nextDemoUser( new SimpleDataProviderCallBack() {
213 - @Override
214 - public void error( String pError ) {
215 - new ShowScreenCommand( ViewDefs.HOME, pError ).execute();
216 - }
217 - } );
218 - }
219 - }
220 -
221 - @Override
222 - public void switchToRestrictedResource( AlternateRestrictedResourceOption pAlternateOption ) {
223 - UserViewDataProvider.getInstance().attemptSwitchToRestrictedResource( (RestrictedResourceView) pAlternateOption, new SimpleDataProviderCallBack() {
224 - @Override
225 - public void error( String pError ) {
226 - if ( Strings.isNullOrEmpty( pError ) ) {
227 - PageRefreshableProxy zRefreshableProxy = ClientContext.get().checkGet( PageRefreshableProxy.class );
228 - if ( zRefreshableProxy != null ) {
229 - zRefreshableProxy.refreshPage();
230 - return;
231 - }
232 - }
233 - new ShowScreenCommand( ViewDefs.HOME, pError ).execute();
234 - }
235 - } );
236 - }
237 - }
1 + package org.litesoft.prioritizer.client;
2 +
3 + import org.litesoft.GWT.client.*;
4 + import org.litesoft.GWT.client.command.*;
5 + import org.litesoft.GWT.client.command.queue.*;
6 + import org.litesoft.GWT.client.context.*;
7 + import org.litesoft.GWT.client.dev.*;
8 + import org.litesoft.GWT.client.logging.*;
9 + import org.litesoft.GWT.client.rpc.*;
10 + import org.litesoft.GWT.client.view.*;
11 + import org.litesoft.GWT.client.widgets.*;
12 + import org.litesoft.GWT.client.widgets.datatables.*;
13 + import org.litesoft.bo.views.*;
14 + import org.litesoft.bo.views.communication.*;
15 + import org.litesoft.commonfoundation.base.*;
16 + import org.litesoft.commonfoundation.typeutils.gregorian.*;
17 + import org.litesoft.core.*;
18 + import org.litesoft.logger.*;
19 + import org.litesoft.loggerconfig.*;
20 + import org.litesoft.prioritizer.client.accessors.*;
21 + import org.litesoft.prioritizer.client.boviews.*;
22 + import org.litesoft.prioritizer.client.ui.views.admin.*;
23 + import org.litesoft.prioritizer.client.ui.views.home.*;
24 + import org.litesoft.prioritizer.client.ui.views.stories.*;
25 + import org.litesoft.prioritizer.client.ui.widgets.*;
26 + import org.litesoft.security.*;
27 + import org.litesoft.uispecification.*;
28 +
29 + import com.google.gwt.user.client.*;
30 + import com.google.gwt.user.client.rpc.*;
31 + import com.google.gwt.user.client.ui.*;
32 +
33 + public class Prioritizer extends AbstractClientMainAppEntryPoint implements ViewDefs,
34 + RestrictedResourceSwitcherCallBack {
35 + static {
36 + UserViewAccessControlFactory.setViewDefSecuritySets( ViewDefs.SECURITY_SETS );
37 + }
38 +
39 + private VACMproxy mACM = new VACMproxy();
40 +
41 + // pull in all the factories. This can be broken out into different modules if compile becomes too slow.
42 + private ViewManagerImpl mVM = new ViewManagerImpl( mACM, //
43 + // Admin
44 + new ChangePasswordFactory<UserView>( HOME_SECTION_ADMIN, ADMIN_CHANGE_PASSWORD ), //
45 + new MyProfileFactory(), //
46 + new ReportsFactory(), //
47 + new UsersFactory(), //
48 + new StoriesFactory(), //
49 + new ReprioritizeFactory(), //
50 + new InitialPrioritizingFactory(), //
51 + new RestrictedResourceEditorFactory(), //
52 + new RestrictedResourceManagementFactory(), //
53 + // Reports...
54 + // new MedicationTrackingReportFactory(), //
55 + // HOME!
56 + new HomeFactory() );
57 +
58 + public Prioritizer() {
59 + super( new AppNames( "Prioritizer", "Prioritizer" ) );
60 +
61 + // add in all the factory-less screens. This can be broken out into different modules if compile becomes too slow.
62 + // mVM.add( ADMIN_RESTRICTED_RESOURCE_MANAGEMENT );
63 + }
64 +
65 + @Override
66 + public void onAppLoad() {
67 + System.out.println( "DevMode " + Dev.state() );
68 +
69 + replaceAppPanel();
70 +
71 + super.onAppLoad();
72 +
73 + CScomm.setInstance( new GwtCScomm( null, mVM, new AppInitializationCallback() ) );
74 + }
75 +
76 + public void finishAppLoad() {
77 + ClientContext zContext = ClientContext.get();
78 +
79 + Dev.init( zContext );
80 +
81 + AppPanel zAppPanel = new AppPanel( Dev.isDevMode() ? 1 : 0 ); // 1 = see Red Line
82 +
83 + CurrentUserViewAccessor zCUA = new CurrentUserViewAccessor( zAppPanel, mACM );
84 + CurrentRestrictedResourceViewAccessor zCSA = new CurrentRestrictedResourceViewAccessor( zAppPanel );
85 + CurrentRestrictedResourceOptionsAccessor zCRROA = new CurrentRestrictedResourceOptionsAccessor( new RestrictedResourceSwitcher( zAppPanel, this ) );
86 +
87 + WindowSizingPanel.setContent( zAppPanel );
88 +
89 + UserViewDataProvider zUserViewDataProvider = UserViewDataProvider.getInstance();
90 +
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 +
111 + zContext.set( CurrentRestrictedResourceViewAccessor.class, zCSA );
112 + zContext.set( AbstractCurrentRestrictedResourceViewAccessor.class, zCSA );
113 +
114 + zContext.set( CurrentUserViewAccessor.class, zCUA );
115 + zContext.set( AbstractCurrentUserViewAccessor.class, zCUA );
116 +
117 + zContext.set( LoginServerStateChecker.class, zUserViewDataProvider );
118 + zContext.set( SecurityUserViewDataProvider.class, zUserViewDataProvider );
119 +
120 + zContext.set( SecurityUserViewMetaData.class, UserViewMetaData.getInstance() );
121 +
122 + zContext.set( SuspendDialogViewFactory.class, new SuspendDialogFactory<UserView>() );
123 + zContext.set( LoginDialogViewFactory.class, new LoginDialogFactory<UserView>() );
124 + zContext.set( LoginPasswordResetDialogViewFactory.class, new ResetPasswordDialogFactory<UserView>() );
125 + zContext.set( ViewAccessControlManager.class, mACM );
126 + zContext.set( CurrentRestrictedResourceOptionsAccessor.class, zCRROA );
127 + zContext.set( RestrictedResourcePickerDialogViewFactory.class, zRRPDF );
128 + zContext.set( LoginPasswordResetAccessor.class, zCUA );
129 + zContext.set( StatusMessageSinc.class, zAppPanel );
130 + zContext.set( SingleWidgetPanel.class, zAppPanel );
131 + zContext.set( PageRefreshableProxy.class, zAppPanel );
132 + zContext.set( CommandQueue.class, new CommandQueue() );
133 + zContext.set( ScreenViewShower.class, mVM );
134 + zContext.set( DialogViewShower.class, mVM );
135 + zContext.set( ViewFactoryAccessor.class, mVM );
136 + zContext.set( NextDemoUserRequestHandler.class, new NextDemoUserRequestHandlerImpl() );
137 +
138 + mVM.initialize();
139 +
140 + System.err.println( new UtilDateAdaptor() + " | Application Client Ready" );
141 +
142 + PaddingProperty.setDefaults( 2, 10, 2, 6 );
143 +
144 + zAppPanel.setInfoMessage( "Hello" );
145 + }
146 +
147 + protected void initializeLoggerFactory() {
148 + //noinspection NonJREEmulationClassesInClientCode
149 + LoggerFactory.init( new ConfigurationLoggerLevel(), BrowserAsLogSyncFactory.INSTANCE );
150 + }
151 +
152 + private class AppInitializationCallback implements AsyncCallback<AppInitializationResult> {
153 + @Override
154 + public void onFailure( Throwable pThrowable ) {
155 + String message;
156 +
157 + if ( pThrowable instanceof InvocationException ) {
158 + // see javadoc for InvocationException
159 + message = "A connection could not be established with the server";
160 + } else if ( pThrowable instanceof IncompatibleRemoteServiceException ) {
161 + /*
162 + * This _should_ not happen to users, so long as the .nocache
163 + * file isn't cached by the client.
164 + */
165 + message = "Client and server versions are incompatible. Try ctrl-clicking\n" + //
166 + "or shift-clicking the browser refresh button, or clearing your\n" + //
167 + "browser's cache in 'Internet Options' / your browser's preferences. ";
168 + } else {
169 + // probably an application-specific execption on the server
170 + message = "An application error occured on the server";
171 + }
172 +
173 + reportFailure( pThrowable, "onFailure()", message );
174 + }
175 +
176 + @Override
177 + public void onSuccess( AppInitializationResult result ) {
178 + System.err.println( new UtilDateAdaptor() + " | Client AppInitialization" );
179 +
180 + if ( result == null ) {
181 + UtilsGwt.closeWindowNoConfirm( 5 );
182 + return;
183 + }
184 +
185 + try {
186 + new ClientConfiguration( result.getClientConfig() ); // This line must preceed the next
187 + initializeLoggerFactory(); // ......................... This line must follow the previous
188 +
189 + AlertManager.setVersion( "Version " + result.getApplicationVersion() );
190 +
191 + finishAppLoad();
192 + }
193 + catch ( RuntimeException e ) {
194 + reportFailure( e, "onSuccess()", null );
195 + }
196 + }
197 +
198 + private void reportFailure( Throwable pThrowable, String method, String message ) {
199 + pThrowable.printStackTrace(); // prints the trace in the GWT hosted shell
200 + String html = "<h1>Application Initialization Failed</h1>" + //
201 + "<p>" + message + "</p>" + //
202 + "<p>at " + mAppName + "." + method + "</p>" + //
203 + "<p>Exception: </p>" + //
204 + "<p><pre>" + pThrowable + "</pre></p>";
205 + DOM.setInnerHTML( RootPanel.getBodyElement(), html );
206 + }
207 + }
208 +
209 + private static class NextDemoUserRequestHandlerImpl implements NextDemoUserRequestHandler {
210 + @Override
211 + public void nextDemoUser() {
212 + UserViewDataProvider.getInstance().nextDemoUser( new SimpleDataProviderCallBack() {
213 + @Override
214 + public void error( String pError ) {
215 + new ShowScreenCommand( ViewDefs.HOME, pError ).execute();
216 + }
217 + } );
218 + }
219 + }
220 +
221 + @Override
222 + public void switchToRestrictedResource( AlternateRestrictedResourceOption pAlternateOption ) {
223 + UserViewDataProvider.getInstance().attemptSwitchToRestrictedResource( (RestrictedResourceView) pAlternateOption, new SimpleDataProviderCallBack() {
224 + @Override
225 + public void error( String pError ) {
226 + if ( Currently.isNullOrEmpty( pError ) ) {
227 + PageRefreshableProxy zRefreshableProxy = ClientContext.get().checkGet( PageRefreshableProxy.class );
228 + if ( zRefreshableProxy != null ) {
229 + zRefreshableProxy.refreshPage();
230 + return;
231 + }
232 + }
233 + new ShowScreenCommand( ViewDefs.HOME, pError ).execute();
234 + }
235 + } );
236 + }
237 + }