Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace EventDispatcher with Guava's EventBus #3741

Merged

Conversation

kwvanderlinde
Copy link
Collaborator

@kwvanderlinde kwvanderlinde commented Nov 15, 2022

Identify the Bug or Feature request

Relates to #1827

Description of the Change

EventBus is already in use for some events, but others events were still based on EventDispatcher/AppEvent. Now only EventBus exists with EventDispatcher and related classes being removed.

Possible Drawbacks

Shouldn't be any, outside of some unforeseen issue with EventBus.

Documentation Notes

N/A (refactoring)

Release Notes

N/A


This change is Reviewable

We're already using `EventBus` for some things, but there were others on `EventDispatcher`. Now only `EventBus`
remains with `EventDispatcher`, `AppEvent` and `AppEventListener` being no more.

The mapping from the previous event tags to the current event types is:
- `MapTool.ZoneEvent.Activated`: `ZoneActivated`
- `MapTool.ZoneEvent.Deactivated`: `ZoneDeactivated`
- `MapTool.ZoneEvent.Added`: `ZoneAdded`
- `MapTool.ZoneEvent.Removed`: `ZoneRemoved`
- `MapTool.PreferencesEvent.Changed`: `PreferencesChanged`

The `Deactivated` was previously unused since the `Activated` event could contain an old and new value in the
`AppEvent`. But it's cleaner in the new system for subscribers to handle deactivation and activation separately and
allows the `ZoneActivated` and `ZoneDeactivated` types to be focused on a single zone. So we now conditionally post a
`ZoneDeactivated` event prior to `ZoneActivated` when necessary.
@Phergus Phergus merged commit 15b890c into RPTools:develop Nov 16, 2022
@kwvanderlinde kwvanderlinde deleted the refactor/1827-replace-event-dispatcher branch March 16, 2023 23:55
@cwisniew cwisniew added the feature Adding functionality that adds value label Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Adding functionality that adds value
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

3 participants