TV-Browser 2.7.5 API

tvraterplugin
Class TVRaterPlugin

java.lang.Object
  extended by devplugin.Plugin
      extended by tvraterplugin.TVRaterPlugin
All Implemented Interfaces:
ContextMenuIf, Marker, ProgramReceiveIf

public class TVRaterPlugin
extends Plugin

This Plugin gives the User the possibility to rate a Movie TODO: Get Personal Ratings from Server TODO: Send Original-Titles to Server

Author:
Bodo Tasche

Field Summary
protected static int MINLENGTH
           
 
Fields inherited from class devplugin.Plugin
BIG_ICON, DISABLED_ON_TASK_MENU, parent, SINGLE_CLICK_WAITING_TIME
 
Constructor Summary
TVRaterPlugin()
           
 
Method Summary
 boolean canUseProgramTree()
          Signal whether this plugin participates in the plugin tree view or not.
 PluginsProgramFilter[] getAvailableFilter()
          Returns the available program filters that the plugin supports.
 Class<? extends PluginsFilterComponent>[] getAvailableFilterComponentClasses()
          Returns the available plugins filter component classes.
 ActionMenu getButtonAction()
          Gets the action to use for the main menu and the toolbar.
 ActionMenu getContextMenuActions(Program program)
          Gets the actions for the context menu of a program.
 Database getDatabase()
          Returns the Database for the Ratings
 PluginInfo getInfo()
          Gets the meta information about the plugin.
static TVRaterPlugin getInstance()
          Returns an Instance of this Plugin
 String getMarkIconName()
          Gets the name of the file, containing your mark icon (in the jar-File).
 Frame getParentFrameForTVRater()
          Gets the parent frame.
 Icon[] getProgramTableIcons(Program program)
          Gets the icons this Plugin provides for the given program.
 String getProgramTableIconText()
          Gets the description text for the program table icons provided by this Plugin.
 Rating getRating(Program program)
          Returns the Rating for a program.
 ProgramRatingIf[] getRatingInterfaces()
          If this plugin can rate programs, this interface makes it possible to offer this ratings to other plugins.
 PluginTreeNode getRootNode()
          Gets the root node of the plugin for the plugin tree.
 Properties getSettings()
          Returns the Settings for this Plugin
 SettingsTab getSettingsTab()
          Gets the SettingsTab object, which is added to the settings-window.
static Version getVersion()
           
 void handleTvBrowserStartFinished()
          This method is called when the TV-Browser start is finished.
 void handleTvDataUpdateFinished()
          This method is automatically called, when the TV data update is finished.
 boolean isProgramRateable(Program program)
          Returns true if Program is rateable (Length > MINLENGTH or last Program of Day)
 void loadSettings(Properties settings)
          Called by the host-application during start-up.
 void onActivation()
          This method is automatically called immediatly before the plugin gets activated.
 void readData(ObjectInputStream in)
          Called by the host-application during start-up.
 void showDialog()
          This method is invoked by the host-application if the user has choosen your plugin from the menu.
 void showRatingDialog(Program program)
           
 Properties storeSettings()
          Called by the host-application during shut-down.
 void updateCurrentDate()
          Force an update of the currently shown programs in the program table where we need to add/update a TV rating.
protected  void updateRootNode()
          collect all expired favorites without rating for the plugin tree
 void writeData(ObjectOutputStream out)
          Counterpart to loadData.
 
Methods inherited from class devplugin.Plugin
canReceivePrograms, canReceiveProgramsWithTarget, createImageIcon, createImageIcon, createImageIcon, createImageIconForFileName, execute, execute, execute, getButtonIconName, getButtonText, getContextMenuItemText, getId, getJarFile, getMarkIcon, getMarkIconFromTheme, getMarkIcons, getMarkIconsForProgram, getMarkPriorityForProgram, getParentFrame, getPluginManager, getProgramFromContextMenuActionEvent, getProgramReceiveTargets, handleTvDataAdded, handleTvDataAdded, handleTvDataChanged, handleTvDataChanged, handleTvDataDeleted, handleTvDataTouched, isAllowedToDeleteProgramFilter, layoutWindow, layoutWindow, onDeactivation, receivePrograms, receivePrograms, receiveValues, saveMe, setJarFile, setParent, setPluginManager, storeRootNode, supportMultipleProgramExecution, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MINLENGTH

