TV-Browser 2.7.5 API

tvbrowser.core.plugin
Class PluginManagerImpl

java.lang.Object
  extended by tvbrowser.core.plugin.PluginManagerImpl
All Implemented Interfaces:
PluginManager

public class PluginManagerImpl
extends Object
implements PluginManager

The implementation of the PluginManager interface. This class is the connection for the plugins to TV-Browser.

Author:
Til Schneider, www.murfman.de

Field Summary
 
Fields inherited from interface devplugin.PluginManager
SEARCHER_TYPE_BOOLEAN, SEARCHER_TYPE_EXACTLY, SEARCHER_TYPE_KEYWORD, SEARCHER_TYPE_REGULAR_EXPRESSION
 
Method Summary
 JPopupMenu createPluginContextMenu(Program program, ContextMenuIf caller)
          Creates a context menu for the given program containing all plugins.
 ProgramSearcher createProgramSearcher(int type, String searchTerm, boolean caseSensitive)
          Creates a ProgramSearcher.
 PluginAccess getActivatedPluginForId(String pluginId)
          Gets the activated plugin with the given ID.
 PluginAccess[] getActivatedPlugins()
          Returns all activated Plugins.
 ProgramRatingIf[] getAllProgramRatingIfs()
          Gets all ProgramRatingIfs of all plugins.
 ProgramFilter[] getAvailableFilters()
          Returns an array of all available filters.
 AbstractPluginProgramFormating[] getAvailableGlobalPuginProgramFormatings()
          Gets the available global program configurations.
 Iterator<Program> getChannelDayProgram(Date date, Channel channel)
          Gets an iterator through all programs of the specified channel at the specified date.
 Date getCurrentDate()
          Get the date currently shown in the program table.
 TvDataService getDataService(String dataServiceClassName)
          Deprecated.  
 TvDataServiceProxy getDataServiceProxy(String id)
           
 PluginAccess getDefaultContextMenuPlugin()
          Gets the plugin that is used as default in the context menu.
 Program getExampleProgram()
          Returns an example program.
 FilterManager getFilterManager()
          Returns the filter manager of TV-Browser.
 ImageIcon getIconFromTheme(Plugin plugin, String category, String iconName, int size)
          Returns an icon from the icon-theme-system If your plugin has icons that are not available as icons within an theme, you can add your icons into your jar-file.
 ImageIcon getIconFromTheme(Plugin plugin, ThemeIcon icon)
          Returns an Icon from the Icon-Theme-System If your Plugin has Icons that are not available as Icons within an Theme, you can add your Icons into your Jar-File.
 Plugin[] getInstalledPlugins()
          Deprecated. Since 1.1. Use getActivatedPlugins() instead.
static PluginManager getInstance()
          Returns the instance of this class, if there is no instance it is created first.
 String getJavaPluginId(Plugin javaPlugin)
          Gets the ID of the given Java plugin.
 Program[] getMarkedPrograms()
          Return all marked programs.
 Program getProgram(Date date, String progID)
          Gets a program.
 ProgramReceiveIf getReceiceIfForId(String id)
          Return the ReceiveIfFor given id or null if there is no ReceiveIf for the given id.
 ProgramReceiveIf[] getReceiveIfs()
          Return all Plugins/Functions that are able to receive programs.
 ProgramReceiveIf[] getReceiveIfs(ProgramReceiveIf caller, ProgramReceiveTarget callerTarget)
          Return all Plugins/Functions that are able to receive programs.
 Channel[] getSubscribedChannels()
          Gets all channels the user has subscribed.
 TvBrowserSettings getTvBrowserSettings()
          Returns some settings a plugin may need.
 void goToDate(Date date)
          Let TV-Browser change the date to the given date.
 void handleProgramDoubleClick(Program program)
          Handles a double click on a program.
 void handleProgramDoubleClick(Program program, ContextMenuIf caller)
          Handles a double click on a program.
 void handleProgramMiddleClick(Program program)
          Handles a middle click on a program.
 void handleProgramMiddleClick(Program program, ContextMenuIf caller)
          Handles a middle click on a program.
 void handleProgramSingleClick(Program program)
          Handles a single left click on a program.
 void handleProgramSingleClick(Program program, ContextMenuIf caller)
          Handles a single left click on a program.
