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


001:        package com.gwtext.client.widgets.grid;
002:
003:        import com.google.gwt.core.client.JavaScriptObject;
004:        import com.gwtext.client.core.NameValuePair;
005:        import com.gwtext.client.util.JavaScriptObjectHelper;
006:        import com.gwtext.client.widgets.grid.event.PropertyGridPanelListener;
007:
008:        import java.util.Map;
009:
010:        /**
011:         * A specialized grid implementation intended to mimic the traditional property grid as typically seen in development IDEs.
012:         * Each row in the grid represents a property of some object, and the data is stored as a set of name/value pairs
013:         */
014:        public class PropertyGridPanel extends EditorGridPanel {
015:
016:            static {
017:                init();
018:            }
019:
020:            //http://extjs.com/forum/showthread.php?t=23138
021:            private static native void init()/*-{
022:                    $wnd.Ext.reg('propertygrid', $wnd.Ext.grid.PropertyGrid);
023:                }-*/;
024:
025:            public String getXType() {
026:                return "propertygrid";
027:            }
028:
029:            /**
030:             * Create a new PropertGridPanel.
031:             */
032:            public PropertyGridPanel() {
033:            }
034:
035:            public PropertyGridPanel(JavaScriptObject jsObj) {
036:                super (jsObj);
037:            }
038:
039:            protected native JavaScriptObject create(JavaScriptObject configJS) /*-{
040:                   return new $wnd.Ext.grid.PropertyGrid(configJS);
041:               }-*/;
042:
043:            private void setSourceRendered(Map source) {
044:                JavaScriptObject sourceJS = JavaScriptObjectHelper
045:                        .convertMapToJavascriptObject(source);
046:                doSetSource(sourceJS);
047:            }
048:
049:            /**
050:             * Sets the source data object containing the property data. The data object can contain one or more name/value pairs
051:             * representing all of the properties of an object to display in the grid, and this data will automatically be loaded
052:             * into the grid's store. If the grid already contains data, this method will replace any existing data.
053:             *
054:             * @param source the data source
055:             */
056:            private void setSourceRendered(NameValuePair[] source) {
057:                JavaScriptObject sourceJS = NameValuePair.getJsObj(source);
058:                doSetSource(sourceJS);
059:            }
060:
061:            private native void doSetSource(JavaScriptObject source) /*-{
062:                   var grid = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
063:                   grid.setSource(source);
064:               }-*/;
065:
066:            /**
067:             * Add a PropertGridPanel listener.
068:             *
069:             * @param listener the listener.
070:             */
071:            public native void addPropertyGridPanelListener(
072:                    PropertyGridPanelListener listener) /*-{
073:                   var gridJ = this;
074:
075:                   this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('beforepropertychange',
076:                           function(self, recordID, value, oldValue) {
077:                               if(recordID === undefined) recordID = null;
078:                               var valueJ = (value  == null || value === undefined ) ? null : $wnd.GwtExt.convertToJavaType(value);
079:                               var oldValueJ = (oldValue  == null || oldValue === undefined ) ? null : $wnd.GwtExt.convertToJavaType(oldValue);
080:                               return listener.@com.gwtext.client.widgets.grid.event.PropertyGridPanelListener::doBeforePropertyChange(Lcom/gwtext/client/widgets/grid/PropertyGridPanel;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)(gridJ, recordID, valueJ, oldValueJ);
081:                           }
082:                   );
083:
084:                   this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('propertychange',
085:                           function(self, recordID, value, oldValue) {
086:                               if(recordID === undefined) recordID = null;
087:                               var valueJ = (value  == null || value === undefined ) ? null : $wnd.GwtExt.convertToJavaType(value);
088:                               var oldValueJ = (oldValue  == null || oldValue === undefined ) ? null : $wnd.GwtExt.convertToJavaType(oldValue);
089:                               listener.@com.gwtext.client.widgets.grid.event.PropertyGridPanelListener::onPropertyChange(Lcom/gwtext/client/widgets/grid/PropertyGridPanel;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)(gridJ, recordID, valueJ, oldValueJ);
090:                           }
091:                   );
092:               }-*/;
093:
094:            //--- config properties ---
095:
096:            /**
097:             * Sets the source data object containing the property data. The data object can contain one or more name/value pairs
098:             * representing all of the properties of an object to display in the grid, and this data will automatically be loaded
099:             * into the grid's store. If the grid already contains data, this method will replace any existing data.
100:             *
101:             * @param source the data source
102:             */
103:            public void setSource(NameValuePair[] source) {
104:                if (!isRendered()) {
105:                    JavaScriptObject sourceJS = NameValuePair.getJsObj(source);
106:                    setAttribute("source", sourceJS, true);
107:                } else {
108:                    setSourceRendered(source);
109:                }
110:            }
111:
112:            /**
113:             * Sets the source data object containing the property data. The data object can contain one or more name/value pairs
114:             * representing all of the properties of an object to display in the grid, and this data will automatically be loaded
115:             * into the grid's store. If the grid already contains data, this method will replace any existing data.
116:             *
117:             * @param source the data source
118:             */
119:            public void setSource(Map source) {
120:                if (!isRendered()) {
121:                    JavaScriptObject sourceJS = JavaScriptObjectHelper
122:                            .convertMapToJavascriptObject(source);
123:                    setAttribute("source", sourceJS, true);
124:                } else {
125:                    setSourceRendered(source);
126:                }
127:            }
128:
129:            /**
130:             * The value of the property name text.
131:             *
132:             * @param nameText the property name text
133:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
134:             */
135:            public void setNameText(String nameText)
136:                    throws IllegalStateException {
137:                setAttribute("nameText", nameText, true);
138:            }
139:
140:            /**
141:             * An object containing name/value pairs of custom editor type definitions that allow the grid to support additional
142:             * types of editable fields. By default, the grid supports strongly-typed editing of strings, dates, numbers and booleans
143:             * using built-in form editors, but any custom type can be supported and associated with a custom input control by specifying
144:             * a custom editor. The name of the editor type should correspond with the name of the property that will use the editor.
145:             * <p/>
146:             * <pre>
147:             * <code>
148:             * PropertyGridPanel grid = new PropertyGridPanel();
149:             * Map source = new HashMap();
150:             * source.put("Edit Time", "10:00 AM");
151:             * Map customEditors = new HashMap();
152:             * GridEditor timeEditor = new GridEditor(new TimeField());
153:             * customEditors.put("Edit Time", timeEditor);
154:             * grid.setCustomEditors(customEditors);</code>
155:             * </pre>    
156:             * 
157:             * @param customEditors custom editors
158:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
159:             */
160:            public void setCustomEditors(Map customEditors)
161:                    throws IllegalStateException {
162:                JavaScriptObjectHelper.setAttribute(config, "customEditors",
163:                        customEditors);
164:            }
165:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.