Source Code Cross Referenced for BaseExtWidget.java in  » Ajax » gwtext-2.01 » com » gwtext » client » widgets » 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 » gwtext 2.01 » com.gwtext.client.widgets 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * GWT-Ext Widget Library
003:         * Copyright(c) 2007-2008, GWT-Ext.
004:         * licensing@gwt-ext.com
005:         * 
006:         * http://www.gwt-ext.com/license
007:         */
008:
009:        package com.gwtext.client.widgets;
010:
011:        import com.google.gwt.core.client.JavaScriptObject;
012:        import com.google.gwt.user.client.DOM;
013:        import com.google.gwt.user.client.Element;
014:        import com.google.gwt.user.client.ui.Widget;
015:        import com.gwtext.client.core.ExtElement;
016:
017:        /**
018:         * Base abstract Widget class.
019:         */
020:        public abstract class BaseExtWidget extends Widget {
021:
022:            protected JavaScriptObject jsObj;
023:
024:            protected BaseExtWidget() {
025:            }
026:
027:            protected BaseExtWidget(JavaScriptObject jsObj) {
028:                this .jsObj = jsObj;
029:                setElement(getElement(this .jsObj));
030:            }
031:
032:            public JavaScriptObject getJsObj() {
033:                return jsObj;
034:            }
035:
036:            public void setJsObj(JavaScriptObject jsObj) {
037:                this .jsObj = jsObj;
038:            }
039:
040:            public ExtElement getEl() {
041:                return jsObj == null ? null : new ExtElement(getElement());
042:            }
043:
044:            //jsObj is JS object representing the UI Widget
045:            //jsObj.el is the ExtElement of the Widget
046:            //jsObj.el.dom is the DOM Element of the widget
047:            protected native Element getElement(JavaScriptObject jsObj) /*-{
048:                   //var el = jsObj.el;
049:                   var el = jsObj.getEl().dom;
050:                   if(el == null || el === undefined) {
051:                       return null;
052:                       //forms buttons are detached when initially added
053:                       //throw new Error('Widget ' + jsObj + ' has no element property set');
054:                   } else {
055:                       //There's an inconsistency in Ext where most elements have the property 'el' set to Ext's Element
056:                       //with the exception of Menu->Item, Menu->Separator, Menu->TextItem,  Toolbar.Item and subclasses
057:                       //(Toolbar.Separator, Toolbar.Spacer, Toolbar.TextItem) where the 'el' property is set to
058:                       //the DOM element itself. Therefore retruning 'el' if 'el' is not Ext's Element. See details in issue 39.
059:                        return el.dom || el ;
060:                   }
061:               }-*/;
062:
063:            protected void onLoad() {
064:                if (getElement() == null) {
065:                    setElement(getElement(jsObj));
066:                }
067:            }
068:
069:            protected void onAttach() {
070:                super .onAttach();
071:            }
072:
073:            /*protected void onAttach() {
074:            	super.onAttach();
075:            	Widget parent = getParent();
076:            	if(!isRendered()) {
077:            		render(parent.getElement());
078:            	}
079:
080:            }
081:             */
082:            /*public Element getElement() {
083:                if (super.getElement() == null) {
084:            	if(!isRendered()) {
085:            		render(parent.getElement());
086:            	}
087:            		setElement(getElement(jsObj));
088:                }
089:                return super.getElement();
090:            }*/
091:
092:            public int getOffsetHeight() {
093:                return DOM.getElementPropertyInt(getElement(), "offsetHeight");
094:            }
095:
096:            public int getOffsetWidth() {
097:                return DOM.getElementPropertyInt(getElement(), "offsetWidth");
098:            }
099:
100:            protected Element getStyleElement() {
101:                return getElement();
102:            }
103:
104:            public String getTitle() {
105:                return DOM.getElementProperty(getElement(), "title");
106:            }
107:
108:            public boolean isVisible() {
109:                return isVisible(getElement());
110:            }
111:
112:            public native void purgeListeners() /*-{
113:                   var widget = this.@com.gwtext.client.widgets.Component::getJsObj()();
114:                   widget.purgeListeners();
115:               }-*/;
116:
117:            public void setHeight(String height) {
118:                // This exists to deal with an inconsistency in IE's implementation where
119:                // it won't accept negative numbers in length measurements
120:                assert extractLengthValue(height.trim().toLowerCase()) >= 0 : "CSS heights should not be negative";
121:                DOM.setStyleAttribute(getElement(), "height", height);
122:            }
123:
124:            private native double extractLengthValue(String s) /*-{
125:               if (s == "auto" || s == "inherit" || s == "") {
126:                 return 0;
127:               } else {
128:                 return parseFloat(s);
129:               }
130:             }-*/;
131:
132:            public void setTitle(String title) {
133:                if (title == null || title.length() == 0) {
134:                    DOM.removeElementAttribute(getElement(), "title");
135:                } else {
136:                    DOM.setElementAttribute(getElement(), "title", title);
137:                }
138:            }
139:
140:            public void setVisible(boolean visible) {
141:                setVisible(getElement(), visible);
142:            }
143:
144:            public void setWidth(String width) {
145:                // This exists to deal with an inconsistency in IE's implementation where
146:                // it won't accept negative numbers in length measurements
147:                assert extractLengthValue(width.trim().toLowerCase()) >= 0 : "CSS widths should not be negative";
148:                DOM.setStyleAttribute(getElement(), "width", width);
149:            }
150:
151:            public boolean equals(Object obj) {
152:                if (obj instanceof  BaseExtWidget) {
153:                    return getElement().equals(
154:                            ((BaseExtWidget) obj).getElement());
155:                } else {
156:                    return false;
157:                }
158:            }
159:
160:            public int hashCode() {
161:                return getElement().hashCode();
162:            }
163:
164:            public String toString() {
165:                return "element";
166:                /*if (getElement() == null) {
167:                    return "(null handle)";
168:                }
169:                return DOM.toString(getElement());*/
170:            }
171:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.