protected  void handleTvBrowserStartFinished()
           
 void scrollToChannel(Channel channel)
          Let TV-Browser scroll to the given channel.
 void scrollToProgram(Program program)
          Let TV-Browser scroll to the given program.
 void scrollToTime(int time)
          Let TV-Browser scroll to the given time.
 Program[] search(String regex, boolean inTitle, boolean inText, boolean caseSensitive, Channel[] channels, Date startDate, int nrDays)
          Deprecated. Use createProgramSearcher(int, String, boolean) instead.
 Program[] search(String regex, boolean caseSensitive, ProgramFieldType[] fieldArr, Date startDate, int nrDays, Channel[] channels, boolean sortByStartTime)
          Deprecated. Since 1.1. Use createProgramSearcher(int, String, boolean) instead.
 void showSettings(Plugin plugin)
          Show the Settings-Dialog for a Plugin
 void showSettings(String settingsItem)
          Show the Settings-Dialog with a Specific SettingsItem
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static PluginManager getInstance()
Returns the instance of this class, if there is no instance it is created first.

Returns:
The instance of this class.

getProgram

public Program getProgram(Date date,
                          String progID)
Gets a program.

Specified by:
getProgram in interface PluginManager
Parameters:
date - The date when the program is shown.
progID - The ID of the program.
Returns:
The program or null if there is no such program.

getSubscribedChannels

public Channel[] getSubscribedChannels()
Gets all channels the user has subscribed.

Specified by:
getSubscribedChannels in interface PluginManager
Returns:
all channels the user has subscribed.

getChannelDayProgram

public Iterator<Program> getChannelDayProgram(Date date,
                                              Channel channel)
Gets an iterator through all programs of the specified channel at the specified date.

Specified by:
getChannelDayProgram in interface PluginManager
Parameters:
date - The date of the programs.
channel - The channel of the programs.
Returns:
an Iterator for all programs of one day and channel or null if the requested data is not available.

search

public Program[] search(String regex,
                        boolean inTitle,
                        boolean inText,
                        boolean caseSensitive,
                        Channel[] channels,
                        Date startDate,
                        int nrDays)
                 throws TvBrowserException
Deprecated. Use createProgramSearcher(int, String, boolean) instead.

Searches the TV data for programs which match a regular expression.

Specified by:
search in interface PluginManager
Parameters:
regex - The regular expression programs must match to.
inTitle - Should be searched in the title?
inText - Should be searched in the desription?
caseSensitive - Should the search be case sensitive?
channels - The channels to search in.
startDate - The date to start the search.
nrDays - The number of days to include after the start date. If negative the days before the start date are used.
Returns:
The matching programs.
Throws:
TvBrowserException - If there is a syntax error in the regular expression.

search

public Program[] search(String regex,
                        boolean caseSensitive,
                        ProgramFieldType[] fieldArr,
                        Date startDate,
                        int nrDays,
                        Channel[] channels,
                        boolean sortByStartTime)
                 throws TvBrowserException
Deprecated. Since 1.1. Use createProgramSearcher(int, String, boolean) instead.

Searches the TV data base for programs that match a regular expression.

Specified by:
search in interface PluginManager
Parameters:
regex - The regular expression programs must match to.
caseSensitive - Should the search be case sensitive?
fieldArr - The fields to search in
startDate - The date to start the search.
nrDays - The number of days to include after the start date. If negative the days before the start date are used.
channels - The channels to search in.
sortByStartTime - Should the results be sorted by the start time? If not, the results will be grouped by date and channel and the search will be faster.
Returns:
The matching programs.
Throws:
TvBrowserException - If there is a syntax error in the regular expression.

