TV-Browser 2.7.5 API

tvbrowser.core.plugin
Class PluginProxyManager

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

public class PluginProxyManager
extends Object

Author:
bananeweizen

Field Summary
static int ACTIVATED_STATE
          The plugin state 'activated'.
static int LOADED_STATE
          The plugin state 'loaded'.
static Localizer mLocalizer
          The localizer for this class.
static String PLUGIN_DIRECTORY
          The name of the directory where the plugins are located in TV-Browser 2.01 and before
static int SHUT_DOWN_STATE
          The plugin state 'shut down'.
 
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 JPopupMenu createPluginContextMenu(Program program)
          Creates a context menu for the given program containing all plugins.
static 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 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(String pluginId)
          Gets the activated plugin with the given ID.
 PluginProxy[] getActivatedPlugins()
          Gets all activated plugins.
 PluginProxy[] getAllPlugins()
          Gets all plugins.
 String[] getDeactivatedPluginIds()
          Gets the IDs of all deactivated plugins.
static PluginProxyManager getInstance()
          Gets the singleton.
static String getLocalizedStateName(int state)
          Gets the localized name of a state.
 PluginProxy getPluginForId(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(Frame parent)
          Sets the parent frame to all plugins.
 void setPluginOrder(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

mLocalizer

public static final Localizer mLocalizer
The localizer for this class.


PLUGIN_DIRECTORY

public static final 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

SHUT_DOWN_STATE

public static final int SHUT_DOWN_STATE
The plugin state 'shut down'.

An shut down plugin has been shut down and can't be used any more.

See Also:
Constant Field Values

LOADED_STATE

public static final int LOADED_STATE
The plugin state 'loaded'.

A loaded plugin has an existing PluginProxy instance, but is not activated.

See Also:
Constant Field Values

ACTIVATED_STATE

public static final int ACTIVATED_STATE
The plugin state 'activated'.

An activated plugin has loaded its settings and is ready to be used.

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(Frame parent)
Sets the parent frame to all plugins.

Parameters:
parent - The parent frame to set.

setPluginOrder

public void setPluginOrder(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

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 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 String[] getDeactivatedPluginIds()
Gets the IDs of all deactivated plugins.

Returns:
the IDs of all deactivated plugins.

getPluginForId

public PluginProxy getPluginForId(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(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 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 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)

TV-Browser 2.7.5 API

TV-Browser 2.7.5, Copyright (C) 04-2003 Martin Oberhauser (martin@tvbrowser.org)