View Javadoc

1   package org.ximtec.igesture.io.tuio.handler;
2   
3   import java.util.Vector;
4   
5   import org.ximtec.igesture.io.tuio.TuioListener;
6   import org.ximtec.igesture.io.tuio.TuioTime;
7   
8   import com.illposed.osc.OSCMessage;
9   
10  public abstract class AbstractTuioHandler {
11  	
12  	protected long currentFrame = 0;
13  	/** List of listeners */
14  	protected Vector<TuioListener> listenerList = new Vector<TuioListener>();
15  	
16  	/**
17  	 * Handle a TUIO message
18  	 * 
19  	 * @param message	The message to process.
20  	 * @param currentTime
21  	 */
22  	abstract public void acceptMessage(OSCMessage message, TuioTime currentTime);
23  
24  	/**
25  	 * Adds the provided TuioListener to the list of registered TUIO event listeners
26  	 *
27  	 * @param  listener  the TuioListener to add
28  	 */
29  	public void addTuioListener(TuioListener listener)
30  	{
31  		listenerList.addElement(listener);
32  	}
33  	
34  	/**
35  	 * Removes the provided TuioListener from the list of registered TUIO event listeners
36  	 *
37  	 * @param  listener  the TuioListener to remove
38  	 */
39  	public void removeTuioListener(TuioListener listener)
40  	{
41  		listenerList.removeElement(listener);	
42  	}
43  	
44  	/**
45  	 * Removes all TuioListener from the list of registered TUIO event listeners
46  	 */
47  	public void removeAllTuioListeners()
48  	{
49  		listenerList.clear();
50  	}
51  
52  }