Source Code Cross Referenced for DOMImplSafari.java in  » Ajax » GWT » com » google » gwt » user » client » impl » 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.user.client.impl 
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.user.client.impl;
017:
018:        import com.google.gwt.user.client.Element;
019:        import com.google.gwt.user.client.Event;
020:
021:        /**
022:         * Safari implementation of {@link com.google.gwt.user.client.impl.DOMImpl}.
023:         */
024:        class DOMImplSafari extends DOMImplStandard {
025:            @Override
026:            public native int eventGetClientX(Event evt) /*-{
027:               // In Safari2: clientX is wrong and pageX is returned instead.
028:               return evt.pageX - $doc.body.scrollLeft || -1;
029:             }-*/;
030:
031:            @Override
032:            public native int eventGetClientY(Event evt) /*-{
033:               // In Safari2: clientY is wrong and pageY is returned instead.
034:               return evt.pageY - $doc.body.scrollTop || -1;
035:             }-*/;
036:
037:            @Override
038:            public native int eventGetMouseWheelVelocityY(Event evt) /*-{
039:               return Math.round(-evt.wheelDelta / 40) || -1;
040:             }-*/;
041:
042:            @Override
043:            public native int getAbsoluteLeft(Element elem) /*-{
044:               // Unattached elements and elements (or their ancestors) with style
045:               // 'display: none' have no offsetLeft.
046:               if (elem.offsetLeft == null) {
047:                 return 0;
048:               }
049:
050:               var left = 0;
051:               var curr = elem.parentNode;
052:               if (curr) {
053:                 // This intentionally excludes body which has a null offsetParent.
054:                 while (curr.offsetParent) {
055:                   left -= curr.scrollLeft;
056:                   curr = curr.parentNode;
057:                 }
058:               }
059:               
060:               while (elem) {
061:                 left += elem.offsetLeft;
062:
063:                 // Safari bug: a top-level absolutely positioned element includes the
064:                 // body's offset position already.
065:                 var parent = elem.offsetParent;
066:                 if (parent && (parent.tagName == 'BODY') &&
067:                     (elem.style.position == 'absolute')) {
068:                   break;
069:                 }
070:
071:                 elem = parent;
072:               }
073:               return left;
074:             }-*/;
075:
076:            @Override
077:            public native int getAbsoluteTop(Element elem) /*-{
078:               // Unattached elements and elements (or their ancestors) with style
079:               // 'display: none' have no offsetTop.
080:               if (elem.offsetTop == null) {
081:                 return 0;
082:               }
083:
084:               var top = 0;
085:               var curr = elem.parentNode;
086:               if (curr) {
087:                 // This intentionally excludes body which has a null offsetParent.
088:                 while (curr.offsetParent) {
089:                   top -= curr.scrollTop;
090:                   curr = curr.parentNode;
091:                 }
092:               }
093:               
094:               while (elem) {
095:                 top += elem.offsetTop;
096:
097:                 // Safari bug: a top-level absolutely positioned element includes the
098:                 // body's offset position already.
099:                 var parent = elem.offsetParent;
100:                 if (parent && (parent.tagName == 'BODY') &&
101:                     (elem.style.position == 'absolute')) {
102:                   break;
103:                 }
104:
105:                 elem = parent;
106:               }
107:               return top;
108:             }-*/;
109:
110:            @Override
111:            public native void insertListItem(Element select, String text,
112:                    String value, int index) /*-{
113:               // We can't use the 'options' array due to a bug in Safari.
114:               // Read the comment above com.google.gwt.user.client.ui.ListBox.ImplSafari
115:               // for more information.
116:               var newOption = new Option(text, value);
117:               if (index == -1 || index > select.children.length - 1) {
118:                 select.appendChild(newOption);
119:               } else{
120:                 select.insertBefore(newOption, select.children[index]);
121:               }
122:             }-*/;
123:
124:            /**
125:             * Gets the height of the browser window's client area excluding the
126:             * scroll bar.
127:             * 
128:             * @return the window's client height
129:             */
130:            @Override
131:            public native int windowGetClientHeight() /*-{
132:               return $wnd.innerHeight;
133:             }-*/;
134:
135:            /**
136:             * Gets the width of the browser window's client area excluding the
137:             * vertical scroll bar.
138:             * 
139:             * @return the window's client width
140:             */
141:            @Override
142:            public native int windowGetClientWidth() /*-{
143:               return $wnd.innerWidth;
144:             }-*/;
145:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.