TV-Browser 3.3.3 API

tvbrowser.core.plugin
Class JavaPluginProxy

java.lang.Object
  extended by tvbrowser.core.plugin.AbstractPluginProxy
      extended by tvbrowser.core.plugin.JavaPluginProxy
All Implemented Interfaces:
ContextMenuIf, InfoIf, Marker, PluginAccess, ProgramReceiveIf, java.lang.Comparable<ProgramReceiveIf>, ButtonActionIf, PluginProxy

public class JavaPluginProxy
extends AbstractPluginProxy

A plugin proxy for Java plugins.

Author:
Til Schneider, www.murfman.de

Nested Class Summary
 
Nested classes/interfaces inherited from interface tvbrowser.core.plugin.PluginProxy
PluginProxy.Comparator
 
Field Summary
 
Fields inherited from class tvbrowser.core.plugin.AbstractPluginProxy
DEFAULT_PLUGIN_ICON_NAME, mLocalizer
 
Fields inherited from interface devplugin.ContextMenuIf
ACTIONKEY_KEYBOARD_EVENT
 
Constructor Summary
JavaPluginProxy(PluginInfo info, java.lang.String pluginFileName, java.lang.String pluginId, javax.swing.Icon pluginIcon, java.lang.String category)
           
JavaPluginProxy(PluginInfo info, java.lang.String pluginFileName, java.lang.String pluginId, java.lang.String iconFileName, java.lang.String category)
           
JavaPluginProxy(Plugin plugin, java.lang.String pluginFileName)
           
 
Method Summary
protected  boolean doCanReceiveProgramsWithTarget()
          Really gets whether the plugin supports receiving programs from other plugins with target.
 boolean doCanUseProgramTree()
           
protected  PluginsProgramFilter[] doGetAvailableFilter()
          Really returns the available program filters that the plugin supports.
protected  java.lang.Class<? extends PluginsFilterComponent>[] doGetAvailableFilterComponentClasses()
          Really gets the available filter component classes.
protected  ActionMenu doGetButtonAction()
          Really gets the action to use for the main menu and the toolbar.
protected  ActionMenu doGetContextMenuActions(Channel channel)
          Gets the actions for the context menu of a channel.
protected  ActionMenu doGetContextMenuActions(Program program)
          Gets the actions for the context menu of a program.
protected  ImportanceValue doGetImportanceValueForProgram(Program p)
          Gets the importance value of a program.The importance of all active plugins is used to determinate the opacity of the used colors of a program, therefor a mean value of all values is used.
protected  PluginInfo doGetInfo()
          Really gets the meta information about the plugin.
protected  javax.swing.Icon[] doGetMarkIcons(Program p)
          Really gets the icons to use for marking programs in the program table.
protected  int doGetMarkPriorityForProgram(Program p)
          Really gets the mark priority for the given Program.
protected  ProgramReceiveTarget[] doGetProgramReceiveTargets()
          Really return an array of receive target or null if there is no target
protected  javax.swing.Icon[] doGetProgramTableIcons(Program program)
          Really gets the icons this Plugin provides for the given program.
protected  java.lang.String doGetProgramTableIconText()
          Gets the description text for the program table icons provided by this Plugin.
protected  SettingsTabProxy doGetSettingsTab()
          Really gets the SettingsTab object, which is added to the settings-window.
protected  void doHandleTvBrowserStartFinished()
          This method is automatically called, when the TV-Browser start is complete.
protected  void doHandleTvDataAdded(ChannelDayProgram newProg)
          This method is automatically called, when TV data was added.
protected  void doHandleTvDataAdded(MutableChannelDayProgram newProg)
          This method is automatically called, when TV data was added.
protected  void doHandleTvDataDeleted(ChannelDayProgram oldProg)
          This method is automatically called, when TV data was deleted.
protected  void doHandleTvDataTouched(ChannelDayProgram removedDayProgram, ChannelDayProgram addedDayProgram)
          This method is automatically called, when TV data was touched.
