Subversion Repository Public Repository

litesoft

Diff Revisions 947 vs 948 for /trunk/Java/GWT/Client/src/org/litesoft/GWT/client/nonpublic/ExtendedFamilyManager.java

Diff revisions: vs.
  @@ -1,17 +1,16 @@
1 1 // This Source Code is in the Public Domain per: http://unlicense.org
2 2 package org.litesoft.GWT.client.nonpublic;
3 3
4 - import java.util.*;
5 -
6 4 import org.litesoft.GWT.client.*;
7 5 import org.litesoft.logger.*;
8 6
9 7 import com.google.gwt.core.client.*;
10 8
9 + import java.util.*;
10 +
11 11 import static org.litesoft.GWT.client.nonpublic.NativeExtendedFamilyManagerSupport.*;
12 12
13 - public class ExtendedFamilyManager
14 - {
13 + public class ExtendedFamilyManager {
15 14 public static final Logger LOGGER = LoggerFactory.getLogger( ExtendedFamilyManager.class );
16 15
17 16 /**
  @@ -19,25 +18,20 @@
19 18 */
20 19 private static List<JavaScriptObject> sAncestorWinHandles = new ArrayList<JavaScriptObject>();
21 20
22 - public static void initialize( boolean pAllowUsToBeGrandPoobah )
23 - {
21 + public static void initialize( boolean pAllowUsToBeGrandPoobah ) {
24 22 buildAncestry();
25 23 CookieNet.initialize( pAllowUsToBeGrandPoobah );
26 24 }
27 25
28 - public static boolean buildAncestry()
29 - {
26 + public static boolean buildAncestry() {
30 27 buildCurrentlyActiveDirectAncestry();
31 28 int zCurrentAncestors = sAncestorWinHandles.size() - 1;
32 - if ( zCurrentAncestors != -1 )
33 - {
29 + if ( zCurrentAncestors != -1 ) {
34 30 JavaScriptObject zAncestorHandle = LLgetAncestor( zCurrentAncestors );
35 - for ( int i = 0; true; i++ )
36 - {
31 + for ( int i = 0; true; i++ ) {
37 32 LOGGER.debug.log( "getAncestorIndexedWinHandle( ", zCurrentAncestors, ", ", i, " )" );
38 33 JavaScriptObject zHandle = getAncestorIndexedWinHandle( zAncestorHandle, i );
39 - if ( zHandle == null )
40 - {
34 + if ( zHandle == null ) {
41 35 break;
42 36 }
43 37 registerAncestor( zHandle );
  @@ -46,13 +40,10 @@
46 40 return !sAncestorWinHandles.isEmpty();
47 41 }
48 42
49 - private static JavaScriptObject LLgetAncestor( int pIndex )
50 - {
51 - if ( ((0 <= pIndex) && (pIndex < sAncestorWinHandles.size())) )
52 - {
43 + private static JavaScriptObject LLgetAncestor( int pIndex ) {
44 + if ( ((0 <= pIndex) && (pIndex < sAncestorWinHandles.size())) ) {
53 45 JavaScriptObject zAncestorWinHandle = sAncestorWinHandles.get( pIndex );
54 - if ( zAncestorWinHandle != null )
55 - {
46 + if ( zAncestorWinHandle != null ) {
56 47 LOGGER.debug.log( "getAncestor( ", pIndex, " ): Returned!" );
57 48 return zAncestorWinHandle;
58 49 }
  @@ -61,14 +52,11 @@
61 52 return null;
62 53 }
63 54
64 - private static void notifyAncestryOfNewDecendent( String pWinName, JavaScriptObject pWinHandle )
65 - {
66 - for ( int i = 0; i < sAncestorWinHandles.size(); i++ )
67 - {
55 + private static void notifyAncestryOfNewDecendent( String pWinName, JavaScriptObject pWinHandle ) {
56 + for ( int i = 0; i < sAncestorWinHandles.size(); i++ ) {
68 57 JavaScriptObject zAncestorWinHandle = sAncestorWinHandles.get( i );
69 58 String zError = notifyNewDecendent( zAncestorWinHandle, pWinName, pWinHandle );
70 - if ( zError.length() == 0 )
71 - {
59 + if ( zError.length() == 0 ) {
72 60 return; // Success!
73 61 }
74 62 LOGGER.debug.log( "Ancestor( ", i, " ): ", zError );
  @@ -79,13 +67,11 @@
79 67
80 68 private static Map<String, String> sFutureChildren = new HashMap<String, String>();
81 69
82 - private static void registerFutureChild( String pWinName, String pUrl )
83 - {
70 + private static void registerFutureChild( String pWinName, String pUrl ) {
84 71 sFutureChildren.put( pWinName, pUrl );
85 72 }
86 73
87 - public static void openChildWindow( String pWinName, String pUrl )
88 - {
74 + public static void openChildWindow( String pWinName, String pUrl ) {
89 75 registerFutureChild( pWinName, pUrl );
90 76 JavaScriptObject zNewWinHandle = openNewWindow( "ServerApp?NewWindowPage", //
91 77 pWinName, //
  @@ -93,17 +79,12 @@
93 79 report( "openNewWindow", pWinName, zNewWinHandle );
94 80 }
95 81
96 - private static void report( String pMethod, String pWinName, JavaScriptObject pWinHandle )
97 - {
98 - if ( LOGGER.debug.isEnabled() )
99 - {
82 + private static void report( String pMethod, String pWinName, JavaScriptObject pWinHandle ) {
83 + if ( LOGGER.debug.isEnabled() ) {
100 84 StringBuilder sb = new StringBuilder().append( pMethod ).append( "( '" ).append( pWinName ).append( "' ): " );
101 - if ( pWinHandle == null )
102 - {
85 + if ( pWinHandle == null ) {
103 86 sb.append( "null" );
104 - }
105 - else
106 - {
87 + } else {
107 88 sb.append( "State: " ).append( NativeExtendedFamilyManagerSupport.getWindowState( pWinHandle ) );
108 89 // sb.append( " X: " ).append( getWindowPosX( pWinHandle ) );
109 90 // sb.append( " Y: " ).append( getWindowPosY( pWinHandle ) );
  @@ -114,32 +95,27 @@
114 95
115 96 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv called from NativeExtendedFamilyManagerSupport vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
116 97
117 - public static JavaScriptObject getAncestor( Integer pIndex )
118 - {
98 + public static JavaScriptObject getAncestor( Integer pIndex ) {
119 99 return LLgetAncestor( (pIndex != null) ? pIndex : -1 );
120 100 }
121 101
122 - protected static void registerAncestor( JavaScriptObject pWinHandle )
123 - {
102 + protected static void registerAncestor( JavaScriptObject pWinHandle ) {
124 103 sAncestorWinHandles.add( pWinHandle );
125 104 LOGGER.debug.log( "registerAncestor: ", sAncestorWinHandles.size() );
126 105 }
127 106
128 - protected static void registerNewChildWindow( String pWinName, JavaScriptObject pWinHandle )
129 - {
107 + protected static void registerNewChildWindow( String pWinName, JavaScriptObject pWinHandle ) {
130 108 report( "regNewChild", pWinName, pWinHandle );
131 109 }
132 110
133 - protected static String ackNewChildWindow( String pWinName, JavaScriptObject pWinHandle )
134 - {
111 + protected static String ackNewChildWindow( String pWinName, JavaScriptObject pWinHandle ) {
135 112 report( "ackNewChild", pWinName, pWinHandle );
136 113 notifyAncestryOfNewDecendent( pWinName, pWinHandle );
137 114 String zUrl = sFutureChildren.remove( pWinName );
138 115 return (zUrl != null) ? zUrl : "ServerApp?RealPage";
139 116 }
140 117
141 - protected static void newDecendentWindow( String pWinName, JavaScriptObject pWinHandle )
142 - {
118 + protected static void newDecendentWindow( String pWinName, JavaScriptObject pWinHandle ) {
143 119 report( "ackNewDecendent", pWinName, pWinHandle );
144 120 notifyAncestryOfNewDecendent( pWinName, pWinHandle );
145 121 }