createProgramSearcher

public ProgramSearcher createProgramSearcher(int type,
                                             String searchTerm,
                                             boolean caseSensitive)
                                      throws TvBrowserException
Creates a ProgramSearcher.

Specified by:
createProgramSearcher in interface PluginManager
Parameters:
type - The searcher type to create. Must be one of PluginManager.SEARCHER_TYPE_EXACTLY, PluginManager.SEARCHER_TYPE_KEYWORD, PluginManager.SEARCHER_TYPE_REGULAR_EXPRESSION or PluginManager.SEARCHER_TYPE_BOOLEAN.
searchTerm - The search term the searcher should look for.
caseSensitive - Specifies whether the searcher should be case sensitive.
Returns:
A program searcher.
Throws:
TvBrowserException - If creating the program searcher failed.

getActivatedPlugins

public PluginAccess[] getActivatedPlugins()
Returns all activated Plugins.

Specified by:
getActivatedPlugins in interface PluginManager
Returns:
all activated Plugins.
Since:
1.1

getJavaPluginId

public String getJavaPluginId(Plugin javaPlugin)
Gets the ID of the given Java plugin.

Specified by:
getJavaPluginId in interface PluginManager
Parameters:
javaPlugin - The Java plugin to get the ID for.
Returns:
The ID of the given Java plugin.

getActivatedPluginForId

public PluginAccess getActivatedPluginForId(String pluginId)
Gets the activated plugin with the given ID.

Specified by:
getActivatedPluginForId in interface PluginManager
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.

getInstalledPlugins

public Plugin[] getInstalledPlugins()
Deprecated. Since 1.1. Use getActivatedPlugins() instead.

Returns a list of all installed Plugins.

This method always returns an empty array! Use getActivatedPlugins() instead!

Specified by:
getInstalledPlugins in interface PluginManager
Returns:
An empty array!

getDataService

public TvDataService getDataService(String dataServiceClassName)
Deprecated. 

Gets a TvDataService for a class name.

Specified by:
getDataService in interface PluginManager
Parameters:
dataServiceClassName - the class name of the wanted TvDataService.
Returns:
The TvDataService or null if there is no such TvDataService.

getDataServiceProxy

public TvDataServiceProxy getDataServiceProxy(String id)
Specified by:
getDataServiceProxy in interface PluginManager

createPluginContextMenu

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

Specified by:
createPluginContextMenu in interface PluginManager
Parameters:
program - The program to create the context menu for
caller - The calling plugin.
Returns:
a context menu for the given program.

getAvailableFilters

public ProgramFilter[] getAvailableFilters()
Returns an array of all available filters.

Specified by:
getAvailableFilters in interface PluginManager
Returns:
An array of all available filters.
Since:
0.9.7.4 * @deprecated Since 2.5 Use FilterManager.getAvailableFilters() instead.

getExampleProgram

public Program getExampleProgram()
Returns an example program. You can use it for preview stuff.

Specified by:
getExampleProgram in interface PluginManager
Returns:
an example program.
Since:
0.9.7.4

handleProgramSingleClick

public void handleProgramSingleClick(Program program)
Description copied from interface: PluginManager
Handles a single left click on a program.

Executes the single left click context menu function. Plugins should use handleProgramDoubleClick(Program program, Plugin caller). It prevents the Plugin to be activated a second time.

Specified by:
handleProgramSingleClick in interface PluginManager
Parameters:
program - The program to pass to the single left click context menu function.

handleProgramSingleClick

public void handleProgramSingleClick(Program program,
                                     ContextMenuIf caller)
Description copied from interface: PluginManager
Handles a single left click on a program.

Executes the default context menu plugin.

Specified by:
handleProgramSingleClick in interface PluginManager
Parameters:
program - The program to pass to the default context menu function.
caller - The ContextMenuIf that calls this. Prevents the ContextMenuIf to be activated twice