protected  void doHandleTvDataUpdateFinished()
          This method is automatically called, when the TV data update is finished.
protected  boolean doIsAllowedToDeleteProgramFilter(PluginsProgramFilter programFilter)
          Really return if a program filter can be deleted.
protected  void doLoadSettings(java.io.File userDirectory)
          Really loads the settings for this plugin.
 void doOnActivation()
           
 void doOnDeactivation()
           
protected  boolean doReceivePrograms(Program[] programArr, ProgramReceiveTarget receiveTarget)
          Really receives a list of programs from another plugin with target.
protected  boolean doReceiveValues(java.lang.String[] values, ProgramReceiveTarget receiveTarget)
          Really receives a list of Strings from another plugin with a target.
protected  void doSaveSettings(java.io.File userDirectory, boolean log)
          Really saves the settings for this plugin.
 AfterDataUpdateInfoPanel getAfterDataUpdateInfoPanel()
          Gets a panel that contains infos that should be shown for this Plugins after a data update.
 java.lang.String getButtonActionDescription()
          Gets the description for this ButtonActionIf.
 java.lang.String getId()
          Gets the ID of this plugin.
static java.lang.String getJavaPluginId(Plugin javaPlugin)
          Gets the ID of the given Java plugin.
 java.lang.String getPluginCategory()
           
 PluginCenterPanelWrapper getPluginCenterPanelWrapper()
          Gets the PluginCenterPanelWrapper for this plugin.
 java.lang.String getPluginFileName()
          return the file name of the plugin contained in this proxy
 javax.swing.Icon getPluginIcon()
          get the icon to represent this plugin in the settings
 ProgramRatingIf[] getProgramRatingIfs()
          If this plugin can rate programs, this interface makes it possible to offer this ratings to other plugins.
 PluginTreeNode getRootNode()
           
 void handleTvBrowserSettingsChanged()
          Is called when settings of TV-Browser or Plugins were changed, so this Plugin can react on that change.
 void handleTvDataUpdateStarted(Date until)
          Is called when a TV data update is started.
(package private)  void setParentFrame(java.awt.Frame parent)
          Sets the parent frame to the plugin.
 void setPlugin(Plugin plugin, java.lang.String fileName)
          connect a lazy loaded plugin to its proxy
 
Methods inherited from class tvbrowser.core.plugin.AbstractPluginProxy
addToArtificialPluginTree, assertActivatedState, canReceiveProgramsWithTarget, canUseProgramTree, compareTo, getArtificialRootNode, getAvailableFilter, getAvailableFilterComponentClasses, getButtonAction, getContextMenuActions, getContextMenuActions, getImportanceValueForProgram, getInfo, getMarkIcon, getMarkIcons, getMarkPriorityForProgram, getProgramReceiveTargets, getProgramTableIcons, getProgramTableIconText, getSettingsTab, handlePluginException, handleTvBrowserStartFinished, handleTvDataAdded, handleTvDataAdded, handleTvDataDeleted, handleTvDataTouched, handleTvDataUpdateFinished, hasArtificialPluginTree, isActivated, isAllowedToDeleteProgramFilter, loadSettings, onActivation, onDeactivation, receivePrograms, receiveValues, removeArtificialPluginTree, saveSettings, setActivated, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JavaPluginProxy

public JavaPluginProxy(Plugin plugin,
                       java.lang.String pluginFileName)

JavaPluginProxy

public JavaPluginProxy(PluginInfo info,
                       java.lang.String pluginFileName,
                       java.lang.String pluginId,
                       javax.swing.Icon pluginIcon,
                       java.lang.String category)

JavaPluginProxy

public JavaPluginProxy(PluginInfo info,
                       java.lang.String pluginFileName,
                       java.lang.String pluginId,
                       java.lang.String iconFileName,
                       java.lang.String category)
Method Detail

getJavaPluginId

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

Parameters:
javaPlugin - The Java plugin to get the ID for.
Returns:
The ID of the given Java plugin.

getId

public java.lang.String getId()
Gets the ID of this plugin.

