001 /** 002 * Copyright 2010 The Kuali Foundation Licensed under the 003 * Educational Community License, Version 2.0 (the "License"); you may 004 * not use this file except in compliance with the License. You may 005 * obtain a copy of the License at 006 * 007 * http://www.osedu.org/licenses/ECL-2.0 008 * 009 * Unless required by applicable law or agreed to in writing, 010 * software distributed under the License is distributed on an "AS IS" 011 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 012 * or implied. See the License for the specific language governing 013 * permissions and limitations under the License. 014 */ 015 016 package org.kuali.student.common.ui.client.widgets; 017 018 import com.google.gwt.event.dom.client.BlurEvent; 019 import com.google.gwt.event.dom.client.BlurHandler; 020 import com.google.gwt.event.dom.client.ClickEvent; 021 import com.google.gwt.event.dom.client.ClickHandler; 022 import com.google.gwt.event.dom.client.FocusEvent; 023 import com.google.gwt.event.dom.client.FocusHandler; 024 import com.google.gwt.event.dom.client.HasAllFocusHandlers; 025 import com.google.gwt.event.dom.client.HasAllKeyHandlers; 026 import com.google.gwt.event.dom.client.HasAllMouseHandlers; 027 import com.google.gwt.event.dom.client.HasClickHandlers; 028 import com.google.gwt.event.dom.client.KeyDownEvent; 029 import com.google.gwt.event.dom.client.KeyDownHandler; 030 import com.google.gwt.event.dom.client.KeyPressEvent; 031 import com.google.gwt.event.dom.client.KeyPressHandler; 032 import com.google.gwt.event.dom.client.KeyUpEvent; 033 import com.google.gwt.event.dom.client.KeyUpHandler; 034 import com.google.gwt.event.dom.client.MouseDownEvent; 035 import com.google.gwt.event.dom.client.MouseDownHandler; 036 import com.google.gwt.event.dom.client.MouseMoveEvent; 037 import com.google.gwt.event.dom.client.MouseMoveHandler; 038 import com.google.gwt.event.dom.client.MouseOutEvent; 039 import com.google.gwt.event.dom.client.MouseOutHandler; 040 import com.google.gwt.event.dom.client.MouseOverEvent; 041 import com.google.gwt.event.dom.client.MouseOverHandler; 042 import com.google.gwt.event.dom.client.MouseUpEvent; 043 import com.google.gwt.event.dom.client.MouseUpHandler; 044 import com.google.gwt.event.dom.client.MouseWheelEvent; 045 import com.google.gwt.event.dom.client.MouseWheelHandler; 046 import com.google.gwt.event.shared.HandlerRegistration; 047 import com.google.gwt.user.client.ui.FocusPanel; 048 import com.google.gwt.user.client.ui.Widget; 049 050 /** 051 * A panel that handles all click, key, and mouse events 052 * @author Kuali Student Team 053 * 054 */ 055 public class ClickablePanel extends FocusPanel implements HasAllMouseHandlers, HasClickHandlers, HasAllKeyHandlers, HasAllFocusHandlers{ 056 057 public ClickablePanel(Widget child){ 058 this(); 059 setWidget(child); 060 } 061 062 public ClickablePanel() { 063 super(); 064 } 065 066 public HandlerRegistration addClickHandler(ClickHandler handler) { 067 return addDomHandler(handler, ClickEvent.getType()); 068 } 069 070 public HandlerRegistration addKeyDownHandler(KeyDownHandler handler) { 071 return addDomHandler(handler, KeyDownEvent.getType()); 072 } 073 074 public HandlerRegistration addKeyPressHandler(KeyPressHandler handler) { 075 return addDomHandler(handler, KeyPressEvent.getType()); 076 } 077 078 public HandlerRegistration addKeyUpHandler(KeyUpHandler handler) { 079 return addDomHandler(handler, KeyUpEvent.getType()); 080 } 081 082 public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) { 083 return addDomHandler(handler, MouseDownEvent.getType()); 084 } 085 086 public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) { 087 return addDomHandler(handler, MouseMoveEvent.getType()); 088 } 089 090 public HandlerRegistration addMouseOutHandler(MouseOutHandler handler) { 091 return addDomHandler(handler, MouseOutEvent.getType()); 092 } 093 094 public HandlerRegistration addMouseOverHandler(MouseOverHandler handler) { 095 return addDomHandler(handler, MouseOverEvent.getType()); 096 } 097 098 public HandlerRegistration addMouseUpHandler(MouseUpHandler handler) { 099 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 }