Source Code Cross Referenced for BrowserWidgetMoz.java in  » Ajax » GWT » com » google » gwt » dev » shell » moz » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Ajax » GWT » com.google.gwt.dev.shell.moz 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2006 Google Inc.
003:         * 
004:         * Licensed under the Apache License, Version 2.0 (the "License"); you may not
005:         * use this file except in compliance with the License. You may obtain a copy of
006:         * the License at
007:         * 
008:         * http://www.apache.org/licenses/LICENSE-2.0
009:         * 
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
012:         * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
013:         * License for the specific language governing permissions and limitations under
014:         * the License.
015:         */
016:        package com.google.gwt.dev.shell.moz;
017:
018:        import com.google.gwt.core.ext.TreeLogger;
019:        import com.google.gwt.dev.shell.BrowserWidget;
020:        import com.google.gwt.dev.shell.BrowserWidgetHost;
021:        import com.google.gwt.dev.shell.LowLevel;
022:        import com.google.gwt.dev.shell.ModuleSpace;
023:        import com.google.gwt.dev.shell.ModuleSpaceHost;
024:        import com.google.gwt.dev.shell.moz.LowLevelMoz.ExternalFactory;
025:        import com.google.gwt.dev.shell.moz.LowLevelMoz.ExternalObject;
026:
027:        import org.eclipse.swt.events.DisposeEvent;
028:        import org.eclipse.swt.events.DisposeListener;
029:        import org.eclipse.swt.internal.mozilla.nsIWebBrowser;
030:        import org.eclipse.swt.widgets.Shell;
031:
032:        /**
033:         * Represents an individual browser window and all of its controls.
034:         */
035:        public class BrowserWidgetMoz extends BrowserWidget {
036:
037:            private class ExternalObjectImpl implements  ExternalObject {
038:
039:                public boolean gwtOnLoad(int scriptObject, String moduleName) {
040:                    try {
041:                        if (moduleName == null) {
042:                            // Indicates one or more modules are being unloaded.
043:                            //
044:                            handleUnload(scriptObject);
045:                            return true;
046:                        }
047:
048:                        Object key = new Integer(scriptObject);
049:                        // Attach a new ModuleSpace to make it programmable.
050:                        //
051:                        ModuleSpaceHost msh = getHost().createModuleSpaceHost(
052:                                BrowserWidgetMoz.this , moduleName);
053:                        ModuleSpace moduleSpace = new ModuleSpaceMoz(msh,
054:                                scriptObject, moduleName, key);
055:                        attachModuleSpace(moduleSpace);
056:                        return true;
057:                    } catch (Throwable e) {
058:                        // We do catch Throwable intentionally because there are a ton of things
059:                        // that can go wrong trying to load a module, including Error-derived
060:                        // things like NoClassDefFoundError.
061:                        // 
062:                        getHost().getLogger().log(TreeLogger.ERROR,
063:                                "Failure to load module '" + moduleName + "'",
064:                                e);
065:                        return false;
066:                    }
067:                }
068:
069:                /**
070:                 * Unload one or more modules.
071:                 * 
072:                 * @param scriptObject window to unload, 0 if all
073:                 */
074:                protected void handleUnload(int scriptObject) {
075:                    Integer key = null;
076:                    if (scriptObject != 0) {
077:                        key = new Integer(scriptObject);
078:                    }
079:                    doUnload(key);
080:                }
081:            }
082:
083:            public BrowserWidgetMoz(Shell shell, BrowserWidgetHost host) {
084:                super (shell, host);
085:                host.getLogger().log(
086:                        TreeLogger.DEBUG,
087:                        "Using Mozilla install at "
088:                                + MozillaInstall.getLoaded().getPath(), null);
089:
090:                // Expose a 'window.external' object factory. The created object's
091:                // gwtOnLoad() method will be called when a hosted mode application's
092:                // wrapper
093:                // HTML is done loading.
094:                //
095:                final ExternalFactory externalFactory = new ExternalFactory() {
096:
097:                    private ExternalObject externalObject = null;
098:
099:                    public ExternalObject createExternalObject() {
100:                        if (externalObject == null) {
101:                            externalObject = new ExternalObjectImpl();
102:                        }
103:                        return externalObject;
104:                    }
105:
106:                    public boolean matchesDOMWindow(int domWindow) {
107:                        nsIWebBrowser webBrowser = (nsIWebBrowser) LowLevel
108:                                .snatchFieldObjectValue(browser.getClass(),
109:                                        browser, "webBrowser");
110:                        int[] aContentDOMWindow = new int[1];
111:                        webBrowser.GetContentDOMWindow(aContentDOMWindow);
112:                        if (aContentDOMWindow[0] == domWindow) {
113:                            return true;
114:                        }
115:                        return false;
116:                    }
117:
118:                };
119:
120:                LowLevelMoz.registerExternalFactory(externalFactory);
121:
122:                addDisposeListener(new DisposeListener() {
123:                    public void widgetDisposed(DisposeEvent e) {
124:                        LowLevelMoz.unregisterExternalFactory(externalFactory);
125:                    }
126:                });
127:            }
128:
129:            @Override
130:            public String getUserAgent() {
131:                // OLD Mozilla. See UserAgent.gwt.xml
132:                return "gecko";
133:            }
134:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.