View Javadoc

1   /**
2    * Copyright 2010 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10   * software distributed under the License is distributed on an "AS IS"
11   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing
13   * permissions and limitations under the License.
14   */
15  
16  package org.kuali.student.common.ui.client.widgets;
17  
18  import com.google.gwt.event.dom.client.BlurEvent;
19  import com.google.gwt.event.dom.client.BlurHandler;
20  import com.google.gwt.event.dom.client.ClickEvent;
21  import com.google.gwt.event.dom.client.ClickHandler;
22  import com.google.gwt.event.dom.client.FocusEvent;
23  import com.google.gwt.event.dom.client.FocusHandler;
24  import com.google.gwt.event.dom.client.HasAllFocusHandlers;
25  import com.google.gwt.event.dom.client.HasAllKeyHandlers;
26  import com.google.gwt.event.dom.client.HasAllMouseHandlers;
27  import com.google.gwt.event.dom.client.HasClickHandlers;
28  import com.google.gwt.event.dom.client.KeyDownEvent;
29  import com.google.gwt.event.dom.client.KeyDownHandler;
30  import com.google.gwt.event.dom.client.KeyPressEvent;
31  import com.google.gwt.event.dom.client.KeyPressHandler;
32  import com.google.gwt.event.dom.client.KeyUpEvent;
33  import com.google.gwt.event.dom.client.KeyUpHandler;
34  import com.google.gwt.event.dom.client.MouseDownEvent;
35  import com.google.gwt.event.dom.client.MouseDownHandler;
36  import com.google.gwt.event.dom.client.MouseMoveEvent;
37  import com.google.gwt.event.dom.client.MouseMoveHandler;
38  import com.google.gwt.event.dom.client.MouseOutEvent;
39  import com.google.gwt.event.dom.client.MouseOutHandler;
40  import com.google.gwt.event.dom.client.MouseOverEvent;
41  import com.google.gwt.event.dom.client.MouseOverHandler;
42  import com.google.gwt.event.dom.client.MouseUpEvent;
43  import com.google.gwt.event.dom.client.MouseUpHandler;
44  import com.google.gwt.event.dom.client.MouseWheelEvent;
45  import com.google.gwt.event.dom.client.MouseWheelHandler;
46  import com.google.gwt.event.shared.HandlerRegistration;
47  import com.google.gwt.user.client.ui.FocusPanel;
48  import com.google.gwt.user.client.ui.SimplePanel;
49  import com.google.gwt.user.client.ui.Widget;
50  
51  /**
52   * A panel that handles all click, key, and mouse events
53   * @author Kuali Student Team
54   *
55   */
56  public class ClickablePanel extends FocusPanel implements HasAllMouseHandlers, HasClickHandlers, HasAllKeyHandlers, HasAllFocusHandlers{
57  	  
58  	public ClickablePanel(Widget child){
59  		  this();
60  		  setWidget(child);
61  	  }
62  	
63  	  public ClickablePanel() {
64  		  super();
65  	  }
66  
67  	  public HandlerRegistration addClickHandler(ClickHandler handler) {
68  		    return addDomHandler(handler, ClickEvent.getType());
69  	  }
70  	  
71  	  public HandlerRegistration addKeyDownHandler(KeyDownHandler handler) {
72  	    return addDomHandler(handler, KeyDownEvent.getType());
73  	  }
74  
75  	  public HandlerRegistration addKeyPressHandler(KeyPressHandler handler) {
76  	    return addDomHandler(handler, KeyPressEvent.getType());
77  	  }
78  
79  	  public HandlerRegistration addKeyUpHandler(KeyUpHandler handler) {
80  	    return addDomHandler(handler, KeyUpEvent.getType());
81  	  }
82  
83  	  public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) {
84  	    return addDomHandler(handler, MouseDownEvent.getType());
85  	  }
86  	  
87  	  public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
88  	    return addDomHandler(handler, MouseMoveEvent.getType());
89  	  }
90  
91  	  public HandlerRegistration addMouseOutHandler(MouseOutHandler handler) {
92  	    return addDomHandler(handler, MouseOutEvent.getType());
93  	  }
94  
95  	  public HandlerRegistration addMouseOverHandler(MouseOverHandler handler) {
96  	    return addDomHandler(handler, MouseOverEvent.getType());
97  	  }
98  
99  	  public HandlerRegistration addMouseUpHandler(MouseUpHandler handler) {
100 	    return addDomHandler(handler, MouseUpEvent.getType());
101 	  }
102 
103 	  public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) {
104 	    return addDomHandler(handler, MouseWheelEvent.getType());
105 	  }
106 	  
107 	  public HandlerRegistration addFocusHandler(FocusHandler handler) {
108 		    return addDomHandler(handler, FocusEvent.getType());
109 	  }
110 	  
111 	  public HandlerRegistration addBlurHandler(BlurHandler handler) {
112 		    return addDomHandler(handler, BlurEvent.getType());
113 	  }
114 	  	  
115 }