handleProgramDoubleClick

public void handleProgramDoubleClick(Program program)
Handles a double click on a program.

Executes the default context menu plugin. Plugins should use handleProgramDoubleClick(Program program, Plugin caller). It prevetns the Plugin to be activated a second time.

Specified by:
handleProgramDoubleClick in interface PluginManager
Parameters:
program - The program to pass to the default context menu plugin.
Since:
1.1

handleProgramDoubleClick

public void handleProgramDoubleClick(Program program,
                                     ContextMenuIf caller)
Handles a double click on a program.

Executes the default context menu plugin.

Specified by:
handleProgramDoubleClick in interface PluginManager
Parameters:
program - The program to pass to the default context menu plugin.
caller - ContextMenuIf that calls this. Prevents the ContextMenuIf to be activated twice
Since:
1.1

handleProgramMiddleClick

public void handleProgramMiddleClick(Program program)
Handles a middle click on a program.

Executes the middle click context menu plugin. Plugins should use handleProgramMiddleClick(Program program, Plugin caller). It prevents the Plugin to be activated a second time.

Specified by:
handleProgramMiddleClick in interface PluginManager
Parameters:
program - The program to pass to the middle click context menu plugin.
Since:
1.1

handleProgramMiddleClick

public void handleProgramMiddleClick(Program program,
                                     ContextMenuIf caller)
Handles a middle click on a program.

Executes the middle click context menu plugin.

Specified by:
handleProgramMiddleClick in interface PluginManager
Parameters:
program - The program to pass to the middle click context menu plugin.
caller - ContextMenuIf that calls this. Prevents the ContextMenuIf to be activated twice.
Since:
1.1

getDefaultContextMenuPlugin

public PluginAccess getDefaultContextMenuPlugin()
Gets the plugin that is used as default in the context menu.

Returns:
the default context menu plugin.
Since:
1.1

getTvBrowserSettings

public TvBrowserSettings getTvBrowserSettings()
Returns some settings a plugin may need.

Specified by:
getTvBrowserSettings in interface PluginManager
Returns:
Some settings a plugin may need.

getIconFromTheme

public ImageIcon getIconFromTheme(Plugin plugin,
                                  String category,
                                  String iconName,
                                  int size)
Returns an icon from the icon-theme-system If your plugin has icons that are not available as icons within an theme, you can add your icons into your jar-file. The directory structure must be like this: [PackageOfYourPlugin]/icons/[size]x[size]/[category]/[icon].png Please try to use the icon naming conventions of the FreeDesktop project: http://cvs.freedesktop.org/[*]checkout[*]/icon-theme/default-icon-theme/spec/icon-naming-spec.xml (please remove the [ ])

Specified by:
getIconFromTheme in interface PluginManager
Parameters:
plugin - Plugin that wants to load an icon
category - Category of the icon (action, etc...)
iconName - icon name without file extension
size - Size of the icon
Returns:
Icon if found, null if not

getIconFromTheme

public ImageIcon getIconFromTheme(Plugin plugin,
                                  ThemeIcon icon)
Returns an Icon from the Icon-Theme-System If your Plugin has Icons that are not available as Icons within an Theme, you can add your Icons into your Jar-File. The Directory-Structure must be like this: [PackageOfYourPlugin]/icons/[Size]x[Size]/[category]/[icon].png Please try to use the FreeDesktop-Icon Naming Conventions http://cvs.freedesktop.org/[*]checkout[*]/icon-theme/default-icon-theme/spec/icon-naming-spec.xml (please remove the [ ])

Specified by:
getIconFromTheme in interface PluginManager
Parameters:
plugin - Plugin that wants to load an Icon
icon - ThemeIcon that represents the Icon
Returns:
Icon if found, null if not

showSettings

public void showSettings(Plugin plugin)
Show the Settings-Dialog for a Plugin