Returns:
The ID of this plugin.

setParentFrame

void setParentFrame(java.awt.Frame parent)
Sets the parent frame to the plugin.

Specified by:
setParentFrame in class AbstractPluginProxy
Parameters:
parent - The parent frame to set.

doLoadSettings

protected void doLoadSettings(java.io.File userDirectory)
                       throws TvBrowserException
Really loads the settings for this plugin.

Specified by:
doLoadSettings in class AbstractPluginProxy
Parameters:
userDirectory - The directory where the user data is stored.
Throws:
TvBrowserException - If loading failed.

doSaveSettings

protected void doSaveSettings(java.io.File userDirectory,
                              boolean log)
                       throws TvBrowserException
Really saves the settings for this plugin.

Specified by:
doSaveSettings in class AbstractPluginProxy
Parameters:
userDirectory - The directory where the user data is stored.
Throws:
TvBrowserException - If saving failed.

doGetInfo

protected PluginInfo doGetInfo()
Really gets the meta information about the plugin.

Specified by:
doGetInfo in class AbstractPluginProxy
Returns:
The meta information about the plugin.

doGetSettingsTab

protected SettingsTabProxy doGetSettingsTab()
Really gets the SettingsTab object, which is added to the settings-window.

Specified by:
doGetSettingsTab in class AbstractPluginProxy
Returns:
the SettingsTab object or null if the plugin does not provide this feature.

doGetContextMenuActions

protected ActionMenu doGetContextMenuActions(Program program)
Gets the actions for the context menu of a program.

Specified by:
doGetContextMenuActions in class AbstractPluginProxy
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:
AbstractPluginProxy.getContextMenuActions(Program)

doGetContextMenuActions

protected ActionMenu doGetContextMenuActions(Channel channel)
Gets the actions for the context menu of a channel.

Specified by:
doGetContextMenuActions in class AbstractPluginProxy
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:
AbstractPluginProxy.getContextMenuActions(Program)

doGetButtonAction

protected ActionMenu doGetButtonAction()
Really gets the action to use for the main menu and the toolbar.

Specified by:
doGetButtonAction in class AbstractPluginProxy
Returns:
the action to use for the menu and the toolbar or null if the plugin does not provide this feature.
See Also:
AbstractPluginProxy.getButtonAction()

doGetMarkIcons

protected javax.swing.Icon[] doGetMarkIcons(Program p)
Really gets the icons to use for marking programs in the program table.

Specified by:
doGetMarkIcons in class AbstractPluginProxy
Returns:
the icons to use for marking programs in the program table.

doGetProgramTableIconText

protected 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.

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

doGetProgramTableIcons

protected 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.

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

doHandleTvDataUpdateFinished

protected void doHandleTvDataUpdateFinished()
This method is automatically called, when the TV data update is finished.

Specified by:
doHandleTvDataUpdateFinished in class AbstractPluginProxy
See Also:
AbstractPluginProxy.handleTvDataAdded(ChannelDayProgram), AbstractPluginProxy.handleTvDataDeleted(ChannelDayProgram)

doHandleTvDataAdded

protected void doHandleTvDataAdded(ChannelDayProgram newProg)
This method is automatically called, when TV data was added. (E.g. after an update).

The TV data may be modified by the plugin! So this method must be called before new TV data is saved.

Specified by:
doHandleTvDataAdded in class AbstractPluginProxy
Parameters:
newProg - The new ChannelDayProgram.
See Also:
AbstractPluginProxy.handleTvDataDeleted(ChannelDayProgram), AbstractPluginProxy.handleTvDataUpdateFinished()

doHandleTvDataDeleted

protected void doHandleTvDataDeleted(ChannelDayProgram oldProg)
This method is automatically called, when TV data was deleted. (E.g. after an update).

Specified by:
doHandleTvDataDeleted in class AbstractPluginProxy
Parameters:
oldProg - The old ChannelDayProgram which was deleted.
See Also:
AbstractPluginProxy.handleTvDataAdded(ChannelDayProgram), AbstractPluginProxy.handleTvDataUpdateFinished()

