All Downloads are FREE. Search and download functionalities are using the official Maven repository.

eu.future.earth.gwt.charts.client.event.mouseover.MouseOverPointEvent Maven / Gradle / Ivy

There is a newer version: 3.0
Show newest version
/*
 * Copyright 2009 EasyEnterprise, all rights reserved.
 */
package eu.future.earth.gwt.charts.client.event.mouseover;

import com.google.gwt.event.shared.GwtEvent;

public class MouseOverPointEvent extends GwtEvent> {

	/**
	 * Handler type.
	 */
	private static Type> TYPE;

	/**
	 * Fires a before selection event on all registered handlers in the handler manager. If no such handlers exist, this
	 * method will do nothing.
	 * 
	 * @param source
	 *            the source of the handlers
	 * @param navigator
	 *            the navigator associated with this event
	 * @param token
	 *            the navigation token associated with this event
	 * @return the event so that the caller can check if it was canceled, or null if no handlers of this event type have
	 *         been registered
	 */
	public static  MouseOverPointEvent fire(HasMouseOverPointHandlers source, MouseOverPointEventType navigator, T newData) {
		// If no handlers exist, then type can be null.
		if (TYPE != null) {
			final MouseOverPointEvent event = new MouseOverPointEvent(navigator, newData);
			source.fireEvent(event);
			return event;
		}
		return null;
	}

	
	
	
	/**
	 * Fires a before selection event on all registered handlers in the handler manager. If no such handlers exist, this
	 * method will do nothing.
	 * 
	 * @param source
	 *            the source of the handlers
	 * @param navigator
	 *            the navigator associated with this event
	 * @param token
	 *            the navigation token associated with this event
	 * @return the event so that the caller can check if it was canceled, or null if no handlers of this event type have
	 *         been registered
	 */
	public static  MouseOverPointEvent fire(HasMouseOverPointHandlers source, MouseOverPointEventType navigator) {
		// If no handlers exist, then type can be null.
		if (TYPE != null) {
			final MouseOverPointEvent event = new MouseOverPointEvent(navigator);
			source.fireEvent(event);
			return event;
		}
		return null;
	}

	/**
	 * Gets the type associated with this event.
	 * 
	 * @return returns the handler type
	 */
	public static  Type> getType() {
		if (TYPE == null) {
			TYPE = new Type>();
		}
		return TYPE;
	}

	private final MouseOverPointEventType dataEventType;

	private final T data;

	protected MouseOverPointEvent(MouseOverPointEventType navigator) {
		this.dataEventType = navigator;
		data = null;
	}

	protected MouseOverPointEvent(MouseOverPointEventType navigator, T newData) {
		this.dataEventType = navigator;
		data = newData;
	}

	public MouseOverPointEventType getDataEventType() {
		return dataEventType;
	}

	public T getData() {
		return data;
	}

	@SuppressWarnings({
			"rawtypes", "unchecked"
	})
	@Override
	public final Type> getAssociatedType() {
		return (Type) TYPE;
	}

	protected void dispatch(MouseOverPointHandler handler) {
		handler.onMouseOverPointEvent(this);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy