01: /*
02: * Copyright 2007 Google Inc.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
05: * use this file except in compliance with the License. You may obtain a copy of
06: * the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: @Override
26: public native void hookEvents(Element iframe, Element form,
27: FormPanelImplHost listener) /*-{
28: if (iframe) {
29: iframe.onreadystatechange = function() {
30: // If there is no __formAction yet, this is a spurious onreadystatechange
31: // generated when the iframe is first added to the DOM.
32: if (!iframe.__formAction)
33: return;
34:
35: if (iframe.readyState == 'complete') {
36: // If the iframe's contentWindow has not navigated to the expected action
37: // url, then it must be an error, so we ignore it.
38: listener.@com.google.gwt.user.client.ui.impl.FormPanelImplHost::onFrameLoad()();
39: }
40: };
41: }
42:
43: form.onsubmit = function() {
44: // Hang on to the form's action url, needed in the
45: // onload/onreadystatechange handler.
46: if (iframe)
47: iframe.__formAction = form.action;
48: return listener.@com.google.gwt.user.client.ui.impl.FormPanelImplHost::onFormSubmit()();
49: };
50: }-*/;
51:
52: @Override
53: public native void unhookEvents(Element iframe, Element form) /*-{
54: if (iframe)
55: iframe.onreadystatechange = null;
56: form.onsubmit = null;
57: }-*/;
58: }
|