Event Dispatcher is simple library that offers basic event management.
Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See the section Using the Library for notes on how to use the library and how to add custom events.
Prerequisites
This project requires to have JDK 1.8, and Maven which will manage all the remaining dependencies. Doxygen is only required when generating documentation from the annotated sources.
Installing
To install the library is required to follow a few steps:
Add to your pom.xml file the library dependency, it should look similar to the example below. Replace VERSION with the current version. If the version is v0.1.5-beta the value that should be replaced with is 0.1.5-beta.
The events can be added using the class EventPublisher, this class needs to be extended in order to use the methods that allow to register and fire the events. The class ObservedValue shows a simple implementation and is a class ready to use.
The class ObservedValue extends EventPublisher and uses the methods declared in the interface ValueChangeListener.
When the events need to be fired the class only need to notify the listeners. For example, in the set method is notified to the listeners that the value have changed, and the old and new values are passed as parameters, that will obtain the registered listeners.
This project uses JUnit5 tests and they are configured to run automatically in the test life cycle of Maven. They can also be run with the command mvn test. Along with the code unit test, the code coverage is also measured. The test and code coverage reports generate in the site life cycle of Maven, or when using the mvn site command.
This repository is configured to use Travis CI, that offers continuous integration, and it automatically builds and runs tests when pushing to the repository.