Upgrade to Event Bus 1.0.0 #112

Merged
kske merged 1 commits from event-bus-1.0.0 into develop 2021-02-20 22:29:39 +01:00
21 changed files with 107 additions and 97 deletions

View File

@ -13,9 +13,8 @@ import java.util.stream.Stream;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.collections.*; import javafx.collections.*;
import dev.kske.eventbus.Event; import dev.kske.eventbus.core.*;
import dev.kske.eventbus.EventBus; import dev.kske.eventbus.core.Event;
import dev.kske.eventbus.EventListener;
import envoy.data.*; import envoy.data.*;
import envoy.data.Message.MessageStatus; import envoy.data.Message.MessageStatus;
@ -35,7 +34,7 @@ import envoy.client.event.*;
* @author Kai S. K. Engelbart * @author Kai S. K. Engelbart
* @since Envoy Client v0.3-alpha * @since Envoy Client v0.3-alpha
*/ */
public final class LocalDB implements EventListener { public final class LocalDB {
// Data // Data
private User user; private User user;
@ -246,7 +245,8 @@ public final class LocalDB implements EventListener {
* @throws IOException if the saving process failed * @throws IOException if the saving process failed
* @since Envoy Client v0.3-alpha * @since Envoy Client v0.3-alpha
*/ */
@Event(eventType = EnvoyCloseEvent.class, priority = 500) @Event(EnvoyCloseEvent.class)
@Priority(500)
private synchronized void save() { private synchronized void save() {
// Stop saving if this account has been deleted // Stop saving if this account has been deleted
@ -300,37 +300,43 @@ public final class LocalDB implements EventListener {
onLogout(); onLogout();
} }
@Event(priority = 500) @Event
@Priority(500)
private void onMessage(Message msg) { private void onMessage(Message msg) {
if (msg.getStatus() == MessageStatus.SENT) if (msg.getStatus() == MessageStatus.SENT)
msg.nextStatus(); msg.nextStatus();
} }
@Event(priority = 500) @Event
@Priority(500)
private void onGroupMessage(GroupMessage msg) { private void onGroupMessage(GroupMessage msg) {
// TODO: Cancel event once EventBus is updated // TODO: Cancel event once EventBus is updated
if (msg.getStatus() == MessageStatus.WAITING || msg.getStatus() == MessageStatus.READ) if (msg.getStatus() == MessageStatus.WAITING || msg.getStatus() == MessageStatus.READ)
logger.warning("The groupMessage has the unexpected status " + msg.getStatus()); logger.warning("The groupMessage has the unexpected status " + msg.getStatus());
} }
@Event(priority = 500) @Event
@Priority(500)
private void onMessageStatusChange(MessageStatusChange evt) { private void onMessageStatusChange(MessageStatusChange evt) {
getMessage(evt.getID()).ifPresent(msg -> msg.setStatus(evt.get())); getMessage(evt.getID()).ifPresent(msg -> msg.setStatus(evt.get()));
} }
@Event(priority = 500) @Event
@Priority(500)
private void onGroupMessageStatusChange(GroupMessageStatusChange evt) { private void onGroupMessageStatusChange(GroupMessageStatusChange evt) {
this.<GroupMessage>getMessage(evt.getID()) this.<GroupMessage>getMessage(evt.getID())
.ifPresent(msg -> msg.getMemberStatuses().replace(evt.getMemberID(), evt.get())); .ifPresent(msg -> msg.getMemberStatuses().replace(evt.getMemberID(), evt.get()));
} }
@Event(priority = 500) @Event
@Priority(500)
private void onUserStatusChange(UserStatusChange evt) { private void onUserStatusChange(UserStatusChange evt) {
getChat(evt.getID()).map(Chat::getRecipient).map(User.class::cast) getChat(evt.getID()).map(Chat::getRecipient).map(User.class::cast)
.ifPresent(u -> u.setStatus(evt.get())); .ifPresent(u -> u.setStatus(evt.get()));
} }
@Event(priority = 500) @Event
@Priority(500)
private void onUserOperation(UserOperation operation) { private void onUserOperation(UserOperation operation) {
final var eventUser = operation.get(); final var eventUser = operation.get();
switch (operation.getOperationType()) { switch (operation.getOperationType()) {
@ -356,13 +362,15 @@ public final class LocalDB implements EventListener {
Platform.runLater(() -> chats.add(new GroupChat(user, newGroup))); Platform.runLater(() -> chats.add(new GroupChat(user, newGroup)));
} }
@Event(priority = 500) @Event
@Priority(500)
private void onGroupResize(GroupResize evt) { private void onGroupResize(GroupResize evt) {
getChat(evt.getGroupID()).map(Chat::getRecipient).map(Group.class::cast) getChat(evt.getGroupID()).map(Chat::getRecipient).map(Group.class::cast)
.ifPresent(evt::apply); .ifPresent(evt::apply);
} }
@Event(priority = 500) @Event
@Priority(500)
private void onNameChange(NameChange evt) { private void onNameChange(NameChange evt) {
chats.stream().map(Chat::getRecipient).filter(c -> c.getID() == evt.getID()).findAny() chats.stream().map(Chat::getRecipient).filter(c -> c.getID() == evt.getID()).findAny()
.ifPresent(c -> c.setName(evt.get())); .ifPresent(c -> c.setName(evt.get()));
@ -384,7 +392,8 @@ public final class LocalDB implements EventListener {
* *
* @since Envoy Client v0.2-beta * @since Envoy Client v0.2-beta
*/ */
@Event(eventType = Logout.class, priority = 50) @Event(Logout.class)
@Priority(50)
private void onLogout() { private void onLogout() {
autoSaver.cancel(); autoSaver.cancel();
autoSaveRestart = true; autoSaveRestart = true;
@ -416,22 +425,26 @@ public final class LocalDB implements EventListener {
}); });
} }
@Event(priority = 500) @Event
@Priority(500)
private void onOwnStatusChange(OwnStatusChange statusChange) { private void onOwnStatusChange(OwnStatusChange statusChange) {
user.setStatus(statusChange.get()); user.setStatus(statusChange.get());
} }
@Event(eventType = ContactsChangedSinceLastLogin.class, priority = 500) @Event(ContactsChangedSinceLastLogin.class)
@Priority(500)
private void onContactsChangedSinceLastLogin() { private void onContactsChangedSinceLastLogin() {
contactsChanged = true; contactsChanged = true;
} }
@Event(priority = 500) @Event
@Priority(500)
private void onContactDisabled(ContactDisabled event) { private void onContactDisabled(ContactDisabled event) {
getChat(event.get().getID()).ifPresent(chat -> chat.setDisabled(true)); getChat(event.get().getID()).ifPresent(chat -> chat.setDisabled(true));
} }
@Event(priority = 500) @Event
@Priority(500)
private void onAccountDeletion(AccountDeletion deletion) { private void onAccountDeletion(AccountDeletion deletion) {
if (user.getID() == deletion.get()) if (user.getID() == deletion.get())
logger.log(Level.WARNING, logger.log(Level.WARNING,
@ -496,7 +509,8 @@ public final class LocalDB implements EventListener {
* @param idGenerator the message ID generator to set * @param idGenerator the message ID generator to set
* @since Envoy Client v0.3-alpha * @since Envoy Client v0.3-alpha
*/ */
@Event(priority = 150) @Event
@Priority(150)
public void setIDGenerator(IDGenerator idGenerator) { this.idGenerator = idGenerator; } public void setIDGenerator(IDGenerator idGenerator) { this.idGenerator = idGenerator; }
/** /**

View File

@ -5,8 +5,7 @@ import java.util.*;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.prefs.Preferences; import java.util.prefs.Preferences;
import dev.kske.eventbus.*; import dev.kske.eventbus.core.*;
import dev.kske.eventbus.EventListener;
import envoy.util.*; import envoy.util.*;
@ -21,7 +20,7 @@ import envoy.client.event.EnvoyCloseEvent;
* @author Kai S. K. Engelbart * @author Kai S. K. Engelbart
* @since Envoy Client v0.2-alpha * @since Envoy Client v0.2-alpha
*/ */
public final class Settings implements EventListener { public final class Settings {
// Actual settings accessible by the rest of the application // Actual settings accessible by the rest of the application
private Map<String, SettingsItem<?>> items; private Map<String, SettingsItem<?>> items;
@ -69,7 +68,7 @@ public final class Settings implements EventListener {
* @throws IOException if an error occurs while saving the themes * @throws IOException if an error occurs while saving the themes
* @since Envoy Client v0.2-alpha * @since Envoy Client v0.2-alpha
*/ */
@Event(eventType = EnvoyCloseEvent.class) @Event(EnvoyCloseEvent.class)
private void save() { private void save() {
EnvoyLog.getLogger(Settings.class).log(Level.INFO, "Saving settings..."); EnvoyLog.getLogger(Settings.class).log(Level.INFO, "Saving settings...");

View File

@ -1,6 +1,6 @@
package envoy.client.helper; package envoy.client.helper;
import dev.kske.eventbus.EventBus; import dev.kske.eventbus.core.EventBus;
import envoy.client.data.*; import envoy.client.data.*;
import envoy.client.event.EnvoyCloseEvent; import envoy.client.event.EnvoyCloseEvent;

View File

@ -5,8 +5,8 @@ import java.net.Socket;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
import java.util.logging.*; import java.util.logging.*;
import dev.kske.eventbus.*; import dev.kske.eventbus.core.*;
import dev.kske.eventbus.Event; import dev.kske.eventbus.core.Event;
import envoy.data.*; import envoy.data.*;
import envoy.event.*; import envoy.event.*;
@ -24,7 +24,7 @@ import envoy.client.event.EnvoyCloseEvent;
* @author Leon Hofmeister * @author Leon Hofmeister
* @since Envoy Client v0.1-alpha * @since Envoy Client v0.1-alpha
*/ */
public final class Client implements EventListener, Closeable { public final class Client implements Closeable {
// Connection handling // Connection handling
private Socket socket; private Socket socket;
@ -153,13 +153,15 @@ public final class Client implements EventListener, Closeable {
send(new IDGeneratorRequest()); send(new IDGeneratorRequest());
} }
@Event(eventType = HandshakeRejection.class, priority = 1000) @Event(HandshakeRejection.class)
@Priority(1000)
private void onHandshakeRejection() { private void onHandshakeRejection() {
rejected = true; rejected = true;
} }
@Override @Override
@Event(eventType = EnvoyCloseEvent.class, priority = 50) @Event(EnvoyCloseEvent.class)
@Priority(50)
public void close() { public void close() {
if (online) { if (online) {
logger.log(Level.INFO, "Closing connection..."); logger.log(Level.INFO, "Closing connection...");

View File

@ -6,7 +6,7 @@ import java.util.*;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.logging.*; import java.util.logging.*;
import dev.kske.eventbus.*; import dev.kske.eventbus.core.EventBus;
import envoy.util.*; import envoy.util.*;
@ -87,15 +87,17 @@ public final class Receiver extends Thread {
// Dispatch to the processor if present // Dispatch to the processor if present
if (processor != null) if (processor != null)
processor.accept(obj); processor.accept(obj);
// Dispatch to the event bus if the object is an event without a processor // Dispatch to the event bus if the object has no processor
else if (obj instanceof IEvent)
eventBus.dispatch((IEvent) obj);
// Notify if no processor could be located
else else
logger.log(Level.WARNING, eventBus.dispatch(obj);
String.format(
"The received object has the %s for which no processor is defined.", // TODO: Log DeadEvent from Event Bus 1.1.0
obj.getClass())); // Notify if no processor could be located
// else
// logger.log(Level.WARNING,
// String.format(
// "The received object has the %s for which no processor is defined.",
// obj.getClass()));
} }
} catch (final SocketException | EOFException e) { } catch (final SocketException | EOFException e) {
// Connection probably closed by client. // Connection probably closed by client.

View File

@ -8,7 +8,7 @@ import javafx.fxml.FXMLLoader;
import javafx.scene.*; import javafx.scene.*;
import javafx.stage.Stage; import javafx.stage.Stage;
import dev.kske.eventbus.*; import dev.kske.eventbus.core.*;
import envoy.util.EnvoyLog; import envoy.util.EnvoyLog;
@ -25,7 +25,7 @@ import envoy.client.event.*;
* @author Kai S. K. Engelbart * @author Kai S. K. Engelbart
* @since Envoy Client v0.1-beta * @since Envoy Client v0.1-beta
*/ */
public final class SceneContext implements EventListener { public final class SceneContext {
private final Stage stage; private final Stage stage;
private final Stack<Parent> roots = new Stack<>(); private final Stack<Parent> roots = new Stack<>();
@ -126,13 +126,15 @@ public final class SceneContext implements EventListener {
} }
} }
@Event(eventType = Logout.class, priority = 150) @Event(Logout.class)
@Priority(150)
private void onLogout() { private void onLogout() {
roots.clear(); roots.clear();
controllers.clear(); controllers.clear();
} }
@Event(priority = 150, eventType = ThemeChangeEvent.class) @Event(ThemeChangeEvent.class)
@Priority(150)
private void onThemeChange() { private void onThemeChange() {
applyCSS(); applyCSS();
} }

View File

@ -9,8 +9,8 @@ import java.awt.image.BufferedImage;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.stage.Stage; import javafx.stage.Stage;
import dev.kske.eventbus.*; import dev.kske.eventbus.core.Event;
import dev.kske.eventbus.Event; import dev.kske.eventbus.core.EventBus;
import envoy.data.Message; import envoy.data.Message;
import envoy.data.User.UserStatus; import envoy.data.User.UserStatus;
@ -31,7 +31,7 @@ import envoy.client.util.*;
* @author Kai S. K. Engelbart * @author Kai S. K. Engelbart
* @since Envoy Client v0.2-alpha * @since Envoy Client v0.2-alpha
*/ */
public final class StatusTrayIcon implements EventListener { public final class StatusTrayIcon {
/** /**
* The {@link TrayIcon} provided by the System Tray API for controlling the system tray. This * The {@link TrayIcon} provided by the System Tray API for controlling the system tray. This
@ -136,7 +136,7 @@ public final class StatusTrayIcon implements EventListener {
* *
* @since Envoy Client v0.2-beta * @since Envoy Client v0.2-beta
*/ */
@Event(eventType = Logout.class) @Event(Logout.class)
public void hide() { public void hide() {
SystemTray.getSystemTray().remove(trayIcon); SystemTray.getSystemTray().remove(trayIcon);
} }

View File

@ -21,14 +21,14 @@ import javafx.scene.control.*;
import javafx.scene.control.Alert.AlertType; import javafx.scene.control.Alert.AlertType;
import javafx.scene.image.*; import javafx.scene.image.*;
import javafx.scene.input.*; import javafx.scene.input.*;
import javafx.scene.layout.*; import javafx.scene.layout.HBox;
import javafx.scene.paint.Color; import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle; import javafx.scene.shape.Rectangle;
import javafx.stage.FileChooser; import javafx.stage.FileChooser;
import javafx.util.Duration; import javafx.util.Duration;
import dev.kske.eventbus.*; import dev.kske.eventbus.core.*;
import dev.kske.eventbus.Event; import dev.kske.eventbus.core.Event;
import envoy.data.*; import envoy.data.*;
import envoy.data.Attachment.AttachmentType; import envoy.data.Attachment.AttachmentType;
@ -55,7 +55,7 @@ import envoy.client.util.*;
* @author Kai S. K. Engelbart * @author Kai S. K. Engelbart
* @since Envoy Client v0.1-beta * @since Envoy Client v0.1-beta
*/ */
public final class ChatScene implements EventListener, Restorable, KeyboardMapping { public final class ChatScene implements Restorable, KeyboardMapping {
@FXML @FXML
private ListView<Message> messageList; private ListView<Message> messageList;
@ -220,12 +220,13 @@ public final class ChatScene implements EventListener, Restorable, KeyboardMappi
}); });
} }
@Event(eventType = BackEvent.class) @Event(BackEvent.class)
private void onBackEvent() { private void onBackEvent() {
tabPane.getSelectionModel().select(Tabs.CONTACT_LIST.ordinal()); tabPane.getSelectionModel().select(Tabs.CONTACT_LIST.ordinal());
} }
@Event(includeSubtypes = true) @Event
@Polymorphic
private void onMessage(Message message) { private void onMessage(Message message) {
// The sender of the message is the recipient of the chat // The sender of the message is the recipient of the chat
@ -304,7 +305,7 @@ public final class ChatScene implements EventListener, Restorable, KeyboardMappi
})); }));
} }
@Event(eventType = NoAttachments.class) @Event(NoAttachments.class)
private void onNoAttachments() { private void onNoAttachments() {
Platform.runLater(() -> { Platform.runLater(() -> {
attachmentButton.setDisable(true); attachmentButton.setDisable(true);
@ -317,12 +318,13 @@ public final class ChatScene implements EventListener, Restorable, KeyboardMappi
}); });
} }
@Event(priority = 150) @Event
@Priority(150)
private void onGroupCreationResult(GroupCreationResult result) { private void onGroupCreationResult(GroupCreationResult result) {
Platform.runLater(() -> newGroupButton.setDisable(result.get() == null)); Platform.runLater(() -> newGroupButton.setDisable(result.get() == null));
} }
@Event(eventType = ThemeChangeEvent.class) @Event(ThemeChangeEvent.class)
private void onThemeChange() { private void onThemeChange() {
settingsButton.setGraphic( settingsButton.setGraphic(
new ImageView(IconUtil.loadIconThemeSensitive("settings", DEFAULT_ICON_SIZE))); new ImageView(IconUtil.loadIconThemeSensitive("settings", DEFAULT_ICON_SIZE)));
@ -345,12 +347,13 @@ public final class ChatScene implements EventListener, Restorable, KeyboardMappi
recipientProfilePic.setImage(IconUtil.loadIconThemeSensitive("group_icon", 43)); recipientProfilePic.setImage(IconUtil.loadIconThemeSensitive("group_icon", 43));
} }
@Event(eventType = Logout.class, priority = 200) @Event(Logout.class)
@Priority(200)
private void onLogout() { private void onLogout() {
eventBus.removeListener(this); eventBus.removeListener(this);
} }
@Event(eventType = AccountDeletion.class) @Event(AccountDeletion.class)
private void onAccountDeletion() { private void onAccountDeletion() {
Platform.runLater(chatList::refresh); Platform.runLater(chatList::refresh);
} }
@ -782,7 +785,8 @@ public final class ChatScene implements EventListener, Restorable, KeyboardMappi
attachmentView.setVisible(visible); attachmentView.setVisible(visible);
} }
@Event(eventType = OwnStatusChange.class, priority = 50) @Event(OwnStatusChange.class)
@Priority(50)
private void generateOwnStatusControl() { private void generateOwnStatusControl() {
// Update the own user status if present // Update the own user status if present
@ -793,7 +797,7 @@ public final class ChatScene implements EventListener, Restorable, KeyboardMappi
// Else prepend it to the HBox children // Else prepend it to the HBox children
final var ownUserControl = new ContactControl(localDB.getUser()); final var ownUserControl = new ContactControl(localDB.getUser());
ownUserControl.setAlignment(Pos.CENTER_LEFT); ownUserControl.setAlignment(Pos.CENTER_LEFT);
HBox.setHgrow(ownUserControl, Priority.NEVER); HBox.setHgrow(ownUserControl, javafx.scene.layout.Priority.NEVER);
ownContactControl.getChildren().add(1, ownUserControl); ownContactControl.getChildren().add(1, ownUserControl);
} }
} }

View File

@ -7,7 +7,7 @@ import javafx.fxml.FXML;
import javafx.scene.control.*; import javafx.scene.control.*;
import javafx.scene.control.Alert.AlertType; import javafx.scene.control.Alert.AlertType;
import dev.kske.eventbus.*; import dev.kske.eventbus.core.*;
import envoy.data.User; import envoy.data.User;
import envoy.event.ElementOperation; import envoy.event.ElementOperation;
@ -34,7 +34,7 @@ import envoy.client.ui.listcell.ListCellFactory;
* @author Maximilian K&auml;fer * @author Maximilian K&auml;fer
* @since Envoy Client v0.1-beta * @since Envoy Client v0.1-beta
*/ */
public class ContactSearchTab implements EventListener { public class ContactSearchTab {
@FXML @FXML
private TextArea searchBar; private TextArea searchBar;

View File

@ -10,11 +10,11 @@ import javafx.scene.control.*;
import javafx.scene.input.MouseEvent; import javafx.scene.input.MouseEvent;
import javafx.scene.layout.HBox; import javafx.scene.layout.HBox;
import dev.kske.eventbus.*; import dev.kske.eventbus.core.*;
import envoy.data.*; import envoy.data.*;
import envoy.event.GroupCreation; import envoy.event.GroupCreation;
import envoy.event.contact.*; import envoy.event.contact.UserOperation;
import envoy.util.Bounds; import envoy.util.Bounds;
import envoy.client.data.*; import envoy.client.data.*;
@ -33,7 +33,7 @@ import envoy.client.ui.listcell.ListCellFactory;
* @author Maximilian K&auml;fer * @author Maximilian K&auml;fer
* @since Envoy Client v0.1-beta * @since Envoy Client v0.1-beta
*/ */
public class GroupCreationTab implements EventListener { public class GroupCreationTab {
@FXML @FXML
private Button createButton; private Button createButton;

View File

@ -10,7 +10,7 @@ import javafx.scene.control.*;
import javafx.scene.control.Alert.AlertType; import javafx.scene.control.Alert.AlertType;
import javafx.scene.image.ImageView; import javafx.scene.image.ImageView;
import dev.kske.eventbus.*; import dev.kske.eventbus.core.*;
import envoy.data.LoginCredentials; import envoy.data.LoginCredentials;
import envoy.event.HandshakeRejection; import envoy.event.HandshakeRejection;
@ -27,7 +27,7 @@ import envoy.client.util.IconUtil;
* @author Maximilian K&auml;fer * @author Maximilian K&auml;fer
* @since Envoy Client v0.1-beta * @since Envoy Client v0.1-beta
*/ */
public final class LoginScene implements EventListener { public final class LoginScene {
@FXML @FXML
private TextField userTextField; private TextField userTextField;

View File

@ -2,7 +2,7 @@ package envoy.client.ui.settings;
import javafx.scene.control.*; import javafx.scene.control.*;
import dev.kske.eventbus.EventBus; import dev.kske.eventbus.core.EventBus;
import envoy.data.User.UserStatus; import envoy.data.User.UserStatus;

View File

@ -15,7 +15,7 @@ import javafx.scene.layout.HBox;
import javafx.stage.FileChooser; import javafx.stage.FileChooser;
import javafx.util.Duration; import javafx.util.Duration;
import dev.kske.eventbus.EventBus; import dev.kske.eventbus.core.EventBus;
import envoy.event.*; import envoy.event.*;
import envoy.util.*; import envoy.util.*;

View File

@ -7,7 +7,7 @@ import java.util.logging.*;
import javafx.stage.FileChooser; import javafx.stage.FileChooser;
import dev.kske.eventbus.EventBus; import dev.kske.eventbus.core.EventBus;
import envoy.data.Message; import envoy.data.Message;
import envoy.util.EnvoyLog; import envoy.util.EnvoyLog;

View File

@ -5,7 +5,7 @@ import java.util.logging.*;
import javafx.scene.control.*; import javafx.scene.control.*;
import javafx.scene.control.Alert.AlertType; import javafx.scene.control.Alert.AlertType;
import dev.kske.eventbus.EventBus; import dev.kske.eventbus.core.EventBus;
import envoy.data.*; import envoy.data.*;
import envoy.data.User.UserStatus; import envoy.data.User.UserStatus;

View File

@ -16,12 +16,13 @@ module envoy.client {
requires javafx.fxml; requires javafx.fxml;
requires javafx.base; requires javafx.base;
requires javafx.graphics; requires javafx.graphics;
requires dev.kske.eventbus.core;
opens envoy.client.ui to javafx.graphics, javafx.fxml, dev.kske.eventbus; opens envoy.client.ui to javafx.graphics, javafx.fxml, dev.kske.eventbus.core;
opens envoy.client.ui.controller to javafx.graphics, javafx.fxml, envoy.client.util, dev.kske.eventbus; opens envoy.client.ui.controller to javafx.graphics, javafx.fxml, envoy.client.util, dev.kske.eventbus.core;
opens envoy.client.ui.chatscene to javafx.graphics, javafx.fxml, envoy.client.util, dev.kske.eventbus; opens envoy.client.ui.chatscene to javafx.graphics, javafx.fxml, envoy.client.util, dev.kske.eventbus.core;
opens envoy.client.ui.control to javafx.graphics, javafx.fxml; opens envoy.client.ui.control to javafx.graphics, javafx.fxml;
opens envoy.client.ui.settings to envoy.client.util; opens envoy.client.ui.settings to envoy.client.util;
opens envoy.client.net to dev.kske.eventbus; opens envoy.client.net to dev.kske.eventbus.core;
opens envoy.client.data to dev.kske.eventbus; opens envoy.client.data to dev.kske.eventbus.core;
} }

View File

@ -12,18 +12,11 @@
<version>0.2-beta</version> <version>0.2-beta</version>
</parent> </parent>
<repositories>
<repository>
<id>kske-repo</id>
<url>https://kske.dev/maven-repo</url>
</repository>
</repositories>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>dev.kske</groupId> <groupId>dev.kske</groupId>
<artifactId>event-bus</artifactId> <artifactId>event-bus-core</artifactId>
<version>0.0.4</version> <version>1.0.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>

View File

@ -2,15 +2,13 @@ package envoy.data;
import java.io.Serializable; import java.io.Serializable;
import dev.kske.eventbus.IEvent;
/** /**
* Generates increasing IDs between two numbers. * Generates increasing IDs between two numbers.
* *
* @author Kai S. K. Engelbart * @author Kai S. K. Engelbart
* @since Envoy Common v0.2-alpha * @since Envoy Common v0.2-alpha
*/ */
public final class IDGenerator implements IEvent, Serializable { public final class IDGenerator implements Serializable {
private final long end; private final long end;
private long current; private long current;

View File

@ -4,8 +4,6 @@ import java.io.Serializable;
import java.time.Instant; import java.time.Instant;
import java.util.Objects; import java.util.Objects;
import dev.kske.eventbus.IEvent;
/** /**
* Represents a unique message with a unique, numeric ID. Further metadata includes the sender and * Represents a unique message with a unique, numeric ID. Further metadata includes the sender and
* recipient {@link User}s, as well as the creation date and the current {@link MessageStatus}.<br> * recipient {@link User}s, as well as the creation date and the current {@link MessageStatus}.<br>
@ -14,7 +12,7 @@ import dev.kske.eventbus.IEvent;
* @author Leon Hofmeister * @author Leon Hofmeister
* @since Envoy Common v0.2-alpha * @since Envoy Common v0.2-alpha
*/ */
public class Message implements Serializable, IEvent { public class Message implements Serializable {
/** /**
* This enumeration defines all possible statuses a {link Message} can have. * This enumeration defines all possible statuses a {link Message} can have.

View File

@ -3,18 +3,15 @@ package envoy.event;
import java.io.Serializable; import java.io.Serializable;
import java.util.Objects; import java.util.Objects;
import dev.kske.eventbus.IEvent;
/** /**
* This class serves as a convenience base class for all events. It implements the {@link IEvent} * This class serves as a convenience base class for all events. It provides a generic value. For
* interface and provides a generic value. For events without a value there also is * events without a value there also is {@link envoy.event.Event.Valueless}.
* {@link envoy.event.Event.Valueless}.
* *
* @author Kai S. K. Engelbart * @author Kai S. K. Engelbart
* @param <T> the type of the Event * @param <T> the type of the Event
* @since Envoy v0.2-alpha * @since Envoy v0.2-alpha
*/ */
public abstract class Event<T> implements IEvent, Serializable { public abstract class Event<T> implements Serializable {
protected final T value; protected final T value;

View File

@ -16,5 +16,5 @@ module envoy.common {
exports envoy.event.contact; exports envoy.event.contact;
requires transitive java.logging; requires transitive java.logging;
requires transitive dev.kske.eventbus; requires transitive dev.kske.eventbus.core;
} }