EventBus

Simple Java EventBus

Лицензия

Лицензия

Категории

Категории

EventBus Библиотеки уровня приложения Messaging
Группа

Группа

com.jdotsoft
Идентификатор

Идентификатор

jdotsoft-eventbus
Последняя версия

Последняя версия

2.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

EventBus
Simple Java EventBus
Ссылка на сайт

Ссылка на сайт

http://www.jdotsoft.com/EventBus.php
Система контроля версий

Система контроля версий

https://github.com/jdotsoft/EventBus

Скачать jdotsoft-eventbus

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.jdotsoft/jdotsoft-eventbus/ -->
<dependency>
    <groupId>com.jdotsoft</groupId>
    <artifactId>jdotsoft-eventbus</artifactId>
    <version>2.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.jdotsoft/jdotsoft-eventbus/
implementation 'com.jdotsoft:jdotsoft-eventbus:2.1'
// https://jarcasting.com/artifacts/com.jdotsoft/jdotsoft-eventbus/
implementation ("com.jdotsoft:jdotsoft-eventbus:2.1")
'com.jdotsoft:jdotsoft-eventbus:jar:2.1'
<dependency org="com.jdotsoft" name="jdotsoft-eventbus" rev="2.1">
  <artifact name="jdotsoft-eventbus" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.jdotsoft', module='jdotsoft-eventbus', version='2.1')
)
libraryDependencies += "com.jdotsoft" % "jdotsoft-eventbus" % "2.1"
[com.jdotsoft/jdotsoft-eventbus "2.1"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

EventBus

Simple Java EventBus.

Follow steps to start using EventBus. These steps are by example used in a Swing demo application in this project located in test -> com.jdotsoft.eventbus.demo.EventBusDemo

See also http://www.jdotsoft.com/EventBus.php

Step 1. Create BlueEvent class which extends base class Event. This class might have constructor with arguments, member variables, and any methods.

public class BlueEvent extends Event {
}

Step 2. Create BlueEventListener interface which extends base interface EventListener with method onBlue(BlueEvent e). This interface might have any methods declarations, however, only method which returns void with single argument BlueEvent will be invoked.

public interface BlueEventListener extends EventListener {
   void onBlue(BlueEvent event);
}

Step 3. Implement BlueEventListener (and other event listeners if required) in some class which will receive the BlueEvent event and register it:

public class BluePanel extends JPanel implements BlueEventListener {
  public BluePanel() {
    EventBus.getInstance().registerListeners(this);
  }
  @Override
  public void onBlue(BlueEvent event) {
    . . .
  }
}

Step 4. Fire event

eventBus.fire(new BlueEvent());
- or -
EventBus.getInstance().fire(new BlueEvent());

Step 5. Object BluePanel will receive event in listener BlueEventListener implementation onBlue(BlueEvent e).

EventBus object could be instantiated as EventBus eventBus = new EventBus(); in some class and passed to listeners. Use static EventBus.getInstance(); as an alternative.

Версии библиотеки

Версия
2.1