Subversion Repository Public Repository

litesoft

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
// This Source Code is in the Public Domain per: http://unlicense.org
package org.litesoft.GWT.client.nonpublic;

import com.google.gwt.core.client.*;

public class NativeExtendedFamilyManagerSupport {
    public static native int getWindowState( JavaScriptObject pWinHandle ) /*-{
        try
        {
            if ( !pWinHandle )
                return 1;
            if ( pWinHandle.closed )
                return 2;
        }
        catch ( e )
        {
            return 3;
        }
        return 0;
    }-*/;

    public static native String notifyNewDecendent( JavaScriptObject pAncestorWinHandle, String pWinName, JavaScriptObject pWinHandle ) /*-{
        try
        {
            if ( pAncestorWinHandle )
            {
                if ( pAncestorWinHandle.closed )
                {
                    return "notifyNewDecendent: Opener Closed";
                }
                pAncestorWinHandle.newDecendent( pWinName, pWinHandle );
                return "";
            }
            return "notifyNewDecendent: No Opener";
        }
        catch ( e )
        {
            return "notifyNewDecendent: " + e;
        }
    }-*/;

    public static native JavaScriptObject openNewWindow( String pUrl, String pWinName, String pLaunchAppParams ) /*-{
        var zWinHandle = $wnd.open( pUrl, pWinName, pLaunchAppParams );
        if ( zWinHandle )
        {
            if ( !zWinHandle.opener )
            {
                zWinHandle.opener = $wnd;
            }
            if ( !zWinHandle.closed )
            {
                try
                {
                    @org.litesoft.GWT.client.nonpublic.ExtendedFamilyManager::registerNewChildWindow(Ljava/lang/String;
Lcom/google/gwt/core/client/JavaScriptObject;)( pWinName, zWinHandle );
                }
                catch ( e )
                {
                    alert( "openNewWindow -> registerNewChildWindow\n\n" + e );
                }
            }
        }
        return zWinHandle;
    }-*/;

    public static native void buildCurrentlyActiveDirectAncestry() /*-{
        var zOpener = $wnd.opener || null;
        var zDepth = 1;
        var zPhase = 1;
        try
        {
            while ( zOpener )
            {
                zPhase = 2;
                if ( zOpener.closed ) // JS documentation says this should be able to be called whenever!
                {
                    return;
                }
                zPhase = 3;
                @org.litesoft.GWT.client.nonpublic.ExtendedFamilyManager::registerAncestor(Lcom/google/gwt/core/client/JavaScriptObject;)( zOpener );
                zPhase = 4;
                zOpener = zOpener.opener || null;
                zDepth++;
                zPhase = 1;
            }
        }
        catch ( e )
        {
            alert( "buildAncestry( " + zDepth + " ):" + zPhase + "\n" + e );
        }
    }-*/;

    public static native void export() /*-{

        $wnd.getAncestorWinHandle = function ( pAncestorIndex )
        {
            try
            {
                return @org.litesoft.GWT.client.nonpublic.ExtendedFamilyManager::getAncestor(Ljava/lang/Integer;)( pAncestorIndex );
            }
            catch ( e )
            {
                alert( "NativeClientEventBusSupport.getAncestorWinHandle\n\n" + e );
            }
        }
        $wnd.childAcknowledge = function ( pWinName, pWinHandle )
        {
            try
            {
                return @org.litesoft.GWT.client.nonpublic.ExtendedFamilyManager::ackNewChildWindow(Ljava/lang/String;
Lcom/google/gwt/core/client/JavaScriptObject;)( pWinName, pWinHandle );
            }
            catch ( e )
            {
                alert( "NativeClientEventBusSupport.childAcknowledge\n\n" + e );
            }
        }
        $wnd.newDecendent = function ( pWinName, pWinHandle )
        {
            try
            {
                return @org.litesoft.GWT.client.nonpublic.ExtendedFamilyManager::newDecendentWindow(Ljava/lang/String;
Lcom/google/gwt/core/client/JavaScriptObject;)( pWinName, pWinHandle );
            }
            catch ( e )
            {
                alert( "NativeClientEventBusSupport.newDecendent\n\n" + e );
            }
        }
    }-*/;

    /**
     * Just being a bit parnoid about avoiding memory leaks in IE...
     */
    public static native void dispose() /*-{
        $wnd.getAncestorWinHandle = null;
        $wnd.childAcknowledge = null;
        $wnd.newDecendent = null;
    }-*/;

    public static native JavaScriptObject getAncestorIndexedWinHandle( JavaScriptObject pAncestorWinHandle, Integer pIndex ) /*-{
        try
        {
            if ( pAncestorWinHandle )
            {
                if ( !pAncestorWinHandle.closed )
                {
                    return pAncestorWinHandle.getAncestorWinHandle( pIndex );
                }
                alert( "getAncestorIndexedWinHandle:\nClosed" );
                return null;
            }
            alert( "getAncestorIndexedWinHandle:\nNo Handle" );
            return null;
        }
        catch ( e )
        {
            alert( "getAncestorIndexedWinHandle:\n" + e );
            return null;
        }
    }-*/;
}

Commits for litesoft/trunk/Java/GWT/Client/src/org/litesoft/GWT/client/nonpublic/NativeExtendedFamilyManagerSupport.java

Diff revisions: vs.
Revision Author Commited Message
948 Diff Diff GeorgeS picture GeorgeS Sat 07 Jun, 2014 23:42:39 +0000

Jusefuls Formatter Updated to New Code Format

947 Diff Diff GeorgeS picture GeorgeS Fri 06 Jun, 2014 23:36:56 +0000

Correct Spelling of package!

720 Diff Diff GeorgeS picture GeorgeS Sun 10 Jun, 2012 16:20:42 +0000
151 Diff Diff GeorgeS picture GeorgeS Thu 17 Mar, 2011 04:16:22 +0000
49 Diff Diff GeorgeS picture GeorgeS Mon 12 Apr, 2010 02:59:10 +0000

License Text

2 GeorgeS picture GeorgeS Sun 07 Feb, 2010 12:50:58 +0000