PageRenderTime 18ms CodeModel.GetById 11ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/src/org/mt4j/input/inputProcessors/componentProcessors/tapProcessor/TapEvent.java

http://mt4j.googlecode.com/
Java | 152 lines | 50 code | 25 blank | 77 comment | 4 complexity | a4686f7c2a4a6fcc988a5393ed2ed0b5 MD5 | raw file
  1/***********************************************************************
  2 * mt4j Copyright (c) 2008 - 2009, C.Ruff, Fraunhofer-Gesellschaft All rights reserved.
  3 *  
  4 *   This program is free software: you can redistribute it and/or modify
  5 *   it under the terms of the GNU General Public License as published by
  6 *   the Free Software Foundation, either version 3 of the License, or
  7 *   (at your option) any later version.
  8 *
  9 *   This program is distributed in the hope that it will be useful,
 10 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 11 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 12 *   GNU General Public License for more details.
 13 *
 14 *   You should have received a copy of the GNU General Public License
 15 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 16 *
 17 ***********************************************************************/
 18package org.mt4j.input.inputProcessors.componentProcessors.tapProcessor;
 19
 20import org.mt4j.components.interfaces.IMTComponent3D;
 21import org.mt4j.input.inputData.InputCursor;
 22import org.mt4j.input.inputProcessors.IInputProcessor;
 23import org.mt4j.input.inputProcessors.MTGestureEvent;
 24import org.mt4j.util.math.Vector3D;
 25
 26
 27/**
 28 * The Class ClickEvent.
 29 * @author Christopher Ruff
 30 */
 31public class TapEvent extends MTGestureEvent {
 32	
 33	/** The cursor. */
 34	private InputCursor cursor;
 35	
 36	/** The click point. */
 37	private Vector3D clickPoint;
 38	
 39	/** The click id. */
 40	private int clickID;
 41	
 42	@Deprecated
 43	/** The Constant BUTTON_DOWN. */
 44	public static final int BUTTON_DOWN = 3;
 45	
 46	@Deprecated
 47	/** The Constant BUTTON_UP. */
 48	public static final int BUTTON_UP	= 4;
 49	
 50	@Deprecated
 51	/** The Constant BUTTON_CLICKED. */
 52	public static final int BUTTON_CLICKED = 5;
 53	
 54	@Deprecated
 55	/** The Constant BUTTON_DOUBLE_CLICKED. */
 56	public static final int BUTTON_DOUBLE_CLICKED = 6;
 57	
 58	/** The Constant TAP_DOWN. */
 59	public static final int TAP_DOWN = 3;
 60	
 61	/** The Constant TAP_UP. */
 62	public static final int TAP_UP	= 4;
 63	
 64	/** The Constant TAPPED. */
 65	public static final int TAPPED = 5;
 66	
 67	/** The Constant DOUBLE_TAPPED. */
 68	public static final int DOUBLE_TAPPED = 6;
 69	
 70
 71	/**
 72	 * Instantiates a new click event.
 73	 * 
 74	 * @param source the source
 75	 * @param id the id
 76	 * @param targetComponent the target component
 77	 * @param cursor the cursor
 78	 * @param clickPoint the click point
 79	 * @param clickID the click id
 80	 */
 81	public TapEvent(IInputProcessor source, int id, IMTComponent3D targetComponent, InputCursor cursor, Vector3D clickPoint, int clickID) {
 82		super(source, id, targetComponent);
 83		this.cursor = cursor;
 84		this.clickPoint = clickPoint;
 85		this.clickID = clickID;
 86	}
 87
 88	/**
 89	 * Gets the click point.
 90	 * 
 91	 * @return the click point
 92	 */
 93	public Vector3D getLocationOnScreen() {
 94		return clickPoint;
 95	}
 96
 97	/**
 98	 * Gets the cursor.
 99	 * 
100	 * @return the cursor
101	 */
102	public InputCursor getCursor() {
103		return cursor;
104	}
105
106	/**
107	 * Gets the click id.
108	 * 
109	 * @return the click id
110	 */
111	public int getTapID() {
112		return clickID;
113	}
114	
115	/**
116	 * Checks if is tapped.
117	 * 
118	 * @return true, if is tapped
119	 */
120	public boolean isTapped(){
121		return this.getTapID() == TAPPED;
122	}
123	
124	/**
125	 * Checks if is tap down.
126	 * 
127	 * @return true, if is tap down
128	 */
129	public boolean isTapDown(){
130		return this.getTapID() == TAP_DOWN;
131	}
132	
133	/**
134	 * Checks if is tap canceled.
135	 * 
136	 * @return true, if is tap canceled
137	 */
138	public boolean isTapCanceled(){
139		return this.getTapID() == TAP_UP;
140	}
141	
142	/**
143	 * Checks if is double tap.
144	 * 
145	 * @return true, if is double tap
146	 */
147	public boolean isDoubleTap(){
148		return this.getTapID() == DOUBLE_TAPPED;
149	}
150	
151
152}