TV-Browser 3.3.3 API

tvbrowser.core.plugin
Class PluginProxyManager

java.lang.Object
  extended by tvbrowser.core.plugin.PluginProxyManager

public class PluginProxyManager
extends java.lang.Object

Manages all plugin proxies and creates them on startup.

Note: This class is not called "PluginManager" as in older versions, to make a difference to the class PluginManager.

Author:
Til Schneider, www.murfman.de

Field Summary
static java.lang.String PLUGIN_DIRECTORY
          The name of the directory where the plugins are located in TV-Browser 2.01 and before
 
Method Summary
 void activatePlugin(PluginProxy plugin)
          Activates a plugin.
 void activatePlugin(PluginProxy plugin, boolean setParentFrame)
          Activates a plugin.
 void addPluginStateListener(PluginStateListener listener)
          Registers a PluginStateListener.
static javax.swing.JPopupMenu createPluginContextMenu(Program program)
          Creates a context menu for the given program containing all plugins.
static javax.swing.JPopupMenu createPluginContextMenu(Program program, ContextMenuIf menuIf)
          Creates a context menu for the given program containing all plugins.
 void deactivatePlugin(PluginProxy plugin)
          Deactivates a plugin.
 void firePluginBlockListRenewed()
          Reacts on a change of the blocked plugins setting and deactivates all blocked plugins.
 void fireTvBrowserSettingsChanged()
           
 void fireTvBrowserStartFinished()
          Calls for every subscribed plugin the handleTvBrowserStartComplete() method, so the plugin knows when the TV-Browser start is finished.
 void fireTvBrowserStartFinished(PluginProxy plugin)
           
 PluginProxy getActivatedPluginForId(java.lang.String pluginId)
          Gets the activated plugin with the given ID.
 PluginProxy[] getActivatedPlugins()
          Gets all activated plugins.
 PluginProxy[] getAllPlugins()
          Gets all plugins.
 java.lang.String[] getDeactivatedPluginIds()
          Gets the IDs of all deactivated plugins.
static PluginProxyManager getInstance()
          Gets the singleton.
static java.lang.String getLocalizedStateName(int state)
          Gets the localized name of a state.
 PluginProxy getPluginForId(java.lang.String pluginId)
          Gets the plugin with the given ID.
 void init()
          This method must be called on start-up.
 void registerPlugin(AbstractPluginProxy plugin)
           
 void removePlugin(PluginProxy plugin)
          Deactivates a plugin and removes it from the PluginList
 void removePluginStateListener(PluginStateListener listener)
          Deregisters a PluginStateListener.
 boolean saveSettings(PluginProxy plugin)
          Saves the settings for the given PluginProxy.
 void setParentFrame(java.awt.Frame parent)
          Sets the parent frame to all plugins.
 void setPluginOrder(java.lang.String[] pluginOrderArr)
          Sets the plugin order.
 void shutdownAllPlugins(boolean log)
          Deactivates and shuts down all plugins.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PLUGIN_DIRECTORY

public static final java.lang.String PLUGIN_DIRECTORY
The name of the directory where the plugins are located in TV-Browser 2.01 and before

See Also:
Constant Field Values
Method Detail

getInstance

public static PluginProxyManager getInstance()
Gets the singleton.

Returns:
the singleton.

registerPlugin

public void registerPlugin(AbstractPluginProxy plugin)

init

public void init()
          throws TvBrowserException
This method must be called on start-up.

Throws:
TvBrowserException - If initialization failed.

setParentFrame

public void setParentFrame(java.awt.Frame parent)
Sets the parent frame to all plugins.

Parameters:
parent - The parent frame to set.

setPluginOrder

public void setPluginOrder(java.lang.String[] pluginOrderArr)
Sets the plugin order.

The order will not be saved to the settings. This must be done by the caller.

Parameters:
pluginOrderArr - The IDs of the plugins in the wanted order. All missing plugins will be appended at the end.

activatePlugin

public void activatePlugin(PluginProxy plugin)
                    throws TvBrowserException
Activates a plugin.

Parameters:
plugin - The plugin to activate
Throws:
TvBrowserException - If activating failed

