Knopflerfish OSGi 2.4.0

org.knopflerfish.service.desktop
Interface SwingBundleDisplayer


public interface SwingBundleDisplayer

Interface for services wishing to become visible as components in the desktop Swing window.

The desktop window can be extended by new components, displaying bundle details. To extend the desktop, create and register an instance of SwingBundleDisplayer.

In fact, all internal views in the desktop bundle are created by such services.

Service properties

All SwingBundleDisplayer should be registered with a set of properties:

Additionally, displayers may provide an icon which will be displayed next to the name/description.

The bundle selection is described by an BundleSelectionModel, and displayer should be prepared to display different content depending on which bundles are selected. To modify the selection (and thus update all other registered displayers), use the setSelection and clearSelection methods in the BundleSelectionModel

Desktop usage of Bundle attributes

When the desktop displays bundle information, some bundle attributes are used. The same method should be used by bundle displayers.
Bundle-Activator
The Bundle-Activator is used to select from the built in "application" or "library" icons. If the bundle has a bundle activator set, the application icon is selected, otherwise the library icon.
Application-Icon
If Application-Icon is set to a resource name of an icon, this icon is used insead of the built in application of library icons. The icon is accessed using the bundle://[bundle id] URL scheme.


Field Summary
static java.lang.String PROP_DESCRIPTION
          Service Property (String)
static java.lang.String PROP_ISDETAIL
          Service Property (Boolean)
static java.lang.String PROP_NAME
          Service Property (String)
 
Method Summary
 javax.swing.JComponent createJComponent()
          Create the actual component that should be displayed.
 void disposeJComponent(javax.swing.JComponent comp)
          Perform any necessary cleanup operations.
 javax.swing.Icon getLargeIcon()
          Get a large icon (48x48) for the displayer.
 javax.swing.Icon getSmallIcon()
          Get a smaller icon (22x22) for the displayer.
 void setBundleSelectionModel(BundleSelectionModel model)
           
 void setTargetBundleContext(BundleContext bc)
          Allow access to another bundle context than the displayer's own.
 void showBundle(Bundle b)
          Attempt to show the specified bundle.
 

Field Detail

PROP_NAME

public static final java.lang.String PROP_NAME
Service Property (String)

Value is org.knopflerfish.service.desktop.displayer.name

See Also:
Constant Field Values

PROP_DESCRIPTION

public static final java.lang.String PROP_DESCRIPTION
Service Property (String)

Value is org.knopflerfish.service.desktop.displayer.description

See Also:
Constant Field Values

PROP_ISDETAIL

public static final java.lang.String PROP_ISDETAIL
Service Property (Boolean)

Value is org.knopflerfish.service.desktop.displayer.isdetail

See Also:
Constant Field Values
Method Detail

createJComponent

public javax.swing.JComponent createJComponent()
Create the actual component that should be displayed.

New components must be created for each createJComponent call.


disposeJComponent

public void disposeJComponent(javax.swing.JComponent comp)
Perform any necessary cleanup operations.

Parameters:
comp - Component previously created by createJComponent

setBundleSelectionModel

public void setBundleSelectionModel(BundleSelectionModel model)
Parameters:
model - Selection model describing which bundles are selected. The actual bundle list must be managed by the displayer itself.

getLargeIcon

public javax.swing.Icon getLargeIcon()
Get a large icon (48x48) for the displayer.

null can be returned if no icon is provided.


getSmallIcon

public javax.swing.Icon getSmallIcon()
Get a smaller icon (22x22) for the displayer.

null can be returned if no icon is provided.


setTargetBundleContext

public void setTargetBundleContext(BundleContext bc)
Allow access to another bundle context than the displayer's own. This might be used to set a remote bundle context.

This method might never be called - the displayer should in that case use its own context. The normal case is to start with the displayer's own context and later switch to another context.

If setTargetBundleContext is called, the displayer must update all components with this context.


showBundle

public void showBundle(Bundle b)
Attempt to show the specified bundle.


Knopflerfish OSGi 2.4.0