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.Widget;
49  
50  /**
51   * A panel that handles all click, key, and mouse events
52   * @author Kuali Student Team
53   *
54   */
55  public class ClickablePanel extends FocusPanel implements HasAllMouseHandlers, HasClickHandlers, HasAllKeyHandlers, HasAllFocusHandlers{
56  	  
57  	public ClickablePanel(Widget child){
58  		  this();
59  		  setWidget(child);
60  	  }
61  	
62  	  public ClickablePanel() {
63  		  super();
64  	  }
65  
66  	  public HandlerRegistration addClickHandler(ClickHandler handler) {
67  		    return addDomHandler(handler, ClickEvent.getType());
68  	  }
69  	  
70  	  public HandlerRegistration addKeyDownHandler(KeyDownHandler handler) {
71  	    return addDomHandler(handler, KeyDownEvent.getType());
72  	  }
73  
74  	  public HandlerRegistration addKeyPressHandler(KeyPressHandler handler) {
75  	    return addDomHandler(handler, KeyPressEvent.getType());
76  	  }
77  
78  	  public HandlerRegistration addKeyUpHandler(KeyUpHandler handler) {
79  	    return addDomHandler(handler, KeyUpEvent.getType());
80  	  }
81  
82  	  public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) {
83  	    return addDomHandler(handler, MouseDownEvent.getType());
84  	  }
85  	  
86  	  public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
87  	    return addDomHandler(handler, MouseMoveEvent.getType());
88  	  }
89  
90  	  public HandlerRegistration addMouseOutHandler(MouseOutHandler handler) {
91  	    return addDomHandler(handler, MouseOutEvent.getType());
92  	  }
93  
94  	  public HandlerRegistration addMouseOverHandler(MouseOverHandler handler) {
95  	    return addDomHandler(handler, MouseOverEvent.getType());
96  	  }
97  
98  	  public HandlerRegistration addMouseUpHandler(MouseUpHandler handler) {
99  	    return addDomHandler(handler, MouseUpEvent.getType());
100 	  }
101 
102 	  public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) {
103 	    return addDomHandler(handler, MouseWheelEvent.getType());
104 	  }
105 	  
106 	  public HandlerRegistration addFocusHandler(FocusHandler handler) {
107 		    return addDomHandler(handler, FocusEvent.getType());
108 	  }
109 	  
110 	  public HandlerRegistration addBlurHandler(BlurHandler handler) {
111 		    return addDomHandler(handler, BlurEvent.getType());
112 	  }
113 	  	  
114 }