package org.gcube.portlets.user.dataminerexecutor.client.events; import org.gcube.portlets.user.dataminerexecutor.client.type.MenuType; import com.google.gwt.event.shared.EventHandler; import com.google.gwt.event.shared.GwtEvent; import com.google.gwt.event.shared.HandlerRegistration; import com.google.gwt.event.shared.HasHandlers; /** * Menu Event * * * @author Giancarlo Panichi * * */ public class MenuEvent extends GwtEvent { public static Type TYPE = new Type(); private MenuType menuType; public interface MenuEventHandler extends EventHandler { void onSelect(MenuEvent event); } public interface HasMenuEventHandler extends HasHandlers { public HandlerRegistration addMenuEventHandler( MenuEventHandler handler); } public MenuEvent( MenuType menuType) { this.menuType = menuType; } @Override protected void dispatch(MenuEventHandler handler) { handler.onSelect(this); } @Override public Type getAssociatedType() { return TYPE; } public static Type getType() { return TYPE; } public static void fire(HasHandlers source, MenuEvent event) { source.fireEvent(event); } public MenuType getMenuType() { return menuType; } @Override public String toString() { return "MenuEvent [menuType=" + menuType + "]"; } }