Specified by:
showSettings in interface PluginManager
Parameters:
plugin - Use this Plugin
Since:
2.2

showSettings

public void showSettings(String settingsItem)
Show the Settings-Dialog with a Specific SettingsItem

Specified by:
showSettings in interface PluginManager
Parameters:
settingsItem - SettingsItem to show (e.g. SettingsItem.CHANNELS)
Since:
2.2

getMarkedPrograms

public Program[] getMarkedPrograms()
Return all marked programs.

Specified by:
getMarkedPrograms in interface PluginManager
Returns:
The marked programs
Since:
2.2

getReceiveIfs

public ProgramReceiveIf[] getReceiveIfs()
Return all Plugins/Functions that are able to receive programs.

Specified by:
getReceiveIfs in interface PluginManager
Returns:
The ProgramReceiveIfs.
Since:
2.5

getReceiveIfs

public ProgramReceiveIf[] getReceiveIfs(ProgramReceiveIf caller,
                                        ProgramReceiveTarget callerTarget)
Return all Plugins/Functions that are able to receive programs.

Specified by:
getReceiveIfs in interface PluginManager
Parameters:
caller - The caller ProgramReceiveIf.
callerTarget - The target that calls the receive if array.
Returns:
The ProgramReceiveIfs.
Since:
2.5

getReceiceIfForId

public ProgramReceiveIf getReceiceIfForId(String id)
Return the ReceiveIfFor given id or null if there is no ReceiveIf for the given id.

Specified by:
getReceiceIfForId in interface PluginManager
Parameters:
id - The id of the ReceiveIf.
Returns:
The ReceiveIf with the given id or null
Since:
2.5

scrollToProgram

public void scrollToProgram(Program program)
Let TV-Browser scroll to the given program.

Specified by:
scrollToProgram in interface PluginManager
Parameters:
program - The program to scroll to.
Since:
2.5

scrollToTime

public void scrollToTime(int time)
Let TV-Browser scroll to the given time.

Specified by:
scrollToTime in interface PluginManager
Parameters:
time - The time to scroll to in minutes after midnight.
Since:
2.5

scrollToChannel

public void scrollToChannel(Channel channel)
Let TV-Browser scroll to the given channel.

Specified by:
scrollToChannel in interface PluginManager
Parameters:
channel - The channel to scroll to.
Since:
2.5

goToDate

public void goToDate(Date date)
Let TV-Browser change the date to the given date.

Specified by:
goToDate in interface PluginManager
Parameters:
date - The date to show the program for.
Since:
2.5

getFilterManager

public FilterManager getFilterManager()
Returns the filter manager of TV-Browser. With the filter manager you get access to the filter system of TV-Browser. You can add or remove filters of your plugin and switch the currently used filter.

Specified by:
getFilterManager in interface PluginManager
Returns:
The filter manager of TV-Browser or null if TV-Browser isn't fully loaded.
Since:
2.5

handleTvBrowserStartFinished

protected void handleTvBrowserStartFinished()

getAvailableGlobalPuginProgramFormatings

public AbstractPluginProgramFormating[] getAvailableGlobalPuginProgramFormatings()
Gets the available global program configurations.

Specified by:
getAvailableGlobalPuginProgramFormatings in interface PluginManager
Returns:
The available global program configurations.
Since:
2.5.1

getCurrentDate

public Date getCurrentDate()
Description copied from interface: PluginManager
Get the date currently shown in the program table.

Specified by:
getCurrentDate in interface PluginManager
Returns:
date currently shown in program table

getAllProgramRatingIfs

public ProgramRatingIf[] getAllProgramRatingIfs()
Gets all ProgramRatingIfs of all plugins. You can get all available ratings for ~ one program.

Specified by:
getAllProgramRatingIfs in interface PluginManager
Returns:
all ProgramRatingIfs of all plugins
Since:
2.7

TV-Browser 2.7.5 API

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