Source Code Cross Referenced for ModuleSpaceSaf.java in  » Ajax » GWT » com » google » gwt » dev » shell » mac » 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.mac 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2007 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.mac;
017:
018:        import com.google.gwt.dev.shell.CompilingClassLoader;
019:        import com.google.gwt.dev.shell.JsValue;
020:        import com.google.gwt.dev.shell.JsValueGlue;
021:        import com.google.gwt.dev.shell.ModuleSpace;
022:        import com.google.gwt.dev.shell.ModuleSpaceHost;
023:        import com.google.gwt.dev.shell.mac.LowLevelSaf.DispatchObject;
024:
025:        /**
026:         * An implementation of {@link com.google.gwt.dev.shell.ModuleSpace} for Safari.
027:         */
028:        public class ModuleSpaceSaf extends ModuleSpace {
029:
030:            private final int window;
031:
032:            /**
033:             * Constructs a browser interface for use with a global window object.
034:             * 
035:             * @param moduleName name of the module
036:             * @param key unique key for this instance of the module
037:             */
038:            public ModuleSpaceSaf(ModuleSpaceHost host, int scriptGlobalObject,
039:                    String moduleName, Object key) {
040:                super (host, moduleName, key);
041:
042:                // Hang on to the global execution state.
043:                //
044:                this .window = scriptGlobalObject;
045:                LowLevelSaf.gcLock(scriptGlobalObject);
046:            }
047:
048:            public void createNative(String file, int line,
049:                    String jsniSignature, String[] paramNames, String js) {
050:                // Execute the function definition within the browser, which will define
051:                // a new top-level function.
052:                //
053:                String newScript = createNativeMethodInjector(jsniSignature,
054:                        paramNames, js);
055:                LowLevelSaf.executeScriptWithInfo(LowLevelSaf
056:                        .getGlobalExecState(window), newScript, file, line);
057:            }
058:
059:            @Override
060:            public void dispose() {
061:                LowLevelSaf.gcUnlock(window, null);
062:                super .dispose();
063:            }
064:
065:            /**
066:             * Invokes a native JavaScript function.
067:             * 
068:             * @param name the name of the function to invoke
069:             * @param jthis the function's 'this' context
070:             * @param types the type of each argument
071:             * @param args the arguments to be passed
072:             * @return the return value as a Object.
073:             */
074:            @Override
075:            protected JsValue doInvoke(String name, Object jthis ,
076:                    Class<?>[] types, Object[] args) {
077:                CompilingClassLoader isolatedClassLoader = getIsolatedClassLoader();
078:
079:                JsValueSaf jsValueThis = new JsValueSaf();
080:                Class<?> jthis Type = (jthis  == null) ? Object.class : jthis 
081:                        .getClass();
082:                JsValueGlue.set(jsValueThis, isolatedClassLoader, jthis Type,
083:                        jthis );
084:                int jsthis  = jsValueThis.getJsValue();
085:
086:                int argc = args.length;
087:                int argv[] = new int[argc];
088:                for (int i = 0; i < argc; ++i) {
089:                    JsValueSaf jsValue = new JsValueSaf();
090:                    JsValueGlue.set(jsValue, isolatedClassLoader, types[i],
091:                            args[i]);
092:                    argv[i] = jsValue.getJsValue();
093:                }
094:
095:                int curExecState = LowLevelSaf.getExecState();
096:                int result = LowLevelSaf.invoke(curExecState, window, name,
097:                        jsthis , argv);
098:                return new JsValueSaf(result);
099:            }
100:
101:            @Override
102:            protected Object getStaticDispatcher() {
103:                return new WebKitDispatchAdapter(getIsolatedClassLoader());
104:            }
105:
106:            protected int wrapObjectAsJSObject(Object o) {
107:                if (o == null) {
108:                    return LowLevelSaf.jsNull();
109:                }
110:
111:                DispatchObject dispObj;
112:                if (o instanceof  DispatchObject) {
113:                    dispObj = (DispatchObject) o;
114:                } else {
115:                    dispObj = new WebKitDispatchAdapter(
116:                            getIsolatedClassLoader(), o);
117:                }
118:                return LowLevelSaf.wrapDispatch(dispObj);
119:            }
120:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.