doHandleTvBrowserStartFinished

protected void doHandleTvBrowserStartFinished()
This method is automatically called, when the TV-Browser start is complete.

Specified by:
doHandleTvBrowserStartFinished in class AbstractPluginProxy

doOnActivation

public void doOnActivation()
Specified by:
doOnActivation in class AbstractPluginProxy

doOnDeactivation

public void doOnDeactivation()
Specified by:
doOnDeactivation in class AbstractPluginProxy

doCanUseProgramTree

public boolean doCanUseProgramTree()
Specified by:
doCanUseProgramTree in class AbstractPluginProxy

getRootNode

public PluginTreeNode getRootNode()

doCanReceiveProgramsWithTarget

protected boolean doCanReceiveProgramsWithTarget()
Really gets whether the plugin supports receiving programs from other plugins with target.

Specified by:
doCanReceiveProgramsWithTarget in class AbstractPluginProxy
Returns:
Whether the plugin supports receiving programs from other plugins with target.
Since:
2.5
See Also:
AbstractPluginProxy.receivePrograms(Program[],ProgramReceiveTarget)

doReceivePrograms

protected boolean doReceivePrograms(Program[] programArr,
                                    ProgramReceiveTarget receiveTarget)
Really receives a list of programs from another plugin with target.

Specified by:
doReceivePrograms in class AbstractPluginProxy
Parameters:
programArr - The programs passed from the other plugin with target.
receiveTarget - The target of the programs.
Since:
2.5
See Also:
AbstractPluginProxy.canReceiveProgramsWithTarget()

doGetProgramReceiveTargets

protected ProgramReceiveTarget[] doGetProgramReceiveTargets()
Really return an array of receive target or null if there is no target

Specified by:
doGetProgramReceiveTargets in class AbstractPluginProxy
Returns:
The supported receive targets.
Since:
2.5
See Also:
AbstractPluginProxy.canReceiveProgramsWithTarget(), AbstractPluginProxy.receivePrograms(Program[],ProgramReceiveTarget)

doGetAvailableFilter

protected PluginsProgramFilter[] doGetAvailableFilter()
Really returns the available program filters that the plugin supports.

Specified by:
doGetAvailableFilter in class AbstractPluginProxy
Returns:
The available program filters that the plugin supports or null if it supports no filter.
Since:
2.5

doIsAllowedToDeleteProgramFilter

protected boolean doIsAllowedToDeleteProgramFilter(PluginsProgramFilter programFilter)
Really return if a program filter can be deleted.

Specified by:
doIsAllowedToDeleteProgramFilter in class AbstractPluginProxy
Parameters:
programFilter - The program filter to delete.
Returns:
True if the program filter component can be deleted.
Since:
2.5

doGetAvailableFilterComponentClasses

protected java.lang.Class<? extends PluginsFilterComponent>[] doGetAvailableFilterComponentClasses()
Really gets the available filter component classes.

Specified by:
doGetAvailableFilterComponentClasses in class AbstractPluginProxy
Returns:
The available plugins filter components classes or null if no plugins filter components are supported.
Since:
2.5

doGetMarkPriorityForProgram

protected int doGetMarkPriorityForProgram(Program p)
Really gets the mark priority for the given Program.

Specified by:
doGetMarkPriorityForProgram in class AbstractPluginProxy
Parameters:
p - The program to get the mark priority for.
Returns:
The mark priority for the given program.

getPluginFileName

public java.lang.String getPluginFileName()
Description copied from interface: PluginProxy
return the file name of the plugin contained in this proxy

Returns:
file name

setPlugin

public void setPlugin(Plugin plugin,
                      java.lang.String fileName)
connect a lazy loaded plugin to its proxy

Parameters:
plugin -

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
Overrides:
getPluginIcon in class AbstractPluginProxy
Returns:
icon

getProgramRatingIfs

