com.vaadin.client.ui
Class AbstractClickEventHandler

java.lang.Object
  extended by com.vaadin.client.ui.AbstractClickEventHandler
Direct Known Subclasses:
ClickEventHandler, LayoutClickEventHandler

public abstract class AbstractClickEventHandler
extends java.lang.Object


Field Summary
protected  ComponentConnector connector
           
 
Constructor Summary
AbstractClickEventHandler(ComponentConnector connector, java.lang.String clickEventIdentifier)
           
 
Method Summary
protected abstract  void fireClick(NativeEvent event)
          Sends the click event based on the given native event.
protected  com.google.gwt.user.client.Element getRelativeToElement()
          Click event calculates and returns coordinates relative to the element returned by this method.
 void handleEventHandlerRegistration()
           
 boolean hasEventListener()
          Checks if there is a server side event listener registered for clicks
 void onContextMenu(ContextMenuEvent event)
          Event handler for context menu.
 void onDoubleClick(DoubleClickEvent event)
          Event handler for double clicks.
 void onMouseDown(MouseDownEvent event)
           
 void onMouseUp(MouseUpEvent event)
           
protected
<H extends com.google.gwt.event.shared.EventHandler>
com.google.gwt.event.shared.HandlerRegistration
registerHandler(H handler,  type)
          Registers the given handler to the widget so that the necessary events are passed to this ClickEventHandler.
protected  boolean shouldFireEvent( event)
          Called before firing a click event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connector

protected ComponentConnector connector
Constructor Detail

AbstractClickEventHandler

public AbstractClickEventHandler(ComponentConnector connector,
                                 java.lang.String clickEventIdentifier)
Method Detail

handleEventHandlerRegistration

public void handleEventHandlerRegistration()

registerHandler

protected <H extends com.google.gwt.event.shared.EventHandler> com.google.gwt.event.shared.HandlerRegistration registerHandler(H handler,
                                                                                                                                type)
Registers the given handler to the widget so that the necessary events are passed to this ClickEventHandler.

By default registers the handler with the connector root widget.

Type Parameters:
H -
Parameters:
handler - The handler to register
type - The type of the handler.
Returns:
A reference for the registration of the handler.

hasEventListener

public boolean hasEventListener()
Checks if there is a server side event listener registered for clicks

Returns:
true if there is a server side event listener registered, false otherwise

onContextMenu

public void onContextMenu(ContextMenuEvent event)
Event handler for context menu. Prevents the browser context menu from popping up if there is a listener for right clicks.


onMouseDown

public void onMouseDown(MouseDownEvent event)

onMouseUp

public void onMouseUp(MouseUpEvent event)

fireClick

protected abstract void fireClick(NativeEvent event)
Sends the click event based on the given native event.

Parameters:
event - The native event that caused this click event

shouldFireEvent

protected boolean shouldFireEvent( event)
Called before firing a click event. Allows sub classes to decide if this in an event that should cause an event or not.

Parameters:
event - The user event
Returns:
true if the event should be fired, false otherwise

onDoubleClick

public void onDoubleClick(DoubleClickEvent event)
Event handler for double clicks. Used to fire double click events. Note that browsers typically fail to prevent the second click event so a double click will result in two click events and one double click event.


getRelativeToElement

protected com.google.gwt.user.client.Element getRelativeToElement()
Click event calculates and returns coordinates relative to the element returned by this method. Default implementation uses the root element of the widget. Override to provide a different relative element.

Returns:
The Element used for calculating relative coordinates for a click or null if no relative coordinates can be calculated.


Copyright © 2000-2014 Vaadin Ltd. All Rights Reserved.