protected static final int MINLENGTH
See Also:
Constant Field Values
Constructor Detail

TVRaterPlugin

public TVRaterPlugin()
Method Detail

getVersion

public static Version getVersion()

getInfo

public PluginInfo getInfo()
Description copied from class: Plugin
Gets the meta information about the plugin.

Override this method to provide information about your plugin.

Overrides:
getInfo in class Plugin
Returns:
The meta information about the plugin.

getButtonAction

public ActionMenu getButtonAction()
Description copied from class: Plugin
Gets the action to use for the main menu and the toolbar.

Override this method to provide a menu item in the main menu and a toolbar button.

The following action values will be used:

Overrides:
getButtonAction in class Plugin
Returns:
the action to use for the menu and the toolbar or null if the plugin does not provide this feature.

showDialog

public void showDialog()
This method is invoked by the host-application if the user has choosen your plugin from the menu.


getContextMenuActions

public ActionMenu getContextMenuActions(Program program)
Description copied from class: Plugin
Gets the actions for the context menu of a program.

Override this method to provide context menu items for programs (e.g. in the program table). If your plugin shows a context menu only for some programs, but not for all, then you should explicitly return a non-null menu for the example program. Otherwise your context menu will not be shown in the settings dialog for the context menu order.

The following action values will be used:

Specified by:
getContextMenuActions in interface ContextMenuIf
Overrides:
getContextMenuActions in class Plugin
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:
Plugin.getProgramFromContextMenuActionEvent(ActionEvent)

showRatingDialog

public void showRatingDialog(Program program)

storeSettings

public Properties storeSettings()
Description copied from class: Plugin
Called by the host-application during shut-down.

Override this method to store your plugins settings to the file system. ATTENTION: Don't use any logger, thread or access to Frames in this method.

Overrides:
storeSettings in class Plugin
Returns:
The settings for this plugin or null if this plugin does not need to save any settings.

loadSettings

public void loadSettings(Properties settings)
Description copied from class: Plugin
Called by the host-application during start-up.

Override this method to load your plugins settings from the file system.

Overrides:
loadSettings in class Plugin
Parameters:
settings - The settings for this plugin (May be empty).

getSettingsTab

public SettingsTab getSettingsTab()
Description copied from class: Plugin
Gets the SettingsTab object, which is added to the settings-window.

Override this method to provide a settings tab. The settings tab will be shown in the settings dialog in the plugin section.

Overrides:
getSettingsTab in class Plugin
Returns:
the SettingsTab object or null if the plugin does not provide this feature.

getMarkIconName

public String getMarkIconName()
Description copied from class: Plugin
Gets the name of the file, containing your mark icon (in the jar-File). Should be 16x16.

This icon is used for marking programs in the program table.

Override this method if your plugin is able to mark programs As an alternative you can use an Icon from the Icon-Theme using Plugin.getMarkIconFromTheme()

Overrides:
getMarkIconName in class Plugin
Returns:
the name of the file, containing your icon for the toolbar or null if the plugin does not provide this feature.
See Also:
Plugin.getMarkIcon(), Program.mark(Plugin), Program.unmark(Plugin)

getProgramTableIconText

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

Overrides:
getProgramTableIconText in class Plugin
Returns:
The description text for the program table icons.
See Also:
getProgramTableIcons(Program)

getProgramTableIcons

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

Overrides:
getProgramTableIcons in class Plugin
Parameters:
program - The programs to get the icons for.
Returns:
The icons for the given program or null.
See Also:
getProgramTableIconText()

getRating

public Rating getRating(Program program)
Returns the Rating for a program. This Function returns the personal rating if the settings say these ratings are preferred

Parameters:
program - Get rating for this program
Returns:
Rating

getDatabase

public Database getDatabase()
Returns the Database for the Ratings

Returns:
Rating-Database

getSettings

public Properties getSettings()
Returns the Settings for this Plugin

Returns:
Settings

readData

public void readData(ObjectInputStream in)
              throws IOException,
                     ClassNotFoundException
