Source Code Cross Referenced for RecordDef.java in  » Ajax » gwtext-2.01 » com » gwtext » client » data » 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.data 
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.data;
010:
011:        import com.google.gwt.core.client.JavaScriptObject;
012:        import com.gwtext.client.core.JsObject;
013:        import com.gwtext.client.util.JavaScriptObjectHelper;
014:
015:        /**
016:         * A record definition where the fields in the source data of a {@link Reader} are declared.
017:         * <p/>
018:         * <pre>
019:         * <code>
020:         * <p/>
021:         * Object[][] states = new Object[][]{
022:         *               new Object[]{"AL", "Alabama"},
023:         *               new Object[]{"AK", "Alaska"},
024:         *               new Object[]{"AZ", "Arizona"},
025:         *               new Object[]{"AR", "Arkansas"},
026:         *               new Object[]{"CA", "California"}};
027:         * <p/>
028:         * Reader reader = new ArrayReader(new RecordDef(
029:         *                new FieldDef[]{
030:         *                       new StringFieldDef("abbr"),
031:         *                       new StringFieldDef("state")
032:         *               }));
033:         * <p/>
034:         * Store store = new Store(proxy, reader);
035:         * </code>
036:         * </pre>
037:         *
038:         * @see Store
039:         * @see com.gwtext.client.data.MemoryProxy
040:         */
041:        public class RecordDef extends JsObject {
042:
043:            private FieldDef[] fields;
044:
045:            /**
046:             * Construct a new RecordDef using the passed field definitions.
047:             *
048:             * @param fields the field defs
049:             */
050:            public RecordDef(FieldDef[] fields) {
051:                this .fields = fields;
052:                int numFields = fields.length;
053:                Object[] jsObjs = new Object[numFields];
054:                for (int i = 0; i < numFields; i++) {
055:                    JavaScriptObject jsObj = fields[i].getJsObj();
056:                    jsObjs[i] = jsObj;
057:                }
058:                jsObj = getJsObj(JavaScriptObjectHelper
059:                        .convertToJavaScriptArray(jsObjs));
060:            }
061:
062:            private native JavaScriptObject getJsObj(JavaScriptObject recordDef) /*-{
063:                   return $wnd.Ext.data.Record.create(recordDef);
064:               }-*/;
065:
066:            /**
067:             * Create a new Record instance using the passed data.
068:             *
069:             * @param id      the Record ID
070:             * @param rowData the record data
071:             * @return a Record instance
072:             */
073:            public Record createRecord(String id, Object[] rowData) {
074:                Record record = createRecord(rowData);
075:                record.setId(id);
076:                return record;
077:            }
078:
079:            /**
080:             * Create a new Record instance using the passed data.
081:             *
082:             * @param rowData the record data
083:             * @return a Record instance
084:             */
085:            public Record createRecord(Object[] rowData) {
086:                int numFields = fields.length;
087:                if (rowData.length != numFields) {
088:                    throw new IllegalArgumentException("Expected " + numFields
089:                            + " fields but was passed " + rowData.length
090:                            + " fields.");
091:                }
092:                MemoryProxy proxy = new MemoryProxy(new Object[][] { rowData });
093:                ArrayReader reader = new ArrayReader(this );
094:                Store temp = new Store(proxy, reader);
095:                temp.load();
096:                return temp.getAt(0);
097:            }
098:
099:            /**
100:             * Return the fields defined for this RecordDef.
101:             *
102:             * @return the field defs
103:             */
104:            public FieldDef[] getFields() {
105:                return fields;
106:            }
107:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.