Package de.julianweinelt.datacat.dbx.api
Class Registry
java.lang.Object
de.julianweinelt.datacat.dbx.api.Registry
The
Registry class manages the core functionality of the DBX plugin framework,
including:
- Plugin registration and lifecycle
- Custom event handling and listener management
It acts as a centralized manager and dispatcher, handling all dynamic components within the plugin environment.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a plugin to the internal registry.voidCalls a specific event and dispatches it to all registered listeners for the event's name, in priority order.intRetrieves a plugin by its name.static Registryinstance()voidregisterEvent(DbxPlugin plugin, String eventName) Registers a single event name for a given plugin.voidregisterEvents(DbxPlugin plugin, String... eventNames) Registers multiple event names for a given plugin.voidregisterListener(Object listener, DbxPlugin plugin) Registers all listener methods annotated withSubscribein the given listener object.voidregisterTheme(Theme theme) Registers aThemeobject as a new editor theme.voidremovePlugin(DbxPlugin plugin) Removes a plugin and all its associated event registrations.voidremovePlugin(String name) Removes a plugin and all its associated event registrations.voidsetMainFrame(JFrame mainFrame) Gets an internal format for all installed themes to be used in the editor.
-
Constructor Details
-
Registry
-
-
Method Details
-
setMainFrame
-
instance
-
getEventAmount
public int getEventAmount() -
registerEvent
Registers a single event name for a given plugin.- Parameters:
plugin- the plugin registering the eventeventName- the name of the event
-
registerEvents
Registers multiple event names for a given plugin.- Parameters:
plugin- the plugin registering the eventseventNames- the names of the events
-
registerListener
Registers all listener methods annotated withSubscribein the given listener object.- Parameters:
listener- the listener instance containing subscribed methodsplugin- the plugin registering the listener
-
callEvent
Calls a specific event and dispatches it to all registered listeners for the event's name, in priority order.- Parameters:
event- the event to dispatch
-
addPlugin
Adds a plugin to the internal registry.- Parameters:
plugin- the plugin to register
-
getPlugin
Retrieves a plugin by its name.- Parameters:
name- the name of the plugin- Returns:
- the
DbxPlugininstance, ornullif not found
-
removePlugin
Removes a plugin and all its associated event registrations.- Parameters:
name- the name of the plugin to remove
-
removePlugin
Removes a plugin and all its associated event registrations.- Parameters:
plugin- TheDbxPlugininstance to remove
-
registerTheme
Registers aThemeobject as a new editor theme.- Parameters:
theme- The theme object containing all important information
-
getTheme
-
themeData
Gets an internal format for all installed themes to be used in the editor.- Returns:
- A
Mapobject containing the unlocalized name of the theme as the key and the defining plugin as the value
-