Module tvbrowser

Class 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 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.
      • 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,
                                   boolean setParentFrame)
                            throws TvBrowserException
        Activates a plugin.
        Parameters:
        plugin - The plugin to activate
        setParentFrame - true if the parent frame should be set for the plugin, false if not.
        Throws:
        TvBrowserException - If activating failed
      • firePluginBlockListRenewed

        public void firePluginBlockListRenewed()
        Reacts on a change of the blocked plugins setting and deactivates all blocked plugins.
      • 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.
      • createPluginContextMenu

        public static javax.swing.JPopupMenu createPluginContextMenu​(Program program,
                                                                     ContextMenuIf menuIf,
                                                                     ActionMenu callerMenu)
        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
        callerMenu - The menu to shown for the ContextMenuIf in the created menu
        Returns:
        a context menu for the given program.
        Since:
        4.2.2
      • 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()