com.maryanovsky.gwtutils.client.ui
Class EventCancellingPanel

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Panel
              extended by com.google.gwt.user.client.ui.SimplePanel
                  extended by com.maryanovsky.gwtutils.client.ui.EventCancellingPanel
All Implemented Interfaces:
HasAttachHandlers, HasHandlers, EventListener, AcceptsOneWidget, HasOneWidget, HasVisibility, HasWidgets, HasWidgets.ForIsWidget, IsWidget, Iterable<Widget>

public class EventCancellingPanel
extends SimplePanel

A panel which allows cancelling the bubbling of and preventing the default action from occurring on a specified set of events it receives.

Author:
Maryanovsky Alexander

Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
 
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets
HasWidgets.ForIsWidget
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
EventCancellingPanel()
          Creates a new EventCancellingPanel.
EventCancellingPanel(Widget child, int cancelBubbleEventsMask, int preventDefaultEventsMask)
          Creates a new EventCancellingPanel with the specified child widget and which will cancel the bubbling of events matching the first specified mask and prevent the default action for events matching the second specified mask.
 
Method Summary
 int getCancelBubbleEventsMask()
          Returns the bitmask of events whose bubbling we are currently cancelling.
 int getPreventDefaultEventsMask()
          Returns the bitmask of events for which we prevent the default action.
protected  boolean isCancelBubbling(Event event)
          Returns whether we should cancel the bubbling of the the specified event.
protected  boolean isPreventDefault(Event event)
          Returns whether we should prevent the default action for the specified event.
 void onBrowserEvent(Event event)
          Cancels the bubbling of and/or prevents the default action of the specified event.
 void setCancelBubbleEventsMask(int cancelBubbleEventsMask)
          Sets the bitmask of events whose bubbling to cancel.
 void setPreventDefaultEventsMask(int preventDefaultEventsMask)
          Sets the bitmask of events for which we prevent the default action.
 
Methods inherited from class com.google.gwt.user.client.ui.SimplePanel
add, getContainerElement, getWidget, iterator, remove, setWidget, setWidget
 
Methods inherited from class com.google.gwt.user.client.ui.Panel
add, adopt, adopt, clear, disown, doAttachChildren, doDetachChildren, orphan, remove
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EventCancellingPanel

public EventCancellingPanel(Widget child,
                            int cancelBubbleEventsMask,
                            int preventDefaultEventsMask)
Creates a new EventCancellingPanel with the specified child widget and which will cancel the bubbling of events matching the first specified mask and prevent the default action for events matching the second specified mask.


EventCancellingPanel

public EventCancellingPanel()
Creates a new EventCancellingPanel.

Method Detail

setCancelBubbleEventsMask

public void setCancelBubbleEventsMask(int cancelBubbleEventsMask)
Sets the bitmask of events whose bubbling to cancel.


getCancelBubbleEventsMask

public int getCancelBubbleEventsMask()
Returns the bitmask of events whose bubbling we are currently cancelling.


setPreventDefaultEventsMask

public void setPreventDefaultEventsMask(int preventDefaultEventsMask)
Sets the bitmask of events for which we prevent the default action.


getPreventDefaultEventsMask

public int getPreventDefaultEventsMask()
Returns the bitmask of events for which we prevent the default action.


isCancelBubbling

protected boolean isCancelBubbling(Event event)
Returns whether we should cancel the bubbling of the the specified event. By default, this method uses the bitmask to determine whether to cancel bubbling, but you may override it for a more fine-grained control.


isPreventDefault

protected boolean isPreventDefault(Event event)
Returns whether we should prevent the default action for the specified event. By default, this method uses the bitmask to determine whether to prevent the default action, but you may override it for a more fine-grained control.


onBrowserEvent

public void onBrowserEvent(Event event)
Cancels the bubbling of and/or prevents the default action of the specified event.

Specified by:
onBrowserEvent in interface EventListener
Overrides:
onBrowserEvent in class Widget