Source Code Cross Referenced for XmlReader.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.util.JavaScriptObjectHelper;
013:
014:        /**
015:         * Data reader class to create an Array of{@link Record} objects from an XML document based on mappings.
016:         * <p/>
017:         * <p/>
018:         * Note that in order for the browser to parse a returned XML document, the Content-Type header in the HTTP response must be set to "text/xml".
019:         * Example code :
020:         * <p/>
021:         * <pre>
022:         * <code>
023:         * <p/>
024:         * RecordDef recordDef = new RecordDef(new FieldDef[] {
025:         *         new StringFieldDef("name", "name"), // "mapping" property not needed if it's the same as "name"
026:         *         new StringFieldDef("occupation")  // This field will use "occupation" as the mapping.
027:         * });
028:         * XmlReaderConfig config = new XmlReaderConfig();
029:         * config.setRecord("row");
030:         * config.setId("id");
031:         * config.setTotalRecords("results");
032:         * <p/>
033:         * XmlReader reader = new XmlReader(config, recordDef);
034:         * </code>
035:         * </pre>
036:         * <p/>
037:         * This would consume XML like:
038:         * <pre>
039:         * <code>
040:         * <p/>
041:         * &lt;?xml?&gt;
042:         * &lt;dataset&gt;
043:         *  &lt;results&gt;2</results&gt;
044:         *  &lt;row&gt;
045:         *    &lt;id&gt;1</id&gt;
046:         *    &lt;name&gt;Bill</name&gt;
047:         *    &lt;occupation&gt;Gardener</occupation&gt;
048:         *  &lt;/row&gt;
049:         *  &lt;row&gt;
050:         *    &lt;id&gt;2</id&gt;
051:         *    &lt;name&gt;Ben</name&gt;
052:         *    &lt;occupation&gt;Horticulturalist</occupation&gt;
053:         *  &lt;/row&gt;
054:         * &lt;/dataset&gt;&lt;/code></pre>
055:         */
056:        public class XmlReader extends Reader {
057:
058:            /**
059:             * Construct a new XmlReader.
060:             *
061:             * @param record    the name of the record tag in the XML data
062:             * @param recordDef the record def
063:             */
064:            public XmlReader(String record, RecordDef recordDef) {
065:                setRecord(record);
066:                setRecordDef(recordDef);
067:            }
068:
069:            protected native JavaScriptObject create(JavaScriptObject config,
070:                    JavaScriptObject recordDef) /*-{
071:                   return new $wnd.Ext.data.XmlReader(config, recordDef);
072:               }-*/;
073:
074:            //config
075:            /**
076:             * The {@link com.gwtext.client.core.DomQuery} path relative from the record element to the element that contains a record identifier value..
077:             * The simples case is the tag name in the XML that maps to the Record ID
078:             *
079:             * @param id the ID
080:             */
081:            public void setId(String id) {
082:                JavaScriptObjectHelper.setAttribute(configJS, "id", id);
083:            }
084:
085:            /**
086:             * The {@link com.gwtext.client.core.DomQuery} path to the repeated element which contains record information. The simples
087:             * case is the tag name in the XML that maps to the root tag of what corresponnds to a "record".
088:             *
089:             * @param record the record mapping
090:             */
091:            public void setRecord(String record) {
092:                JavaScriptObjectHelper.setAttribute(configJS, "record", record);
093:            }
094:
095:            /**
096:             * The {@link com.gwtext.client.core.DomQuery} path to the success attribute used by forms.
097:             *
098:             * @param success the success {@link com.gwtext.client.core.DomQuery} path.
099:             */
100:            public void setSuccess(String success) {
101:                JavaScriptObjectHelper.setAttribute(configJS, "success",
102:                        success);
103:            }
104:
105:            /**
106:             * The {@link com.gwtext.client.core.DomQuery} path from which to retrieve the total number of records in the dataset.
107:             * This is only needed if the whole dataset is not passed in one go, but is being paged from the remote server.
108:             *
109:             * @param totalRecords the totalRecords DomQuery path
110:             */
111:            public void setTotalRecords(String totalRecords) {
112:                JavaScriptObjectHelper.setAttribute(configJS, "totalRecords",
113:                        totalRecords);
114:            }
115:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.