KickJava   Java API By Example, From Geeks To Geeks.

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


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  * Internet Explorer 6 implementation of
22  * {@link com.google.gwt.user.client.ui.impl.PopupImpl}.
23  */

24 public class PopupImplIE6 extends PopupImpl {
25
26   public native void onHide(Element popup) /*-{
27     var frame = popup.__frame;
28     frame.parentElement.removeChild(frame);
29     popup.__frame = null;
30     frame.__popup = null;
31   }-*/
;
32
33   public native void onShow(Element popup) /*-{
34     // TODO: make this more Java and less JSNI?
35     var frame = $doc.createElement('iframe');
36
37     // Setting a src prevents mixed-content warnings.
38     // http://weblogs.asp.net/bleroy/archive/2005/08/09/how-to-put-a-div-over-a-select-in-ie.aspx
39     frame.src = "javascript:''";
40
41     frame.scrolling = 'no';
42     frame.frameBorder = 0;
43
44     popup.__frame = frame;
45     frame.__popup = popup;
46
47     // Make the frame shadow the popup
48     var style = frame.style;
49     style.position = 'absolute';
50
51     // Don't get in the way of transparency effects
52     style.filter = 'alpha(opacity=0)';
53
54     // takes effect immediately
55     style.left = popup.offsetLeft;
56     style.top = popup.offsetTop;
57     style.width = popup.offsetWidth;
58     style.height = popup.offsetHeight;
59         
60     // updates position and dimensions as popup is moved & resized
61     style.setExpression('left', 'this.__popup.offsetLeft');
62     style.setExpression('top', 'this.__popup.offsetTop');
63     style.setExpression('width', 'this.__popup.offsetWidth');
64     style.setExpression('height', 'this.__popup.offsetHeight');
65     popup.parentElement.insertBefore(frame, popup);
66   }-*/
;
67   
68   public native void setVisible(Element popup, boolean visible) /*-{
69     popup.__frame.style.visibility = visible ? 'visible' : 'hidden';
70   }-*/
;
71 }
72
Popular Tags