View Javadoc

1   /*--------------------------------------------------------------------------
2    *  Copyright 2007 utgenome.org
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of 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,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   *--------------------------------------------------------------------------*/
16  //--------------------------------------
17  // GenomeBrowser Project
18  //
19  // AbsoluteFocusPanel.java
20  // Since: Jun 13, 2007
21  //
22  // $URL$ 
23  // $Author$
24  //--------------------------------------
25  package org.utgenome.gwt.utgb.client.ui;
26  
27  import org.utgenome.gwt.utgb.client.track.Design;
28  
29  import com.google.gwt.event.dom.client.HasMouseDownHandlers;
30  import com.google.gwt.event.dom.client.HasMouseMoveHandlers;
31  import com.google.gwt.event.dom.client.MouseDownHandler;
32  import com.google.gwt.event.dom.client.MouseMoveHandler;
33  import com.google.gwt.event.shared.HandlerRegistration;
34  import com.google.gwt.user.client.DOM;
35  import com.google.gwt.user.client.ui.AbsolutePanel;
36  import com.google.gwt.user.client.ui.Image;
37  
38  /**
39   * Absolute panel with Focus panel
40   * 
41   * @author leo
42   * 
43   */
44  public class AbsoluteFocusPanel extends AbsolutePanel implements HasMouseDownHandlers, HasMouseMoveHandlers {
45  	private Image _focusPanel = new Image(Design.IMAGE_TRANSPARENT);
46  
47  	public AbsoluteFocusPanel() {
48  		add(_focusPanel, 0, 0);
49  		DOM.setStyleAttribute(_focusPanel.getElement(), "zIndex", "1000");
50  	}
51  
52  	public void setSize(String width, String height) {
53  		super.setSize(width, height);
54  		_focusPanel.setSize(width, height);
55  	}
56  
57  	public Image getFocusPanel() {
58  		return _focusPanel;
59  	}
60  
61  	public void clear() {
62  		super.clear();
63  		add(_focusPanel, 0, 0);
64  	}
65  
66  	public HandlerRegistration addMouseDownHandler(MouseDownHandler m) {
67  		return _focusPanel.addMouseDownHandler(m);
68  	}
69  
70  	public HandlerRegistration addMouseMoveHandler(MouseMoveHandler m) {
71  		return _focusPanel.addMouseMoveHandler(m);
72  	}
73  
74  }