dependencies {
compile "org.jtrim2:jtrim-event-track:${jtrimVersion}"
}
<dependencies>
<dependency>
<groupId>org.jtrim2</groupId>
<artifactId>jtrim-event-track</artifactId>
<version>${jtrimVersion}</version>
<scope>compile</scope>
</dependency>
</dependencies>
- "org.jtrim2:jtrim-executor"
- "org.jtrim2:jtrim-concurrent"
- "org.jtrim2:jtrim-collections"
- "org.jtrim2:jtrim-utils"
- "org.jtrim2:jtrim-collections"
- "org.jtrim2:jtrim-concurrent"
This module allows tracking what action caused what. The causes are tracked
by an implementation of the EventTracker
interface. The EventTracker
interface allows creating listener managers and they can track event causes
the following ways:
- If a listener notified by a listener manager of the
EventTracker
causes an event to be fired for another listener manager also created by the sameEventTracker
. The second event notification is said to be caused by the first (calling) event notification. - An
EventTracker
allows wrapping executors (TaskExecutor
). If an event listener submits a task to such an executor (possibly indirectly), the submitted task is treated as if it was called synchronously for event cause tracking purposes.
This event tracking mechanism was designed to detect circular event notifications. Circular event notifications naturally happen when two components are kept in sync with each other regardless which is changed by the user. For example: When showing an image (possibly zoomed), one might display a small overview of the whole image. This small overview can display which part of the image is shown and might also allow the user to select which part of the image is to be shown in the main window. Since the image overview and the main image display must be kept sync, each of them must update the other one when the image is panned. This module allows one generic solution to such a problem to prevent the recursion by avoiding recursive event notification.
EventTracker
: Allows tracking causes of events.
LinkedEventTracker
: A generic implementation ofEventTracker
.LocalEventTracker
: An implementation ofEventTracker
allowing to remove all registered listeners in a single method call.