activatePlugin

public void activatePlugin(PluginProxy plugin,
                           boolean setParentFrame)
                    throws TvBrowserException
Activates a plugin.

Parameters:
plugin - The plugin to activate
Throws:
TvBrowserException - If activating failed

firePluginBlockListRenewed

public void firePluginBlockListRenewed()
Reacts on a change of the blocked plugins setting and deactivates all blocked plugins.


deactivatePlugin

public void deactivatePlugin(PluginProxy plugin)
                      throws TvBrowserException
Deactivates a plugin.

Parameters:
plugin - The plugin to deactivate
Throws:
TvBrowserException - If deactivating failed

removePlugin

public void removePlugin(PluginProxy plugin)
                  throws TvBrowserException
Deactivates a plugin and removes it from the PluginList

Parameters:
plugin - The plugin to deactivate
Throws:
TvBrowserException - If deactivating failed

saveSettings

public boolean saveSettings(PluginProxy plugin)
Saves the settings for the given PluginProxy.

Parameters:
plugin - The plugin proxy to save the settings for.
Returns:
If the settings were successfully saved.

shutdownAllPlugins

public void shutdownAllPlugins(boolean log)
Deactivates and shuts down all plugins.

Parameters:
log - If the logging is activated.

getLocalizedStateName

public static java.lang.String getLocalizedStateName(int state)
Gets the localized name of a state.

Parameters:
state - The state to get the localized name for.
Returns:
The localized name for the given state.

getAllPlugins

public PluginProxy[] getAllPlugins()
Gets all plugins.

Returns:
All plugins.

getActivatedPlugins

public PluginProxy[] getActivatedPlugins()
Gets all activated plugins.

Returns:
All activated plugins.

getDeactivatedPluginIds

public java.lang.String[] getDeactivatedPluginIds()
Gets the IDs of all deactivated plugins.

Returns:
the IDs of all deactivated plugins.

getPluginForId

public PluginProxy getPluginForId(java.lang.String pluginId)
Gets the plugin with the given ID.

Parameters:
pluginId - The ID of the wanted plugin.
Returns:
The plugin with the given ID or null if no such plugin exists.

getActivatedPluginForId

public PluginProxy getActivatedPluginForId(java.lang.String pluginId)
Gets the activated plugin with the given ID.

Parameters:
pluginId - The ID of the wanted plugin.
Returns:
The plugin with the given ID or null if no such plugin exists or if the plugin is not activated.

createPluginContextMenu

public static javax.swing.JPopupMenu createPluginContextMenu(Program program)
Creates a context menu for the given program containing all plugins.

Parameters:
program - The program to create the context menu for
Returns:
a context menu for the given program.

createPluginContextMenu

public static javax.swing.JPopupMenu createPluginContextMenu(Program program,
                                                             ContextMenuIf menuIf)
Creates a context menu for the given program containing all plugins.

Parameters:
program - The program to create the context menu for
menuIf - The ContextMenuIf that wants to create the ContextMenu
Returns:
a context menu for the given program.

addPluginStateListener

public void addPluginStateListener(PluginStateListener listener)
Registers a PluginStateListener.

Parameters:
listener - The PluginStateListener to register

removePluginStateListener

public void removePluginStateListener(PluginStateListener listener)
Deregisters a PluginStateListener.

Parameters:
listener - The PluginStateListener to deregister

fireTvBrowserStartFinished

public void fireTvBrowserStartFinished()
Calls for every subscribed plugin the handleTvBrowserStartComplete() method, so the plugin knows when the TV-Browser start is finished.

See Also:
PluginProxy.handleTvBrowserStartFinished()

fireTvBrowserStartFinished

public void fireTvBrowserStartFinished(PluginProxy plugin)
                                throws java.lang.Throwable
Throws:
java.lang.Throwable

fireTvBrowserSettingsChanged

public void fireTvBrowserSettingsChanged()

TV-Browser 3.3.3 API

TV-Browser 3.3.3, Copyright (C) 2004-2008 TV-Browser Team (dev@tvbrowser.org)