Source Code Cross Referenced for ComponentFactory.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:        package com.gwtext.client.widgets;
009:
010:        import com.google.gwt.core.client.JavaScriptObject;
011:        import com.gwtext.client.util.JavaScriptObjectHelper;
012:        import com.gwtext.client.widgets.form.*;
013:        import com.gwtext.client.widgets.grid.EditorGridPanel;
014:        import com.gwtext.client.widgets.grid.GridPanel;
015:        import com.gwtext.client.widgets.grid.PropertyGridPanel;
016:        import com.gwtext.client.widgets.menu.Item;
017:
018:        /**
019:         * Component factory class.
020:         */
021:        public class ComponentFactory {
022:
023:            /**
024:             * Return a Component from the passed native component object.
025:             *
026:             * @param jsObj native object
027:             * @return the corresponding Component.
028:             * @see com.gwtext.client.widgets.Component
029:             */
030:            public static Component getComponent(JavaScriptObject jsObj) {
031:                Object componentJ = JavaScriptObjectHelper
032:                        .getAttributeAsObject(jsObj, "__compJ");
033:                if (componentJ != null) {
034:                    return (Component) componentJ;
035:                }
036:                String xtype = getXType(jsObj);
037:
038:                if (xtype == null) {
039:                    //commenting out now because only issue with treenode passed as Component as noted below, and its not a serious issue
040:                    //uncomment once ext fixes.
041:                    //http://extjs.com/forum/showthread.php?t=2324
042:                    //String message = "Illegal Component without xtype " + JavaScriptObjectHelper.getPropertiesAsString(jsObj);
043:                    //GWT.log(message, new IllegalArgumentException(message));
044:                    return null;
045:                }
046:                if (xtype.equalsIgnoreCase("box")) {
047:                    return new BoxComponent(jsObj);
048:                } else if (xtype.equalsIgnoreCase("button")) {
049:                    return new Button(jsObj);
050:                } else if (xtype.equalsIgnoreCase("colorpalette")) {
051:                    return new ColorPalette(jsObj);
052:                } else if (xtype.equalsIgnoreCase("cycle")) {
053:                    return new CycleButton(jsObj);
054:                } else if (xtype.equalsIgnoreCase("dataview")) {
055:                    return new DataView(jsObj);
056:                } else if (xtype.equalsIgnoreCase("datepicker")) {
057:                    return new DatePicker(jsObj);
058:                } else if (xtype.equalsIgnoreCase("editor")) {
059:                    return new Editor(jsObj);
060:                } else if (xtype.equalsIgnoreCase("editorgrid")) {
061:                    return new EditorGridPanel(jsObj);
062:                } else if (xtype.equalsIgnoreCase("propertygrid")) {
063:                    return new PropertyGridPanel(jsObj);
064:                } else if (xtype.equalsIgnoreCase("grid")) {
065:                    return new GridPanel(jsObj);
066:                } else if (xtype.equalsIgnoreCase("paging")) {
067:                    return new PagingToolbar(jsObj);
068:                } else if (xtype.equalsIgnoreCase("button")) {
069:                    return new Button(jsObj);
070:                } else if (xtype.equalsIgnoreCase("panel")) {
071:                    return new Panel(jsObj);
072:                } else if (xtype.equalsIgnoreCase("progress")) {
073:                    return new ProgressBar(jsObj);
074:                } else if (xtype.equalsIgnoreCase("splitbutton")) {
075:                    return new SplitButton(jsObj);
076:                } else if (xtype.equalsIgnoreCase("tabpanel")) {
077:                    return new TabPanel(jsObj);
078:                } else if (xtype.equalsIgnoreCase("window")) {
079:                    return new Window(jsObj);
080:                } else if (xtype.equalsIgnoreCase("gwtwidget")) {
081:                    return new WidgetComponent(jsObj);
082:                }
083:                //toolbar components - tbitem, tbseparator, tbspacer, tbfill, tbtext, tbbutton, tbsplit?
084:                else if (xtype.equalsIgnoreCase("toolbar")) {
085:                    return new Toolbar(jsObj);
086:                }
087:                //menu items
088:                else if (xtype.equalsIgnoreCase("menu-item")) {
089:                    return new Item(jsObj);
090:                }
091:                //form components
092:                else if (xtype.equalsIgnoreCase("checkbox")) {
093:                    return new Checkbox(jsObj);
094:                } else if (xtype.equalsIgnoreCase("combo")) {
095:                    return new ComboBox(jsObj);
096:                } else if (xtype.equalsIgnoreCase("datefield")) {
097:                    return new DateField(jsObj);
098:                } else if (xtype.equalsIgnoreCase("fieldset")) {
099:                    return new FieldSet(jsObj);
100:                } else if (xtype.equalsIgnoreCase("form")) {
101:                    return new FormPanel(jsObj);
102:                } else if (xtype.equalsIgnoreCase("hidden")) {
103:                    return new Hidden(jsObj);
104:                } else if (xtype.equalsIgnoreCase("htmleditor")) {
105:                    return new HtmlEditor(jsObj);
106:                } else if (xtype.equalsIgnoreCase("numberfield")) {
107:                    return new NumberField(jsObj);
108:                } else if (xtype.equalsIgnoreCase("radio")) {
109:                    return new Radio(jsObj);
110:                } else if (xtype.equalsIgnoreCase("textarea")) {
111:                    return new TextArea(jsObj);
112:                } else if (xtype.equalsIgnoreCase("textfield")) {
113:                    return new TextField(jsObj);
114:                } else if (xtype.equalsIgnoreCase("timefield")) {
115:                    return new TimeField(jsObj);
116:                } else {
117:                    throw new IllegalArgumentException("Unrecognized xtype "
118:                            + xtype);
119:                }
120:            }
121:
122:            private static native String getXType(JavaScriptObject jsObj) /*-{
123:                   //when a TreeNode is dragged out of a TreePanel, the Container 'remove' event is called with the TreeNode passed as the Component
124:                   //but a TreeNode is not a Component. temp fix until this is resolved.
125:                   //http://extjs.com/forum/showthread.php?t=2324
126:                   var xtype =  jsObj.getXType ? jsObj.getXType() : null;
127:            	return xtype === undefined ? null : xtype;
128:            }-*/;
129:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.