Called by the host-application during start-up.

Overrides:
readData in class Plugin
Parameters:
in - The stream to read the objects from.
Throws:
IOException - If reading failed.
ClassNotFoundException - If an object could not be casted correctly.
See Also:
writeData(ObjectOutputStream)

writeData

public void writeData(ObjectOutputStream out)
               throws IOException
Counterpart to loadData. Called when the application shuts down.

Overrides:
writeData in class Plugin
Parameters:
out - The stream to write the objects to
Throws:
IOException - If writing failed.
See Also:
readData(ObjectInputStream)

getParentFrameForTVRater

public Frame getParentFrameForTVRater()
Gets the parent frame.

The parent frame may be used for showing dialogs.

Returns:
The parent frame.

handleTvBrowserStartFinished

public void handleTvBrowserStartFinished()
Description copied from class: Plugin
This method is called when the TV-Browser start is finished.

Overrides:
handleTvBrowserStartFinished in class Plugin

handleTvDataUpdateFinished

public void handleTvDataUpdateFinished()
Description copied from class: Plugin
This method is automatically called, when the TV data update is finished.

Override this method to react on this event. If you want to read data from the internet use this method to track if a connection was established. ATTENTION: If you do so take care of the TV-Browser start, at the start this method mustn't use an internet connection. Use the method handleTvBrowserStartFinished() to track if the TV-Browser start was finished before allowing access to the internet in this method.

Overrides:
handleTvDataUpdateFinished in class Plugin
See Also:
Plugin.handleTvBrowserStartFinished(), Plugin.handleTvDataAdded(ChannelDayProgram), Plugin.handleTvDataDeleted(ChannelDayProgram), Plugin.handleTvDataChanged()

getInstance

public static TVRaterPlugin getInstance()
Returns an Instance of this Plugin

Returns:
Instance of this Plugin

isProgramRateable

public boolean isProgramRateable(Program program)
Returns true if Program is rateable (Length > MINLENGTH or last Program of Day)

Parameters:
program - Program to check
Returns:
true if program is rateable

getAvailableFilterComponentClasses

public Class<? extends PluginsFilterComponent>[] getAvailableFilterComponentClasses()
Description copied from class: Plugin
Returns the available plugins filter component classes.
ATTENTON: Use return (Class[]) new Class[] {MyFilterComponent1.class,MyFilterComponent2.class}; because the creation of a class array with generic type didn't work.

Overrides:
getAvailableFilterComponentClasses in class Plugin
Returns:
The available plugins filter components classes or null if no plugins filter components are supported.

getAvailableFilter

public PluginsProgramFilter[] getAvailableFilter()
Description copied from class: Plugin
Returns the available program filters that the plugin supports.

Overrides:
getAvailableFilter in class Plugin
Returns:
The available program filters that the plugin supports or null if it supports no filter.

updateCurrentDate

public void updateCurrentDate()
Force an update of the currently shown programs in the program table where we need to add/update a TV rating. Internally called after a successful update of the TV ratings database.

Since:
2.6

canUseProgramTree

public boolean canUseProgramTree()
Description copied from class: Plugin
Signal whether this plugin participates in the plugin tree view or not.

Overrides:
canUseProgramTree in class Plugin
Returns:
true, if the programs of this plugin are handled by the plugin tree view
See Also:
Plugin.getRootNode()

getRootNode

public PluginTreeNode getRootNode()
Description copied from class: Plugin
Gets the root node of the plugin for the plugin tree.

Overrides:
getRootNode in class Plugin
Returns:
The root node.
See Also:
Plugin.canUseProgramTree()

updateRootNode

protected void updateRootNode()
collect all expired favorites without rating for the plugin tree

Since:
2.6

onActivation

public void onActivation()
Description copied from class: Plugin
This method is automatically called immediatly before the plugin gets activated.

Overrides:
onActivation in class Plugin

getRatingInterfaces

public ProgramRatingIf[] getRatingInterfaces()
Description copied from class: Plugin
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 ...

Overrides:
getRatingInterfaces in class Plugin
Returns:
the RatingIfs of this plugin

TV-Browser 2.7.5 API

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