com.mmoui.manager.services
Interface NewsService

All Superinterfaces:
java.lang.Runnable, Service

public interface NewsService
extends java.lang.Runnable, Service

Defines an OSGi service which allows for news information to be displayed on the main screen of the MMOUI Manager. Each NewsService instance operates in its own thread such that they need not worry about interfering with each other or yielding CPU time. NewsService instances are run via an adaptive thread pool so the information should be accessible quickly.

Version:
$Id: NewsService.java 223 2009-05-14 10:10:05Z mpdelbuono $
Author:
Matthew P. Del Buono

Method Summary
 java.awt.Component getNewsPanel()
          Gets the panel to display in this NewsService implementation's news tab.
 void initialize(ModuleLogger log)
          Initializes this logging service.
 void run()
          Executes this news service.
 void setHyperlinkHandler(BrowserPopupCreator creator)
          Sets the hyperlink handler for this news service.
 
Methods inherited from interface com.mmoui.manager.services.Service
getAdvertisements, getFullProviderName, getPermissions, getShortProviderName
 

Method Detail

initialize

void initialize(ModuleLogger log)
Initializes this logging service. This is guaranteed to be called before any other calls except getShortProviderName() and getFullProviderName().

Parameters:
log - the logging object to use by the module to report messages

getNewsPanel

java.awt.Component getNewsPanel()

Gets the panel to display in this NewsService implementation's news tab. The panel is displayed naturally with a white background, so, while not enforced, it is generally recommended that implementations provide a panel with a white background to match the look and feel of other NewsService objects and the overall manager UI.

The panel is displayed in a Swing layout, so if desired, Swing components may be returned and will be appropriately managed. If a swing component is used, the package must remember to declare the Import-Package header in the bundle manifest with the javax.swing package.

No information should be downloaded, nor complex information processed, until execution of the run() method. This should simply provide a relatively empty panel which will be filled by a future call to run().

Returns:
the panel to display in this news service's tab
See Also:
run()

setHyperlinkHandler

void setHyperlinkHandler(BrowserPopupCreator creator)

Sets the hyperlink handler for this news service. The news service should call the popup creator to create a popup web browser whenever a user clicks on a link.

It is strongly advised that this not be used for automated popups. Only popups intentionally triggered by the user should be handled.

Note that this method is NOT guaranteed to be called by the core. If the core cannot identify the appropriate method to create a popup window, it will not call this method. As such, the module must be prepared to ignore hyperlink requests if it has not yet received this call.

Parameters:
creator - the BrowserPopupCreator object that should handle hyperlink requests.

run

void run()
Executes this news service. This method is run in its own thread so that news services can perform complex and blocking operations without fear of locking up the UI. This is where the NewsService implementation should perform the majority of its work, including the actual downloading of information. This method should "fill in" the information for the panel specified in a former call to getNewsPanel()

Specified by:
run in interface java.lang.Runnable
See Also:
getNewsPanel()