public interface ComponentProvider
For now, the only components that can be provided are JMenu
instances, which are added in and removed from the main dialog's menu bar.
Other kinds of components can/will be supported in the future.
If the implementing class of this interface contains a method with the signature #init(org.osgi.framework.BundleContext) (any access modifier), it will be called automatically upon registration of this service. This allows implementors to obtain the BundleContext of this service and access other OSGi services in a low-level manner.
Modifier and Type | Field and Description |
---|---|
static String |
COMPONENT_ID_KEY
Constant to identify ComponentProvider services.
|
static String |
MENU_COMPONENT
Constant to provide a menu component.
|
Modifier and Type | Method and Description |
---|---|
void |
addedToContainer()
Triggered when the component is added to a container.
|
JComponent |
getComponent()
Returns the actual instance of the component provided by this
implementation.
|
void |
removedFromContainer()
Triggered when the component is about to get removed from a container.
|
static final String COMPONENT_ID_KEY
static final String MENU_COMPONENT
void addedToContainer()
Implementors can use this method to initialize listeners and/or other components in context of the (parent) container.
The implementation can validate some stuff. This function is always called
on the Event Dispatch Thread (EDT).
Implementors may assume this function is called once after
getComponent()
.
JComponent getComponent()
Implementors of this interface should keep track of the returned components themselves to access their context (e.g.: their parent). In other words, implementors should return exactly one instance of the component provided by their implementation.
This function is always be called on the Event Dispatch Thread
(EDT). The implementor may assume that this function is called once before
addedToContainer()
, but afterwards, this method can be called
multiple times.
null
.void removedFromContainer()
Implementors can use this method to remove listeners and/or other components in context of the (parent) container.
The implementation can validate some stuff. This function must be
called on the Event Dispatch Thread (EDT).
Implementors may assume this function is called once after
getComponent()
.
Copyright © 2015 L'Xtreme IT consultancy. All rights reserved.