Subversion Repository Public Repository

litesoft

Diff Revisions 948 vs 950 for /trunk/Java/GWT/OldServer/src/org/litesoft/GWT/eventbus/Documentation_OpenNewWindowProcess.java

Diff revisions: vs.
  @@ -1,106 +1,106 @@
1 - // This Source Code is in the Public Domain per: http://unlicense.org
2 - package org.litesoft.GWT.eventbus;
3 -
4 - import org.litesoft.GWT.eventbus.client.*;
5 - import org.litesoft.GWT.eventbus.client.eventpackages.*;
6 - import org.litesoft.GWT.eventbus.client.nonpublic.*;
7 - import org.litesoft.GWT.eventbus.server.*;
8 -
9 - import com.google.gwt.user.client.*;
10 -
11 - import java.util.*;
12 -
13 - @SuppressWarnings({"UnusedDeclaration"})
14 - public class Documentation_OpenNewWindowProcess {
15 - // Client(1)/Server Initiated
16 - public void step1( EventBus pEventBus ) {
17 - RequestNewClientEventPackage zPackage = new RequestNewClientEventPackage( "Client" );
18 - // or subclass if new Child needs data from the Parent...
19 - pEventBus.publish( zPackage );
20 - }
21 -
22 - // Server Response
23 - public void step2( EventBus pEventBus, String zNewEncodedClientId ) {
24 - /**
25 - * @see AbstractServerApp.RequestNewClientListener eventReceivedVia(...)
26 - */
27 - // create a new clientIdNumber for the new window
28 -
29 - // creates a new Temporary ServerEventBus with the new window's clientIdNumber and
30 - // pInitialEventForNewWindow and all the current ServerEventBus' Broser Data
31 -
32 - pEventBus.publish( new OpenNewClientEventPackage( "Server", zNewEncodedClientId ) );
33 - }
34 -
35 - // Client(1) Response
36 - public void step3( String pOurURL, String pWindowNameBase, OpenNewClientEventPackage pEvent ) {
37 - /**
38 - * @see AbstractClientEventBusApp.OpenNewClientListener eventReceivedVia(...)
39 - */
40 - Window.open( pOurURL, //
41 - pWindowNameBase + pEvent.getNewEncodedClientId(), //
42 - "" ); // New Window Options
43 - }
44 -
45 - // Client(2) Initialization
46 - public void step4() {
47 - /**
48 - * @see AbstractClientEventBusApp onModuleLoad
49 - */
50 - // String zEncodedClientId = getEncodedClientId(); **** extracted from the Window name!
51 -
52 - // rpc to server - initialize( pEncodedClientId )
53 - /**
54 - * @see AbstractServerApp initialize(...)
55 - */
56 - }
57 -
58 - // Server Response
59 - public AppInitializationResult step5( int pClientIdNumber, String pEncodeEncodedClientId,
60 - String zApplicationVersion, AuthenticationData zAuthenticationData ) {
61 - /**
62 - * @see AbstractServerApp initialize(...) initializeForBrowserPageRequest(...)
63 - */
64 - // get existing ServerEventBus for pClientIdNumber (Temporary ServerEventBus from step2)
65 -
66 - // creates a new 'real' ServerEventBus with the pClientIdNumber and
67 - // existing ServerEventBus for pClientIdNumber's Broser Data
68 -
69 - // register/subscribe all listeners for server side new client
70 - ChannelServicePackage eventsResultingFromRegisterSubscribe = null;
71 -
72 - // rpc respond with
73 - return new AppInitializationResult( pClientIdNumber, //
74 - pEncodeEncodedClientId, //
75 - new HashMap<String, String>(), // Client Config Data
76 - eventsResultingFromRegisterSubscribe, //
77 - zApplicationVersion, //
78 - zAuthenticationData );
79 - }
80 -
81 - // Client(2) Initialization
82 - public void step6( AppInitializationResult result ) {
83 - /**
84 - * @see AbstractClientEventBusApp.MyAsyncCallback onSuccess
85 - */
86 -
87 - // Set the Windows Title if debugging
88 - // UtilsGwt.setWindowTitleWithWindowName( Window.getTitle() );
89 -
90 - // create ClientEventBus (ceb) in suspend mode
91 -
92 - ChannelServicePackage events = result.getChannelServicePackage();
93 -
94 - // propagate events to ClientEventBus
95 -
96 - // register/subscribe:
97 - // initialSubscriptions( ceb );
98 - // addEventListenersForNewClient( ClientEventBus pClientEventBus )
99 -
100 - // release() the ClientEventBus distribute all the saved up events
101 -
102 - // call finalPrep / appReady with
103 - // ClientEventBus,
104 - result.getAuthenticationData();
105 - }
106 - }
1 + // This Source Code is in the Public Domain per: http://unlicense.org
2 + package org.litesoft.GWT.eventbus;
3 +
4 + import org.litesoft.GWT.eventbus.client.*;
5 + import org.litesoft.GWT.eventbus.client.eventpackages.*;
6 + import org.litesoft.GWT.eventbus.client.nonpublic.*;
7 + import org.litesoft.GWT.eventbus.server.*;
8 +
9 + import com.google.gwt.user.client.*;
10 +
11 + import java.util.*;
12 +
13 + @SuppressWarnings({"UnusedDeclaration"})
14 + public class Documentation_OpenNewWindowProcess {
15 + // Client(1)/Server Initiated
16 + public void step1( EventBus pEventBus ) {
17 + RequestNewClientEventPackage zPackage = new RequestNewClientEventPackage( "Client" );
18 + // or subclass if new Child needs data from the Parent...
19 + pEventBus.publish( zPackage );
20 + }
21 +
22 + // Server Response
23 + public void step2( EventBus pEventBus, String zNewEncodedClientId ) {
24 + /**
25 + * @see AbstractServerApp.RequestNewClientListener eventReceivedVia(...)
26 + */
27 + // create a new clientIdNumber for the new window
28 +
29 + // creates a new Temporary ServerEventBus with the new window's clientIdNumber and
30 + // pInitialEventForNewWindow and all the current ServerEventBus' Broser Data
31 +
32 + pEventBus.publish( new OpenNewClientEventPackage( "Server", zNewEncodedClientId ) );
33 + }
34 +
35 + // Client(1) Response
36 + public void step3( String pOurURL, String pWindowNameBase, OpenNewClientEventPackage pEvent ) {
37 + /**
38 + * @see AbstractClientEventBusApp.OpenNewClientListener eventReceivedVia(...)
39 + */
40 + Window.open( pOurURL, //
41 + pWindowNameBase + pEvent.getNewEncodedClientId(), //
42 + "" ); // New Window Options
43 + }
44 +
45 + // Client(2) Initialization
46 + public void step4() {
47 + /**
48 + * @see AbstractClientEventBusApp onModuleLoad
49 + */
50 + // String zEncodedClientId = getEncodedClientId(); **** extracted from the Window name!
51 +
52 + // rpc to server - initialize( pEncodedClientId )
53 + /**
54 + * @see AbstractServerApp initialize(...)
55 + */
56 + }
57 +
58 + // Server Response
59 + public AppInitializationResult step5( int pClientIdNumber, String pEncodeEncodedClientId,
60 + String zApplicationVersion, AuthenticationData zAuthenticationData ) {
61 + /**
62 + * @see AbstractServerApp initialize(...) initializeForBrowserPageRequest(...)
63 + */
64 + // get existing ServerEventBus for pClientIdNumber (Temporary ServerEventBus from step2)
65 +
66 + // creates a new 'real' ServerEventBus with the pClientIdNumber and
67 + // existing ServerEventBus for pClientIdNumber's Broser Data
68 +
69 + // register/subscribe all listeners for server side new client
70 + ChannelServicePackage eventsResultingFromRegisterSubscribe = null;
71 +
72 + // rpc respond with
73 + return new AppInitializationResult( pClientIdNumber, //
74 + pEncodeEncodedClientId, //
75 + new HashMap<String, String>(), // Client Config Data
76 + eventsResultingFromRegisterSubscribe, //
77 + zApplicationVersion, //
78 + zAuthenticationData );
79 + }
80 +
81 + // Client(2) Initialization
82 + public void step6( AppInitializationResult result ) {
83 + /**
84 + * @see AbstractClientEventBusApp.MyAsyncCallback onSuccess
85 + */
86 +
87 + // Set the Windows Title if debugging
88 + // UtilsGwt.setWindowTitleWithWindowName( Window.getTitle() );
89 +
90 + // create ClientEventBus (ceb) in suspend mode
91 +
92 + ChannelServicePackage events = result.getChannelServicePackage();
93 +
94 + // propagate events to ClientEventBus
95 +
96 + // register/subscribe:
97 + // initialSubscriptions( ceb );
98 + // addEventListenersForNewClient( ClientEventBus pClientEventBus )
99 +
100 + // release() the ClientEventBus distribute all the saved up events
101 +
102 + // call finalPrep / appReady with
103 + // ClientEventBus,
104 + result.getAuthenticationData();
105 + }
106 + }