Module tvbrowser

Class AbstractPluginProxy

    • Field Detail

      • DEFAULT_PLUGIN_ICON_NAME

        public static final java.lang.String DEFAULT_PLUGIN_ICON_NAME
        See Also:
        Constant Field Values
      • mLocalizer

        protected static final Localizer mLocalizer
        The localizer for this class.
    • Constructor Detail

      • AbstractPluginProxy

        protected AbstractPluginProxy()
    • Method Detail

      • setActivated

        final void setActivated​(boolean activated)
        Sets whether the plugin is currently activated.

        This method may only be called by the PluginProxyManager (that's why it is package private).

        Parameters:
        activated - Whether the plugin is currently activated.
        See Also:
        isActivated(), assertActivatedState()
      • setParentFrame

        abstract void setParentFrame​(java.awt.Frame parent)
        Sets the parent frame to the plugin.
        Parameters:
        parent - The parent frame to set.
      • loadSettings

        final void loadSettings​(java.io.File userDirectory)
                         throws TvBrowserException
        Loads the settings for this plugin.
        Parameters:
        userDirectory - The directory where the user data is stored.
        Throws:
        TvBrowserException - If loading failed.
      • doLoadSettings

        protected abstract void doLoadSettings​(java.io.File userDirectory)
                                        throws TvBrowserException
        Really loads the settings for this plugin.
        Parameters:
        userDirectory - The directory where the user data is stored.
        Throws:
        TvBrowserException - If loading failed.
      • saveSettings

        final void saveSettings​(java.io.File userDirectory,
                                boolean log)
                         throws TvBrowserException
        Saves the settings for this plugin.
        Parameters:
        userDirectory - The directory where the user data is stored.
        log - If log entries should be written.
        Throws:
        TvBrowserException - If saving failed.
      • doSaveSettings

        protected abstract void doSaveSettings​(java.io.File userDirectory,
                                               boolean log)
                                        throws TvBrowserException
        Really saves the settings for this plugin.
        Parameters:
        userDirectory - The directory where the user data is stored.
        log - If log entries should be written.
        Throws:
        TvBrowserException - If saving failed.
      • getInfo

        public final PluginInfo getInfo()
        Gets the meta information about the plugin.
        Specified by:
        getInfo in interface InfoIf
        Specified by:
        getInfo in interface PluginAccess
        Returns:
        The meta information about the plugin.
      • doGetInfo

        protected abstract PluginInfo doGetInfo()
        Really gets the meta information about the plugin.
        Returns:
        The meta information about the plugin.
      • getSettingsTab

        public final SettingsTabProxy getSettingsTab()
        Gets the SettingsTab object, which is added to the settings-window.
        Specified by:
        getSettingsTab in interface PluginProxy
        Returns:
        the SettingsTab object or null if the plugin does not provide this feature.
      • doGetSettingsTab

        protected abstract SettingsTabProxy doGetSettingsTab()
        Rally gets the SettingsTab object, which is added to the settings-window.
        Returns:
        the SettingsTab object or null if the plugin does not provide this feature.
      • getContextMenuActions

        public final ActionMenu getContextMenuActions​(Program program)
        Gets the actions for the context menu of a program.
        Specified by:
        getContextMenuActions in interface ContextMenuIf
        Parameters:
        program - The program the context menu will be shown for.
        Returns:
        the actions this plugin provides for the given program or null if the plugin does not provide this feature.
      • doGetContextMenuActions

        protected abstract ActionMenu doGetContextMenuActions​(Program program)
        Really gets the actions for the context menu of a program.
        Parameters:
        program - The program the context menu will be shown for.
        Returns:
        the actions this plugin provides for the given program or null if the plugin does not provide this feature.
        See Also:
        getContextMenuActions(Program)
      • getContextMenuActions

        public final ActionMenu getContextMenuActions​(Channel channel)
        Gets the actions for the context menu of a channel.
        Specified by:
        getContextMenuActions in interface PluginProxy
        Parameters:
        channel - The channel the context menu will be shown for.
        Returns:
        the actions this plugin provides for the given channel or null if the plugin does not provide this feature.
      • doGetContextMenuActions

        protected abstract ActionMenu doGetContextMenuActions​(Channel channel)
        Really gets the actions for the context menu of a channel.
        Parameters:
        channel - The channel the context menu will be shown for.
        Returns:
        the actions this plugin provides for the given channel or null if the plugin does not provide this feature.
        See Also:
        getContextMenuActions(Program)
      • getButtonAction

        public final ActionMenu getButtonAction()
        Gets the action to use for the main menu and the toolbar.
        Specified by:
        getButtonAction in interface ButtonActionIf
        Specified by:
        getButtonAction in interface PluginProxy
        Returns:
        the action to use for the menu and the toolbar or null if the plugin does not provide this feature.
      • doGetButtonAction

        protected abstract ActionMenu doGetButtonAction()
        Really gets the action to use for the main menu and the toolbar.
        Returns:
        the action to use for the menu and the toolbar or null if the plugin does not provide this feature.
        See Also:
        getButtonAction()
      • getMarkIcons

        public javax.swing.Icon[] getMarkIcons​(Program p)
        Gets the icons to use for marking programs in the program table.
        Specified by:
        getMarkIcons in interface Marker
        Specified by:
        getMarkIcons in interface PluginAccess
        Parameters:
        p - The program to check.
        Returns:
        the icons to use for marking programs in the program table.
      • getMarkIcon

        public javax.swing.Icon getMarkIcon()
        Gets the icon to use for marking programs in the program table.
        Specified by:
        getMarkIcon in interface Marker
        Specified by:
        getMarkIcon in interface PluginAccess
        Returns:
        the icon to use for marking programs in the program table.
      • doGetMarkIcons

        protected abstract javax.swing.Icon[] doGetMarkIcons​(Program p)
        Really gets the icon to use for marking programs in the program table.
        Parameters:
        p - The program to get the mark icons for.
        Returns:
        the icon to use for marking programs in the program table.
      • getProgramTableIconText

        public final java.lang.String getProgramTableIconText()
        Gets the description text for the program table icons provided by this Plugin.

        Return null if your plugin does not provide this feature.

        Specified by:
        getProgramTableIconText in interface PluginAccess
        Returns:
        The description text for the program table icons or null if the plugin does not provide this feature.
        See Also:
        getProgramTableIcons(Program)
      • doGetProgramTableIconText

        protected abstract java.lang.String doGetProgramTableIconText()
        Gets the description text for the program table icons provided by this Plugin.

        Return null if your plugin does not provide this feature.

        Returns:
        The description text for the program table icons or null if the plugin does not provide this feature.
        See Also:
        getProgramTableIcons(Program)
      • getProgramTableToolTipIcons

        public ToolTipIcon[] getProgramTableToolTipIcons​(Program program)
        Gets the ToolTipIcons for the program table icons provided by this Plugin.

        Override this method if your plugin provides icons for the program table (shown below the start time) and you want the icons to be shown in the tooltip.

        Specified by:
        getProgramTableToolTipIcons in interface PluginAccess
        Parameters:
        program - The program to get the ToolTipIcons for.
        Returns:
        The description text for the program table icons or null if the plugin does not provide this feature.
        Since:
        3.4.2
        See Also:
        getProgramTableIcons(Program)
      • doGetProgramTableToolTipIcons

        protected abstract ToolTipIcon[] doGetProgramTableToolTipIcons​(Program program)
        Gets the ToolTipIcons for the program table icons provided by this Plugin.

        Override this method if your plugin provides icons for the program table (shown below the start time) and you want the icons to be shown in the tooltip.

        Parameters:
        program - The program to get the ToolTipIcons for.
        Returns:
        The description text for the program table icons or null if the plugin does not provide this feature.
        Since:
        3.4.2
        See Also:
        getProgramTableIcons(Program)
      • getProgramTableIcons

        public final javax.swing.Icon[] getProgramTableIcons​(Program program)
        Gets the icons this Plugin provides for the given program. These icons will be shown in the program table under the start time.

        Return null if your plugin does not provide this feature.

        Specified by:
        getProgramTableIcons in interface PluginAccess
        Parameters:
        program - The programs to get the icons for.
        Returns:
        The icons for the given program or null.
        See Also:
        getProgramTableIconText()
      • doGetProgramTableIcons

        protected abstract javax.swing.Icon[] doGetProgramTableIcons​(Program program)
        Really gets the icons this Plugin provides for the given program. These icons will be shown in the program table under the start time.

        Return null if your plugin does not provide this feature.

        Parameters:
        program - The programs to get the icons for.
        Returns:
        The icons for the given program or null.
        See Also:
        getProgramTableIconText()
      • onActivation

        public void onActivation()
        Description copied from interface: PluginProxy
        This method is automatically called after activating the plugin (either during the TV-Browser startup phase or after manually activating the disabled plugin in the settings).
        Specified by:
        onActivation in interface PluginProxy
      • doOnActivation

        protected abstract void doOnActivation()
                                        throws java.lang.Throwable
        Throws:
        java.lang.Throwable
      • onDeactivation

        public void onDeactivation()
        Description copied from interface: PluginProxy
        This method is automatically called after deactivating the plugin.
        Specified by:
        onDeactivation in interface PluginProxy
      • doOnDeactivation

        protected abstract void doOnDeactivation()
                                          throws java.lang.Throwable
        Throws:
        java.lang.Throwable
      • canUseProgramTree

        public boolean canUseProgramTree()
        Specified by:
        canUseProgramTree in interface PluginProxy
        Returns:
        true, if the programs of this plugin are handled by the plugin tree view
      • handleTvBrowserStartFinished

        public void handleTvBrowserStartFinished()
        This method is called when the TV-Browser start is complete.
        Specified by:
        handleTvBrowserStartFinished in interface PluginProxy
        Since:
        2.2
      • doHandleTvBrowserStartFinished

        protected abstract void doHandleTvBrowserStartFinished()
      • doCanUseProgramTree

        protected abstract boolean doCanUseProgramTree()
      • toString

        public final java.lang.String toString()
        Gets the name of the plugin.

        This way Plugin objects may be used directly in GUI components like JLists.

        Overrides:
        toString in class java.lang.Object
        Returns:
        the name of the plugin.
      • handlePluginException

        public void handlePluginException​(java.lang.Throwable t)
        Handles a runtime exception that was caused by the plugin.
        Specified by:
        handlePluginException in interface PluginProxy
        Parameters:
        t - The exception to handle
      • doCanReceiveProgramsWithTarget

        protected abstract boolean doCanReceiveProgramsWithTarget()
        Really gets whether the plugin supports receiving programs from other plugins with target.
        Returns:
        Whether the plugin supports receiving programs from other plugins with target.
        Since:
        2.5
        See Also:
        ProgramReceiveIf.receivePrograms(Program[],ProgramReceiveTarget)
      • receivePrograms

        public final boolean receivePrograms​(int type,
                                             Program[] programArr,
                                             ProgramReceiveTarget receiveTarget)
        Receives a list of programs from another plugin with a target.
        Specified by:
        receivePrograms in interface ProgramReceiveIf
        Parameters:
        programArr - The programs passed from the other plugin.
        receiveTarget - The target of the programs.
        Returns:
        true, if the programs were correctly received and the target really exists.
        Since:
        4.2.2
        See Also:
        #getSupportedProgramRecieveType()
      • doReceivePrograms

        protected abstract boolean doReceivePrograms​(int type,
                                                     Program[] programArr,
                                                     ProgramReceiveTarget receiveTarget)
        Really receives a list of programs from another plugin with target.
        Parameters:
        type - The type set by the sending plugin.
        programArr - The programs passed from the other plugin with target.
        receiveTarget - The target of the programs.
        Returns:
        true If the received programs were successfully processed.
        Since:
        4.2.2
        See Also:
        canReceiveProgramsWithTarget()
      • receiveValues

        public final boolean receiveValues​(int type,
                                           java.lang.String[] values,
                                           ProgramReceiveTarget receiveTarget)
        Receives a list of Strings from another plugin with a target.
        Specified by:
        receiveValues in interface ProgramReceiveIf
        Parameters:
        type - The type set by the sending plugin.
        values - The value array passed from the other plugin.
        receiveTarget - The receive target of the programs.
        Returns:
        true if the value array was handled correct, false otherwise.
        Since:
        4.2.2
        See Also:
        #getSupportedProgramRecieveType()
      • doReceiveValues

        protected abstract boolean doReceiveValues​(int type,
                                                   java.lang.String[] values,
                                                   ProgramReceiveTarget receiveTarget)
        Really receives a list of Strings from another plugin with a target.
        Parameters:
        type - The type set by the sending plugin.
        values - The value array passed from the other plugin.
        receiveTarget - The receive target of the programs.
        Returns:
        true if the value array was handled correct, false otherwise.
        Since:
        4.2.2
        See Also:
        #getSupportedProgramRecieveType()
      • getAvailableFilter

        public PluginsProgramFilter[] getAvailableFilter()
        Returns the available program filters that the plugin supports.
        Specified by:
        getAvailableFilter in interface PluginAccess
        Returns:
        The available program filters that the plugin supports or null if it supports no filter.
        Since:
        2.5
      • doGetAvailableFilter

        protected abstract PluginsProgramFilter[] doGetAvailableFilter()
        Really returns the available program filters that the plugin supports.
        Returns:
        The available program filters that the plugin supports or null if it supports no filter.
        Since:
        2.5
      • isAllowedToDeleteProgramFilter

        public boolean isAllowedToDeleteProgramFilter​(PluginsProgramFilter programFilter)
        Is used to track if a program filter be deleted. Should be make sure only the plugin itself can delete program filters.
        Specified by:
        isAllowedToDeleteProgramFilter in interface PluginProxy
        Parameters:
        programFilter - The program filter to delete.
        Returns:
        True if the program filter component can be deleted.
        Since:
        2.5
      • doIsAllowedToDeleteProgramFilter

        protected abstract boolean doIsAllowedToDeleteProgramFilter​(PluginsProgramFilter programFilter)
        Really return if a program filter can be deleted.
        Parameters:
        programFilter - The program filter to delete.
        Returns:
        True if the program filter component can be deleted.
        Since:
        2.5
      • getAvailableFilterComponentClasses

        public java.lang.Class<? extends PluginsFilterComponent>[] getAvailableFilterComponentClasses()
        Returns the available plugins filter component classes.
        ATTENTON: Use return (Class<? extends PluginsFilterComponent>[]) new Class[] {MyFilterComponent1.class,MyFilterComponent2.class}; because the creation of a class array with generic type didn't work.
        Specified by:
        getAvailableFilterComponentClasses in interface PluginAccess
        Returns:
        The available plugins filter components classes or null if no plugins filter components are supported.
        Since:
        2.5
      • doGetAvailableFilterComponentClasses

        protected abstract java.lang.Class<? extends PluginsFilterComponent>[] doGetAvailableFilterComponentClasses()
        Really gets the available filter component classes.
        Returns:
        The available plugins filter components classes or null if no plugins filter components are supported.
        Since:
        2.5
      • doGetMarkPriorityMaxForProgram

        protected abstract int doGetMarkPriorityMaxForProgram​(Program p)
        Really gets the mark priority for the given Program.

        Parameters:
        p - The program to get the mark priority for.
        Returns:
        The mark priority for the given program.
      • doGetMarkPrioritiesForProgram

        protected abstract int[] doGetMarkPrioritiesForProgram​(Program p)
        Really gets the mark priority for the given Program.

        Parameters:
        p - The program to get the mark priority for.
        Returns:
        The mark priority for the given program.
      • assertActivatedState

        protected void assertActivatedState()
                                     throws TvBrowserException
        Checks whether the plugin is activated. If it is not an error message is shown.
        Throws:
        TvBrowserException - If the plugin is not activated
      • getPluginIcon

        public javax.swing.Icon getPluginIcon()
        Description copied from interface: PluginProxy
        get the icon to represent this plugin in the settings
        Specified by:
        getPluginIcon in interface PluginProxy
        Returns:
        icon
      • doGetAllowsArtificialPluginTree

        protected abstract boolean doGetAllowsArtificialPluginTree()
      • removeArtificialPluginTree

        public final void removeArtificialPluginTree()
      • getCommunicationClass

        public PluginCommunication getCommunicationClass()
        Description copied from interface: PluginAccess
        If this Plugin grants access to functions it will provide a communication class for other Plugins to use.

        Specified by:
        getCommunicationClass in interface PluginAccess
        Returns:
        The communication class of this Plugin or null if there is no communication class for this Plugin.
      • getAddtionalProgramInfoForProgram

        public ProgramInfo[] getAddtionalProgramInfoForProgram​(Program p,
                                                               java.lang.String uniqueId)
        Gets additional program infos for the given program. This method should return an array with all possible infos when called with the TV-Browser example Program. Every additional info must have an unique ID, so the name might be changed but the ID never must.

        Specified by:
        getAddtionalProgramInfoForProgram in interface PluginProxy
        Parameters:
        p - The program to get the additional program info for.
        uniqueId - If not null the id of the program info to get.
        Returns:
        An array with the additional program info or null if no additional info is available.
        Since:
        3.4.4
      • doGetAddtionalProgramInfoForProgram

        public abstract ProgramInfo[] doGetAddtionalProgramInfoForProgram​(Program p,
                                                                          java.lang.String uniqueId)