|
@@ -1,92 +1,92 @@ |
1 |
|
- |
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
|
- |
package org.litesoft.GWT.eventbus.client; |
3 |
|
- |
|
4 |
|
- |
import org.litesoft.GWT.client.*; |
5 |
|
- |
import org.litesoft.GWT.eventbus.client.nonpublic.*; |
6 |
|
- |
import org.litesoft.GWT.eventbus.client.rpc.*; |
7 |
|
- |
import org.litesoft.commonfoundation.typeutils.*; |
8 |
|
- |
|
9 |
|
- |
import com.google.gwt.event.logical.shared.*; |
10 |
|
- |
import com.google.gwt.user.client.*; |
11 |
|
- |
|
12 |
|
- |
public abstract class AbstractHtmlLauncherClientEventBusApp extends AbstractClientEventBusApp { |
13 |
|
- |
private String mServerAppName; |
14 |
|
- |
|
15 |
|
- |
protected AbstractHtmlLauncherClientEventBusApp( AppNames pAppNames, String pServerAppName ) { |
16 |
|
- |
super( pAppNames ); |
17 |
|
- |
mServerAppName = Strings.assertNotNullNotEmpty( "ServerAppName", pServerAppName ); |
18 |
|
- |
String error = prepLauncherAccess(); |
19 |
|
- |
if ( error.length() != 0 ) { |
20 |
|
- |
error = "prepLauncherAccess: " + error; |
21 |
|
- |
System.out.println( error ); |
22 |
|
- |
StatusBar.set( error ); |
23 |
|
- |
} |
24 |
|
- |
} |
25 |
|
- |
|
26 |
|
- |
public void onClose( CloseEvent<Window> pEvent ) { |
27 |
|
- |
super.onClose( pEvent ); |
28 |
|
- |
String error = launcherNotifyClose( sEncodedClientId ); |
29 |
|
- |
if ( error.length() != 0 ) { |
30 |
|
- |
System.err.println( "launcherNotifyClose: " + error ); |
31 |
|
- |
} |
32 |
|
- |
} |
33 |
|
- |
|
34 |
|
- |
protected void finalPrep( ChannelEventPackage pInitialChannelEvent, |
35 |
|
- |
AuthenticationData pAuthenticationData ) { |
36 |
|
- |
if ( !AuthenticationData.deNull( pAuthenticationData ).hasUserKeyAsOpaqueString() ) { |
37 |
|
- |
throw new RedirectClientException( "Not Authenticated", mServerAppName + "?PortalFrame" ); |
38 |
|
- |
} |
39 |
|
- |
String error = launcherNotifyOpen( sEncodedClientId ); |
40 |
|
- |
if ( error.length() != 0 ) { |
41 |
|
- |
error = "launcherNotifyOpen: " + error; |
42 |
|
- |
System.out.println( error ); |
43 |
|
- |
StatusBar.set( error ); |
44 |
|
- |
} |
45 |
|
- |
super.finalPrep( pInitialChannelEvent, pAuthenticationData ); |
46 |
|
- |
} |
47 |
|
- |
|
48 |
|
- |
public static native String prepLauncherAccess()/*-{ |
49 |
|
- |
$wnd.rootWindow = $wnd.opener; |
50 |
|
- |
if ( $wnd.rootWindow ) |
51 |
|
- |
{ |
52 |
|
- |
if ( $wnd.rootWindow.rootWindow ) |
53 |
|
- |
{ |
54 |
|
- |
$wnd.rootWindow = $wnd.rootWindow.rootWindow; |
55 |
|
- |
} |
56 |
|
- |
return ""; |
57 |
|
- |
} |
58 |
|
- |
return "No RootWindow"; |
59 |
|
- |
}-*/; |
60 |
|
- |
|
61 |
|
- |
public static native String launcherNotifyOpen( String pEncodedClientID )/*-{ |
62 |
|
- |
if ( $wnd.rootWindow ) |
63 |
|
- |
{ |
64 |
|
- |
try |
65 |
|
- |
{ |
66 |
|
- |
$wnd.rootWindow.clientOpen( pEncodedClientID ); |
67 |
|
- |
} |
68 |
|
- |
catch ( e ) |
69 |
|
- |
{ |
70 |
|
- |
return "Exception: " + e; |
71 |
|
- |
} |
72 |
|
- |
return ""; |
73 |
|
- |
} |
74 |
|
- |
return "No RootWindow"; |
75 |
|
- |
}-*/; |
76 |
|
- |
|
77 |
|
- |
public static native String launcherNotifyClose( String pEncodedClientID )/*-{ |
78 |
|
- |
if ( $wnd.rootWindow ) |
79 |
|
- |
{ |
80 |
|
- |
try |
81 |
|
- |
{ |
82 |
|
- |
$wnd.rootWindow.clientClose( pEncodedClientID ); |
83 |
|
- |
} |
84 |
|
- |
catch ( e ) |
85 |
|
- |
{ |
86 |
|
- |
return "Exception: " + e; |
87 |
|
- |
} |
88 |
|
- |
return ""; |
89 |
|
- |
} |
90 |
|
- |
return "No RootWindow"; |
91 |
|
- |
}-*/; |
92 |
|
- |
} |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://unlicense.org |
|
2 |
+ |
package org.litesoft.GWT.eventbus.client; |
|
3 |
+ |
|
|
4 |
+ |
import org.litesoft.GWT.client.*; |
|
5 |
+ |
import org.litesoft.GWT.eventbus.client.nonpublic.*; |
|
6 |
+ |
import org.litesoft.GWT.eventbus.client.rpc.*; |
|
7 |
+ |
import org.litesoft.commonfoundation.base.*; |
|
8 |
+ |
|
|
9 |
+ |
import com.google.gwt.event.logical.shared.*; |
|
10 |
+ |
import com.google.gwt.user.client.*; |
|
11 |
+ |
|
|
12 |
+ |
public abstract class AbstractHtmlLauncherClientEventBusApp extends AbstractClientEventBusApp { |
|
13 |
+ |
private String mServerAppName; |
|
14 |
+ |
|
|
15 |
+ |
protected AbstractHtmlLauncherClientEventBusApp( AppNames pAppNames, String pServerAppName ) { |
|
16 |
+ |
super( pAppNames ); |
|
17 |
+ |
mServerAppName = Confirm.significant( "ServerAppName", pServerAppName ); |
|
18 |
+ |
String error = prepLauncherAccess(); |
|
19 |
+ |
if ( error.length() != 0 ) { |
|
20 |
+ |
error = "prepLauncherAccess: " + error; |
|
21 |
+ |
System.out.println( error ); |
|
22 |
+ |
StatusBar.set( error ); |
|
23 |
+ |
} |
|
24 |
+ |
} |
|
25 |
+ |
|
|
26 |
+ |
public void onClose( CloseEvent<Window> pEvent ) { |
|
27 |
+ |
super.onClose( pEvent ); |
|
28 |
+ |
String error = launcherNotifyClose( sEncodedClientId ); |
|
29 |
+ |
if ( error.length() != 0 ) { |
|
30 |
+ |
System.err.println( "launcherNotifyClose: " + error ); |
|
31 |
+ |
} |
|
32 |
+ |
} |
|
33 |
+ |
|
|
34 |
+ |
protected void finalPrep( ChannelEventPackage pInitialChannelEvent, |
|
35 |
+ |
AuthenticationData pAuthenticationData ) { |
|
36 |
+ |
if ( !AuthenticationData.deNull( pAuthenticationData ).hasUserKeyAsOpaqueString() ) { |
|
37 |
+ |
throw new RedirectClientException( "Not Authenticated", mServerAppName + "?PortalFrame" ); |
|
38 |
+ |
} |
|
39 |
+ |
String error = launcherNotifyOpen( sEncodedClientId ); |
|
40 |
+ |
if ( error.length() != 0 ) { |
|
41 |
+ |
error = "launcherNotifyOpen: " + error; |
|
42 |
+ |
System.out.println( error ); |
|
43 |
+ |
StatusBar.set( error ); |
|
44 |
+ |
} |
|
45 |
+ |
super.finalPrep( pInitialChannelEvent, pAuthenticationData ); |
|
46 |
+ |
} |
|
47 |
+ |
|
|
48 |
+ |
public static native String prepLauncherAccess()/*-{ |
|
49 |
+ |
$wnd.rootWindow = $wnd.opener; |
|
50 |
+ |
if ( $wnd.rootWindow ) |
|
51 |
+ |
{ |
|
52 |
+ |
if ( $wnd.rootWindow.rootWindow ) |
|
53 |
+ |
{ |
|
54 |
+ |
$wnd.rootWindow = $wnd.rootWindow.rootWindow; |
|
55 |
+ |
} |
|
56 |
+ |
return ""; |
|
57 |
+ |
} |
|
58 |
+ |
return "No RootWindow"; |
|
59 |
+ |
}-*/; |
|
60 |
+ |
|
|
61 |
+ |
public static native String launcherNotifyOpen( String pEncodedClientID )/*-{ |
|
62 |
+ |
if ( $wnd.rootWindow ) |
|
63 |
+ |
{ |
|
64 |
+ |
try |
|
65 |
+ |
{ |
|
66 |
+ |
$wnd.rootWindow.clientOpen( pEncodedClientID ); |
|
67 |
+ |
} |
|
68 |
+ |
catch ( e ) |
|
69 |
+ |
{ |
|
70 |
+ |
return "Exception: " + e; |
|
71 |
+ |
} |
|
72 |
+ |
return ""; |
|
73 |
+ |
} |
|
74 |
+ |
return "No RootWindow"; |
|
75 |
+ |
}-*/; |
|
76 |
+ |
|
|
77 |
+ |
public static native String launcherNotifyClose( String pEncodedClientID )/*-{ |
|
78 |
+ |
if ( $wnd.rootWindow ) |
|
79 |
+ |
{ |
|
80 |
+ |
try |
|
81 |
+ |
{ |
|
82 |
+ |
$wnd.rootWindow.clientClose( pEncodedClientID ); |
|
83 |
+ |
} |
|
84 |
+ |
catch ( e ) |
|
85 |
+ |
{ |
|
86 |
+ |
return "Exception: " + e; |
|
87 |
+ |
} |
|
88 |
+ |
return ""; |
|
89 |
+ |
} |
|
90 |
+ |
return "No RootWindow"; |
|
91 |
+ |
}-*/; |
|
92 |
+ |
} |