Source Code Cross Referenced for Form.java in  » Ajax » gwtext-2.01 » com » gwtext » client » widgets » form » 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.form 
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.form;
010:
011:        import com.google.gwt.core.client.JavaScriptObject;
012:        import com.gwtext.client.core.Connection;
013:        import com.gwtext.client.core.UrlParam;
014:        import com.gwtext.client.data.Record;
015:        import com.gwtext.client.util.JavaScriptObjectHelper;
016:        import com.gwtext.client.widgets.BaseExtWidget;
017:        import com.gwtext.client.widgets.form.event.FormListener;
018:
019:        /**
020:         * Form widget.
021:         */
022:        public class Form extends BaseExtWidget {
023:
024:            public Form(JavaScriptObject jsObj) {
025:                super (jsObj);
026:            }
027:
028:            protected native JavaScriptObject create(JavaScriptObject config)/*-{
029:                    return new $wnd.Ext.form.BasicForm(config);
030:                }-*/;
031:
032:            public static Form instance(JavaScriptObject formJS) {
033:                return new Form(formJS);
034:            }
035:
036:            /**
037:             * Add a Field to the current open container (e.g. column, fieldset, etc.).
038:             * 
039:             * @param field the field to add
040:             */
041:            public native void add(Field field) /*-{
042:                  var form = this.@com.gwtext.client.widgets.BaseExtWidget::jsObj;
043:                  var fieldJS = field.@com.gwtext.client.widgets.BaseExtWidget::jsObj;
044:                  form.add(fieldJS);
045:              }-*/;
046:
047:            /**
048:             * Copies all properties of the passed config to all fields in this form with the passed object if they don't already exist.
049:             * 
050:             * @param fieldConfig the config object
051:             */
052:            //TODO
053:            /*public native void applyIfToFields(FieldConfig fieldConfig) *//*-{
054:                    var field = this .@com.gwtext.client.widgets.BaseExtWidget::jsObj;
055:                    var configJS = fieldConfig.@com.gwtext.client.core.JsObject::getJsObj()();
056:                    field.applyIfToFields(configJS);
057:                }-*//*;
058:             */
059:            /**
060:             * Copies all properties of the passed config to all fields in this form with the passed object.
061:             *
062:             * @param fieldConfig the config object
063:             */
064:            //TODO
065:            /*    public native void applyToFields(FieldConfig fieldConfig) *//*-{
066:                    var field = this .@com.gwtext.client.widgets.BaseExtWidget::jsObj;
067:                    var configJS = fieldConfig.@com.gwtext.client.core.JsObject::getJsObj()();
068:                    field.applyToFields(configJS);
069:                }-*//*;*/
070:
071:            /**
072:             * Clears all invalid messages in this form.
073:             */
074:            public native void clearInvalid() /*-{
075:                   var form = this.@com.gwtext.client.widgets.BaseExtWidget::jsObj;
076:                   form.clearInvalid();
077:               }-*/;
078:
079:            /**
080:             * Find a {@link Field} in this form by id, dataIndex, name or hiddenName.
081:             * 
082:             * @param id the field ID,dataIndex, name or hiddenName to search for
083:             * @return the field
084:             */
085:            public native Field findField(String id)/*-{
086:                    var form = this.@com.gwtext.client.widgets.BaseExtWidget::jsObj;
087:                    var fieldJS =  form.findField(id);
088:                    return fieldJS != null ? @com.gwtext.client.widgets.ComponentFactory::getComponent(Lcom/google/gwt/core/client/JavaScriptObject;)(fieldJS) : null;
089:                }-*/;
090:
091:            //todo add getValues() that returns Map
092:            /**
093:             * Returns the fields in this form as a String
094:             * 
095:             * @return form vield values as String
096:             */
097:            public native String getValues() /*-{
098:                   var form = this.@com.gwtext.client.widgets.BaseExtWidget::jsObj;
099:                   return form.getValues(true);
100:               }-*/;
101:
102:            /**
103:             * Returns true if any fields in this form have changed since their original load.
104:             *
105:             * @return true if dirty
106:             */
107:            public native boolean isDirty() /*-{
108:                   var form = this.@com.gwtext.client.widgets.BaseExtWidget::jsObj;
109:                   return form.isDirty();
110:               }-*/;
111:
112:            /**
113:             * Returns true if client-side validation on the form is successful.
114:             *
115:             * @return true if valid
116:             */
117:            public native boolean isValid() /*-{
118:                   var form = this.@com.gwtext.client.widgets.BaseExtWidget::jsObj;
119:                   return form.isValid();
120:               }-*/;
121:
122:            //http://extjs.com/forum/showthread.php?t=4340
123:            public void load(String url) {
124:                JavaScriptObject configJS = JavaScriptObjectHelper
125:                        .createObject();
126:                JavaScriptObjectHelper.setAttribute(configJS, "url", url);
127:                load(configJS);
128:            }
129:
130:            public void load(String url, UrlParam[] params,
131:                    Connection.Method method, String waitMsg) {
132:                JavaScriptObject configJS = JavaScriptObjectHelper
133:                        .createObject();
134:                JavaScriptObjectHelper.setAttribute(configJS, "url", url);
135:                if (params != null && params.length > 0) {
136:                    JavaScriptObject paramObj = UrlParam.getJsObj(params);
137:                    JavaScriptObjectHelper.setAttribute(configJS, "params",
138:                            paramObj);
139:                }
140:
141:                if (method != null) {
142:                    JavaScriptObjectHelper.setAttribute(configJS, "method",
143:                            method.getMethod());
144:                }
145:                if (waitMsg != null) {
146:                    JavaScriptObjectHelper.setAttribute(jsObj, "waitMsg",
147:                            waitMsg);
148:                }
149:                load(configJS);
150:            }
151:
152:            private native void load(JavaScriptObject configJS) /*-{
153:            	var form = this.@com.gwtext.client.widgets.BaseExtWidget::jsObj;
154:            	form.load(configJS);
155:            }-*/;
156:
157:            /**
158:             * Loads a {@link Record} into this form. The name of the Fields in the {@link com.gwtext.client.data.RecordDef}
159:             * must match the names of the Fields in the From.
160:             *
161:             * @param record the Record to load
162:             */
163:            public native void loadRecord(Record record) /*-{
164:            	var form = this.@com.gwtext.client.widgets.BaseExtWidget::jsObj;
165:            	var recordJS  = record.@com.gwtext.client.core.JsObject::getJsObj()();
166:            	form.loadRecord(recordJS);
167:            }-*/;
168:
169:            //markInvalid( )  - no need since can findField by ID and call markInvalid on field itself
170:
171:            /**
172:             * Removes a field from the items collection (does NOT remove its markup).
173:             *
174:             * @param field the field to remove
175:             */
176:            public native void remove(Field field) /*-{
177:                var form = this.@com.gwtext.client.widgets.BaseExtWidget::jsObj;
178:            	var fieldJS  = field.@com.gwtext.client.widgets.BaseExtWidget::jsObj;
179:            	form.remove(fieldJS);
180:            }-*/;
181:
182:            /**
183:             * Resets this form.
184:             */
185:            public native void reset() /*-{
186:                   var form = this.@com.gwtext.client.widgets.BaseExtWidget::jsObj;
187:                   form.reset();
188:               }-*/;
189:
190:            //setValues  -- no need for now
191:
192:            /**
193:             * Shortcut to do a submit action.
194:             */
195:            public native void submit() /*-{
196:                   var form = this.@com.gwtext.client.widgets.BaseExtWidget::jsObj;
197:                   form.submit();
198:               }-*/;
199:
200:            /**
201:             * Submit the form.
202:             *
203:             * @param url the url to sumbit to
204:             */
205:            public void submit(String url) {
206:                JavaScriptObject configJS = JavaScriptObjectHelper
207:                        .createObject();
208:                JavaScriptObjectHelper.setAttribute(configJS, "url", url);
209:                submit(configJS);
210:            }
211:
212:            /**
213:             * Subit the form.
214:             * @param url the url to submit to
215:             * @param params additional params to submit
216:             * @param method the submit method
217:             * @param waitMsg the wait message
218:             * @param clientValidation pass true to call form.isValid() prior to posting to validate the form on the client (defaults to false)
219:             *
220:             * @see com.gwtext.client.core.Connection#GET
221:             * @see com.gwtext.client.core.Connection#POST
222:             */
223:            public void submit(String url, UrlParam[] params,
224:                    Connection.Method method, String waitMsg,
225:                    boolean clientValidation) {
226:                JavaScriptObject configJS = JavaScriptObjectHelper
227:                        .createObject();
228:                JavaScriptObjectHelper.setAttribute(configJS, "url", url);
229:                if (params != null && params.length > 0) {
230:                    JavaScriptObject paramObj = UrlParam.getJsObj(params);
231:                    JavaScriptObjectHelper.setAttribute(configJS, "params",
232:                            paramObj);
233:                }
234:
235:                if (method != null) {
236:                    JavaScriptObjectHelper.setAttribute(configJS, "method",
237:                            method.getMethod());
238:                }
239:                if (waitMsg != null) {
240:                    JavaScriptObjectHelper.setAttribute(configJS, "waitMsg",
241:                            waitMsg);
242:                }
243:                JavaScriptObjectHelper.setAttribute(configJS,
244:                        "clientValidation", clientValidation);
245:                submit(configJS);
246:            }
247:
248:            /**
249:             * Submit the form using the specified configuration.
250:             *
251:             * @param configJS form submit config
252:             */
253:            public native void submit(JavaScriptObject configJS) /*-{
254:                   var form = this.@com.gwtext.client.widgets.BaseExtWidget::jsObj;
255:            	form.submit(configJS);
256:            }-*/;
257:
258:            /**
259:             * Persists the values in this Form into the passed Record object.
260:             * 
261:             * @param record the record to edit
262:             */
263:            public native void updateRecord(Record record) /*-{
264:            	var form = this.@com.gwtext.client.widgets.BaseExtWidget::jsObj;
265:            	var recordJS  = record.@com.gwtext.client.core.JsObject::getJsObj()();
266:            	form.updateRecord(recordJS);
267:            }-*/;
268:
269:            /**
270:             * Add a Form listener.
271:             *
272:             * @param listener the form listener
273:             */
274:            public native void addListener(FormListener listener) /*-{
275:                   var formJ = this;
276:                   var form = this.@com.gwtext.client.widgets.BaseExtWidget::jsObj;
277:
278:                   form.addListener('actioncomplete',
279:                           function(frm, action) {
280:                               var responseText = '';
281:                               var status = 200;
282:                               if(action.response && action.response != null) {
283:                                   responseText = action.response.responseText;
284:                                   status = action.response.status;
285:                               }
286:                               listener.@com.gwtext.client.widgets.form.event.FormListener::onActionComplete(Lcom/gwtext/client/widgets/form/Form;ILjava/lang/String;)(formJ, status, responseText);
287:                           }
288:                   );
289:
290:                   form.addListener('actionfailed',
291:                           function(frm, action) {
292:                               var responseText = '';
293:                               var status = 200;
294:                               if(action.response && action.response != null) {
295:                                   responseText = action.response.responseText;
296:                                   status = action.response.status;
297:                               }
298:                               listener.@com.gwtext.client.widgets.form.event.FormListener::onActionFailed(Lcom/gwtext/client/widgets/form/Form;ILjava/lang/String;)(formJ, status, '');
299:                           }
300:                   );
301:
302:                   form.addListener('beforeaction',
303:                           function(frm) {
304:                               return listener.@com.gwtext.client.widgets.form.event.FormListener::doBeforeAction(Lcom/gwtext/client/widgets/form/Form;)(formJ);
305:                           }
306:                   );
307:               }-*/;
308:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.