]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/events/IEventQueue.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.scenegraph / src / org / simantics / scenegraph / g2d / events / IEventQueue.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 /*
13  *
14  * @author Toni Kalajainen
15  */
16 package org.simantics.scenegraph.g2d.events;
17
18 import org.simantics.utils.threads.IThreadWorkQueue;
19
20 /**
21  * 
22  * @see MouseEventCoalescer
23  * @see EventQueue Default implementation
24  * @author Toni Kalajainen
25  */
26 public interface IEventQueue {
27
28     /**
29      * queues event
30      * 
31      * @param e
32      */
33     void queueEvent(Event e);
34
35     /**
36      * Queue event as next to be processed
37      * 
38      * @param e
39      */
40     void queueFirst(Event e);
41
42     boolean isEmpty();
43
44     int size();
45
46     void addEventCoalesceler(EventCoalescer coalescaler);
47     void removeEventCoalesceler(EventCoalescer coalescaler);
48
49     void addQueueListener(IEventQueueListener listener);
50     void removeQueueListener(IEventQueueListener listener);
51     void addQueueListener(IEventQueueListener listener, IThreadWorkQueue thread);
52     void removeQueueListener(IEventQueueListener listener, IThreadWorkQueue thread);
53
54     /**
55      * Coalesces mouse events.
56      */
57     public interface EventCoalescer {
58         /**
59          * 
60          * @param apriori
61          * @param aposterior
62          * @return coalesced event of the two or <code>null</code> if the two
63          *         events cannot be coalesced
64          */
65         Event coalesce(Event apriori, Event aposterior);
66     }
67
68     public interface IEventQueueListener {
69         void onEventAdded(IEventQueue queue, Event e, int index);
70         void onQueueEmpty(IEventQueue queue);
71     }
72
73 }