public ProgramRatingIf[] getProgramRatingIfs()
Description copied from interface: PluginProxy
If this plugin can rate programs, this interface makes it possible to offer this ratings to other plugins. You can get all ProgramRatingIfs of all plugins using PluginManager.getAllProgramRatingIfs() The plugin can return more than one ratingif, e.g. average ratings, user rating ...

Returns:
the RatingIfs of this plugin

getButtonActionDescription

public java.lang.String getButtonActionDescription()
Description copied from interface: ButtonActionIf
Gets the description for this ButtonActionIf.

Returns:
The description for this ButtonActionIf.

doHandleTvDataAdded

protected void doHandleTvDataAdded(MutableChannelDayProgram newProg)
Description copied from class: AbstractPluginProxy
This method is automatically called, when TV data was added. (E.g. after an update).

The TV data can be modified by the plugin!

Override this method if you want to change/add data. Don't do other things than changing/adding data, use AbstractPluginProxy.handleTvDataAdded(ChannelDayProgram) instead.

Specified by:
doHandleTvDataAdded in class AbstractPluginProxy
Parameters:
newProg - The new ChannelDayProgram.
See Also:
AbstractPluginProxy.handleTvDataDeleted(ChannelDayProgram), AbstractPluginProxy.handleTvDataTouched(ChannelDayProgram, ChannelDayProgram)

doReceiveValues

protected boolean doReceiveValues(java.lang.String[] values,
                                  ProgramReceiveTarget receiveTarget)
Description copied from class: AbstractPluginProxy
Really receives a list of Strings from another plugin with a target.

Specified by:
doReceiveValues in class AbstractPluginProxy
Parameters:
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.
See Also:
AbstractPluginProxy.canReceiveProgramsWithTarget()

doHandleTvDataTouched

protected void doHandleTvDataTouched(ChannelDayProgram removedDayProgram,
                                     ChannelDayProgram addedDayProgram)
Description copied from class: AbstractPluginProxy
This method is automatically called, when TV data was touched. (E.g. after an update of already existing TV data).

The TV data may be modified by the plugin! So this method must be called before new TV data is saved.

Specified by:
doHandleTvDataTouched in class AbstractPluginProxy
Parameters:
removedDayProgram - The previous ChannelDayProgram.
addedDayProgram - The new ChannelDayProgram.
See Also:
AbstractPluginProxy.handleTvDataAdded(ChannelDayProgram), AbstractPluginProxy.handleTvDataDeleted(ChannelDayProgram), AbstractPluginProxy.handleTvDataUpdateFinished()

doGetImportanceValueForProgram

protected ImportanceValue doGetImportanceValueForProgram(Program p)
Description copied from class: AbstractPluginProxy
Gets the importance value of a program.The importance of all active plugins is used to determinate the opacity of the used colors of a program, therefor a mean value of all values is used.

The importance value can be created as a weighted total of the following values.

Specified by:
doGetImportanceValueForProgram in class AbstractPluginProxy
Parameters:
p - The program to get the importance value for.
Returns:
The importance value for the given program.

getPluginCategory

public java.lang.String getPluginCategory()

getPluginCenterPanelWrapper

public PluginCenterPanelWrapper getPluginCenterPanelWrapper()
Description copied from interface: PluginProxy
Gets the PluginCenterPanelWrapper for this plugin.

Returns:
The PluginCenterPanelWrapper for this plugin or null.

getAfterDataUpdateInfoPanel

public AfterDataUpdateInfoPanel getAfterDataUpdateInfoPanel()
Description copied from interface: PluginProxy
Gets a panel that contains infos that should be shown for this Plugins after a data update.

Returns:
The panel with the infos.

handleTvBrowserSettingsChanged

public void handleTvBrowserSettingsChanged()
Description copied from interface: PluginProxy
Is called when settings of TV-Browser or Plugins were changed, so this Plugin can react on that change.


handleTvDataUpdateStarted

public void handleTvDataUpdateStarted(Date until)
Description copied from interface: PluginProxy
Is called when a TV data update is started.

Parameters:
until - The last date the data is updated for.

TV-Browser 3.3.3 API

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