KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > google > gwt > user > client > ui > impl > FormPanelImplIE6


1 /*
2  * Copyright 2007 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5  * use this file except in compliance with the License. You may obtain a copy of
6  * the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13  * License for the specific language governing permissions and limitations under
14  * the License.
15  */

16 package com.google.gwt.user.client.ui.impl;
17
18 import com.google.gwt.user.client.Element;
19
20 /**
21  * IE6 implementation of {@link com.google.gwt.user.client.ui.impl.FormPanelImpl}.
22  */

23 public class FormPanelImplIE6 extends FormPanelImpl {
24
25   public native void hookEvents(Element iframe, Element form, FormPanelImplHost listener) /*-{
26     if (iframe) {
27       iframe.onreadystatechange = function() {
28         // If there is no __formAction yet, this is a spurious onreadystatechange
29         // generated when the iframe is first added to the DOM.
30         if (!iframe.__formAction)
31           return;
32
33         if (iframe.readyState == 'complete') {
34           // If the iframe's contentWindow has not navigated to the expected action
35           // url, then it must be an error, so we ignore it.
36           listener.@com.google.gwt.user.client.ui.impl.FormPanelImplHost::onFrameLoad()();
37         }
38       };
39     }
40
41     form.onsubmit = function() {
42       // Hang on to the form's action url, needed in the
43       // onload/onreadystatechange handler.
44       if (iframe)
45         iframe.__formAction = form.action;
46       return listener.@com.google.gwt.user.client.ui.impl.FormPanelImplHost::onFormSubmit()();
47     };
48   }-*/
;
49
50   public native void unhookEvents(Element iframe, Element form) /*-{
51     if (iframe)
52       iframe.onreadystatechange = null;
53     form.onsubmit = null;
54   }-*/
;
55 }
56
Popular Tags