001/* 002 * #%L 003 * GwtMaterial 004 * %% 005 * Copyright (C) 2015 - 2017 GwtMaterialDesign 006 * %% 007 * Licensed under the Apache License, Version 2.0 (the "License"); 008 * you may not use this file except in compliance with the License. 009 * You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, software 014 * distributed under the License is distributed on an "AS IS" BASIS, 015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 016 * See the License for the specific language governing permissions and 017 * limitations under the License. 018 * #L% 019 */ 020/* 021 * Copyright 2008 Google Inc. 022 * 023 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 024 * use this file except in compliance with the License. You may obtain a copy of 025 * the License at 026 * 027 * http://www.apache.org/licenses/LICENSE-2.0 028 * 029 * Unless required by applicable law or agreed to in writing, software 030 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 031 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 032 * License for the specific language governing permissions and limitations under 033 * the License. 034 */ 035package gwt.material.design.addins.client.swipeable.events; 036 037import com.google.gwt.event.shared.EventHandler; 038import com.google.gwt.event.shared.GwtEvent; 039import gwt.material.design.addins.client.swipeable.base.HasSwipeableHandler; 040 041/** 042 * Represents an on start swipe left event. 043 * 044 * @author kevzlou7979 045 */ 046public class OnStartSwipeLeftEvent<T> extends GwtEvent<OnStartSwipeLeftEvent.OnStartSwipeLeftHandler<T>> { 047 048 private static Type<OnStartSwipeLeftHandler<?>> TYPE; 049 050 public interface OnStartSwipeLeftHandler<T> extends EventHandler { 051 void onStartSwipeSwipeLeft(OnStartSwipeLeftEvent<T> event); 052 } 053 054 public static <T> void fire(HasSwipeableHandler<T> source, T target) { 055 if (TYPE != null) { 056 OnStartSwipeLeftEvent<T> event = new OnStartSwipeLeftEvent<T>(target); 057 source.fireEvent(event); 058 } 059 } 060 061 public static Type<OnStartSwipeLeftHandler<?>> getType() { 062 return TYPE != null ? TYPE : (TYPE = new Type<>()); 063 } 064 065 private final T target; 066 067 protected OnStartSwipeLeftEvent(T target) { 068 this.target = target; 069 } 070 071 @Override 072 public final Type<OnStartSwipeLeftHandler<T>> getAssociatedType() { 073 return (Type) TYPE; 074 } 075 076 public T getTarget() { 077 return target; 078 } 079 080 @Override 081 protected void dispatch(OnStartSwipeLeftHandler<T> handler) { 082 handler.onStartSwipeSwipeLeft(this); 083 } 084}