|
TV-Browser 3.3.3 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object devplugin.Plugin
public abstract class Plugin
Superclass for all Java-TV-Browser plugins.
To create a plugin do the following:
myplugin.MyPlugin
.MyPlugin.jar
.
plugin
directory of your TV-Browser
installation.
Field Summary | |
---|---|
static java.lang.String |
ACTION_ID_KEY
A key for sub action menu entries unique ID. |
static java.lang.String |
ADDITONAL_DATA_SERVICE_HARDWARE_CATEGORY
|
static java.lang.String |
ADDITONAL_DATA_SERVICE_SOFTWARE_CATEGORY
|
static java.lang.String |
ALL_CATEGORY
|
static java.lang.String |
BIG_ICON
The name to use for the big icon (the 22x22 one for the toolbar) of the button action. |
static java.lang.String |
DISABLED_ON_TASK_MENU
The name to use for disabling a menu part for showing in ProgramInfo. |
static Localizer |
mLocalizer
The localizer used by this class. |
static java.lang.String |
NO_ICON_RESIZE
Key for button action to disable icon resize. |
static java.lang.String |
OTHER_CATEGORY
|
static java.lang.String |
RATINGS_CATEGORY
|
static java.lang.String |
REMOTE_CONTROL_HARDWARE_CATEGORY
|
static java.lang.String |
REMOTE_CONTROL_SOFTWARE_CATEGORY
|
static int |
SINGLE_CLICK_WAITING_TIME
The waiting time for single click performing. |
Fields inherited from interface devplugin.ContextMenuIf |
---|
ACTIONKEY_KEYBOARD_EVENT |
Constructor Summary | |
---|---|
Plugin()
|
Method Summary | |
---|---|
boolean |
canReceiveProgramsWithTarget()
Gets whether the ProgramReceiveIf supports receiving programs from other plugins with a special target. |
boolean |
canUseProgramTree()
Signal whether this plugin participates in the plugin tree view or not. |
int |
compareTo(ProgramReceiveIf o)
|
protected javax.swing.ImageIcon |
createImageIcon(java.lang.String fileName)
Helper method that loads an ImageIcon from the plugin jar file and returns it. |
javax.swing.ImageIcon |
createImageIcon(java.lang.String category,
java.lang.String icon)
Helper method that Loads an ImageIcon from the IconTheme with default size |
javax.swing.ImageIcon |
createImageIcon(java.lang.String category,
java.lang.String icon,
int size)
Helper method that Loads an ImageIcon from the IconTheme |
javax.swing.ImageIcon |
createImageIcon(ThemeIcon icon)
Helper method that Loads an ImageIcon from the IconTheme |
protected javax.swing.ImageIcon |
createImageIconForFileName(java.lang.String fileName)
Helper method that loads an ImageIcon from the file system and returns it. |
AfterDataUpdateInfoPanel |
getAfterDataUpdateInfoPanel()
Gets a panel that contains infos that should be shown for this Plugins after a data update. |
PluginsProgramFilter[] |
getAvailableFilter()
Returns the available program filters that the plugin supports. |
java.lang.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(Channel channel)
Gets the actions for the context menu of a channel. |
ActionMenu |
getContextMenuActions(Program program)
Gets the actions for the context menu of a program. |
java.lang.String |
getId()
Gets the ID of this plugin. |
ImportanceValue |
getImportanceValueForProgram(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. |
PluginInfo |
getInfo()
Gets the meta information about the plugin. |
javax.swing.Icon |
getMarkIcon()
Gets the icon used for marking programs in the program table. |
ThemeIcon |
getMarkIconFromTheme()
This gets the ThemeIcon containing your mark icon. |
protected java.lang.String |
getMarkIconName()
Gets the name of the file, containing your mark icon (in the jar-File). |
javax.swing.Icon[] |
getMarkIcons(Program p)
Gets the icons used for marking programs in the program table. |
javax.swing.Icon[] |
getMarkIconsForProgram(Program p)
This gets the mark icons for a Program. |
int |
getMarkPriorityForProgram(Program p)
Gets the mark priority for the given program that this Plugin uses. |
protected java.awt.Frame |
getParentFrame()
Gets the parent frame. |
java.lang.String |
getPluginCategory()
Gets the category of this plugin. |
PluginCenterPanelWrapper |
getPluginCenterPanelWrapper()
Gets the PluginCenterPanelWrapper for this plugin. |
static PluginManager |
getPluginManager()
Use this method to call methods of the plugin manager. |
protected Program |
getProgramFromContextMenuActionEvent(java.awt.event.ActionEvent evt)
Gets the Program from the ActionEvent that was passed to a context menu action NOTE: At the moment the Program is passed as ActionEvent source. |
ProgramReceiveTarget[] |
getProgramReceiveTargets()
Returns an array of receive targets or null if there is no
target |
javax.swing.Icon[] |
getProgramTableIcons(Program program)
Gets the icons this Plugin provides for the given program. |
java.lang.String |
getProgramTableIconText()
Gets the description text for the program table icons provided by this Plugin. |
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. |
SettingsTab |
getSettingsTab()
Gets the SettingsTab object, which is added to the settings-window. |
static Version |
getVersion()
Gets the version of this plugin. |
void |
handleTvBrowserSettingsChanged()
Is called when settings of TV-Browser or Plugins were changed, so this Plugin can react on that change. |
void |
handleTvBrowserStartFinished()
This method is called when the TV-Browser start is finished. |
void |
handleTvDataAdded(ChannelDayProgram newProg)
This method is automatically called, when TV data was added. |
void |
handleTvDataAdded(MutableChannelDayProgram newProg)
This method is automatically called, when TV data was added. |
void |
handleTvDataDeleted(ChannelDayProgram oldProg)
This method is automatically called, when TV data was deleted. |
void |
handleTvDataTouched(ChannelDayProgram removedDayProgram,
ChannelDayProgram addedDayProgram)
This method is automatically called, when TV data was touched (that means something was done with it). |
void |
handleTvDataUpdateFinished()
This method is automatically called, when the TV data update is finished. |
void |
handleTvDataUpdateStarted()
Deprecated. since 3.3.3 Use handleTvDataUpdateStarted(Date) instead |
void |
handleTvDataUpdateStarted(Date until)
Is called when a TV data update is started. |
boolean |
isAllowedToDeleteProgramFilter(PluginsProgramFilter programFilter)
Is used to track if a program filter be deleted. |
void |
layoutWindow(java.lang.String windowId,
java.awt.Window window)
Sets the window position and size for the given window from remembered values for that id. |
void |
layoutWindow(java.lang.String windowId,
java.awt.Window window,
java.awt.Dimension defaultSize)
Sets the window position and size for the given window from remembered values for that id. |
protected void |
loadRootNode(PluginTreeNode node)
|
void |
loadSettings(java.util.Properties settings)
Called by the host-application during start-up. |
void |
onActivation()
This method is automatically called immediately before the plugin gets activated. |
void |
onDeactivation()
This method is automatically called immediately after deactivating the plugin. |
void |
readData(java.io.ObjectInputStream in)
Called by the host-application during start-up. |
boolean |
receivePrograms(Program[] programArr,
ProgramReceiveTarget receiveTarget)
Receives a list of programs from another plugin with a target. |
boolean |
receiveValues(java.lang.String[] values,
ProgramReceiveTarget receiveTarget)
Receives a list of Strings from another plugin with a target. |
protected boolean |
saveMe()
Says the plugin proxy manager to store the settings and data of this plugin. |
void |
setParent(java.awt.Frame parent)
Called by the host-application to provide the parent frame. |
static void |
setPluginManager(PluginManager manager)
Called by the host-application to provide access to the plugin manager. |
void |
storeRootNode()
Saves the entries under the root node in a file. |
protected void |
storeRootNode(PluginTreeNode node)
|
java.util.Properties |
storeSettings()
Called by the host-application during shut-down. |
java.lang.String |
toString()
|
void |
writeData(java.io.ObjectOutputStream out)
Counterpart to loadData. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ALL_CATEGORY
public static final java.lang.String REMOTE_CONTROL_SOFTWARE_CATEGORY
public static final java.lang.String REMOTE_CONTROL_HARDWARE_CATEGORY
public static final java.lang.String ADDITONAL_DATA_SERVICE_SOFTWARE_CATEGORY
public static final java.lang.String ADDITONAL_DATA_SERVICE_HARDWARE_CATEGORY
public static final java.lang.String RATINGS_CATEGORY
public static final java.lang.String OTHER_CATEGORY
public static final java.lang.String BIG_ICON
getButtonAction()
,
Constant Field Valuespublic static final java.lang.String NO_ICON_RESIZE
true
to disable button resize.
public static final java.lang.String ACTION_ID_KEY
public static final java.lang.String DISABLED_ON_TASK_MENU
public static final int SINGLE_CLICK_WAITING_TIME
public static final Localizer mLocalizer
Constructor Detail |
---|
public Plugin()
Method Detail |
---|
public static final void setPluginManager(PluginManager manager)
manager
- The plugin manager the plugins should use.public static final PluginManager getPluginManager()
The plugin manager is your connection to TV-Browser. Every communication between TV-Browser and the plugin is either initiated by TV-Browser or made by using the plugin manager.
public final java.lang.String getId()
getId
in interface ContextMenuIf
getId
in interface Marker
getId
in interface ProgramReceiveIf
public final void setParent(java.awt.Frame parent)
parent
- The parent frame.protected final java.awt.Frame getParentFrame()
The parent frame may be used for showing dialogs.
protected final javax.swing.ImageIcon createImageIcon(java.lang.String fileName)
fileName
- The name of the icon file.
protected final javax.swing.ImageIcon createImageIconForFileName(java.lang.String fileName)
fileName
- The name of the icon file.
public final javax.swing.ImageIcon createImageIcon(java.lang.String category, java.lang.String icon, int size)
category
- Category the Icon resists inicon
- Icon to load (without extension)size
- Size of the Icon
public final javax.swing.ImageIcon createImageIcon(java.lang.String category, java.lang.String icon)
category
- Category the Icon resists inicon
- Icon to load (without extension)
public final javax.swing.ImageIcon createImageIcon(ThemeIcon icon)
icon
- Icon to load
public void readData(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
Override this method to load any objects from the file system.
in
- The stream to read the objects from.
java.io.IOException
- If reading failed.
java.lang.ClassNotFoundException
- If an object could not be casted correctly.writeData(ObjectOutputStream)
public void writeData(java.io.ObjectOutputStream out) throws java.io.IOException
Override this method to store any objects to the file system. ATTENTION: Don't use any logger, thread or access to Frames in this method.
out
- The stream to write the objects to
java.io.IOException
- If writing failed.readData(ObjectInputStream)
public void loadSettings(java.util.Properties settings)
Override this method to load your plugins settings from the file system.
settings
- The settings for this plugin (May be empty).public java.util.Properties storeSettings()
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.
null
if this plugin
does not need to save any settings.public static Version getVersion()
Override this to provide a check of the plugin for the version to load from main plugins dir or the user plugins dir. The plugin with the highest version will be loaded.
public PluginInfo getInfo()
Override this method to provide information about your plugin.
public ActionMenu getContextMenuActions(Program 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:
Action.NAME
: The text for the context menu item.Action.SMALL_ICON
: The icon for the context menu item.
Should be 16x16.
getContextMenuActions
in interface ContextMenuIf
program
- The program the context menu will be shown for.
null
if the plugin does not provide this feature.getProgramFromContextMenuActionEvent(ActionEvent)
public ActionMenu getContextMenuActions(Channel channel)
Override this method to provide context menu items for channels.
The following action values will be used:
Action.NAME
: The text for the context menu item.Action.SMALL_ICON
: The icon for the context menu item.
Should be 16x16.
channel
- The channel the context menu will be shown for.
null
if the plugin does not provide this feature.getContextMenuActions(Program)
protected final Program getProgramFromContextMenuActionEvent(java.awt.event.ActionEvent evt)
NOTE: At the moment the Program is passed as ActionEvent source. Please use this method to get the program and not directly the ActionEvent source. Because in future versions of TV-Browser the Program may be passed in another way!!
evt
- The ActionEvent to get the Program from.
getContextMenuActions(Program)
public ActionMenu getButtonAction()
Override this method to provide a menu item in the main menu and a toolbar button.
The following action values will be used:
Action.NAME
: The text for the main menu item and the
toolbar button.Action.SHORT_DESCRIPTION
: The description for the button
action. Used as tooltip and for the status bar.Action.SMALL_ICON
: The icon for the main menu item. Should
be 16x16.BIG_ICON
: The icon for the toolbar button. Should be
24x24.
null
if the plugin does not provide this feature.public java.lang.String getProgramTableIconText()
Override this method if your plugin provides icons for the program table (shown below the start time). The returned String will be shown in settings dialog (german: Aussehen->Sendungsanzeige->Plugin-Icons).
null
if the plugin does not provide this feature.getProgramTableIcons(Program)
public javax.swing.Icon[] getProgramTableIcons(Program program)
Override this method to return the icons for the program table (shown below the start time).
This method is only called, if the option to show program table icons for this plugin is set in the options.
program
- The program to get the icons for.
null
if the plugin
does not provide this feature.getProgramTableIconText()
public SettingsTab getSettingsTab()
Override this method to provide a settings tab. The settings tab will be shown in the settings dialog in the plugin section.
null
if the plugin does not
provide this feature.public final javax.swing.Icon getMarkIcon()
getMarkIcon
in interface Marker
getMarkIconName()
public final javax.swing.Icon[] getMarkIcons(Program p)
getMarkIcons
in interface Marker
public javax.swing.Icon[] getMarkIconsForProgram(Program p)
p
- The Program to get the icons for.
public ThemeIcon getMarkIconFromTheme()
PluginManager.getIconFromTheme(Plugin, String, String, int)
protected java.lang.String getMarkIconName()
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 getMarkIconFromTheme()
null
if the plugin does not provide this feature.getMarkIcon()
,
Program.mark(Plugin)
,
Program.unmark(Plugin)
public void handleTvDataUpdateFinished()
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.
handleTvBrowserStartFinished()
,
handleTvDataAdded(ChannelDayProgram)
,
handleTvDataDeleted(ChannelDayProgram)
,
handleTvDataTouched(ChannelDayProgram, ChannelDayProgram)
public void handleTvDataAdded(MutableChannelDayProgram newProg)
The TV data can be modified by the plugin!
Override this method if you want to change/add data fields of the programs.
If you only want to access the programs without changing any fields, please use
handleTvDataAdded(ChannelDayProgram)
instead.
newProg
- The new ChannelDayProgram.handleTvDataDeleted(ChannelDayProgram)
,
handleTvDataTouched(ChannelDayProgram, ChannelDayProgram)
public void handleTvDataAdded(ChannelDayProgram newProg)
The TV data cannot be changed in here because the saving of the data was already done.
So use this method if you want to mark or do something else than changing
with the program. If you want to change/add data use
handleTvDataAdded(MutableChannelDayProgram)
instead.
newProg
- The new ChannelDayProgram.handleTvDataDeleted(ChannelDayProgram)
,
handleTvDataTouched(ChannelDayProgram, ChannelDayProgram)
public void handleTvDataDeleted(ChannelDayProgram oldProg)
Override this method to react on this event.
oldProg
- The old ChannelDayProgram which was deleted.handleTvDataAdded(ChannelDayProgram)
,
handleTvDataTouched(ChannelDayProgram, ChannelDayProgram)
public void handleTvDataTouched(ChannelDayProgram removedDayProgram, ChannelDayProgram addedDayProgram)
removedDayProgram
- The old ChannelDayProgram.addedDayProgram
- The new ChannelDayProgram.handleTvDataAdded(ChannelDayProgram)
,
handleTvDataDeleted(ChannelDayProgram)
,
handleTvDataUpdateFinished()
public void onActivation()
public void onDeactivation()
public boolean canUseProgramTree()
getRootNode()
public void handleTvBrowserStartFinished()
public PluginTreeNode getRootNode()
canUseProgramTree()
protected void loadRootNode(PluginTreeNode node)
public void storeRootNode()
protected void storeRootNode(PluginTreeNode node)
public boolean canReceiveProgramsWithTarget()
canReceiveProgramsWithTarget
in interface ProgramReceiveIf
receivePrograms(Program[],ProgramReceiveTarget)
public boolean receivePrograms(Program[] programArr, ProgramReceiveTarget receiveTarget)
ProgramReceiveIf
receivePrograms
in interface ProgramReceiveIf
programArr
- The programs passed from the other plugin.receiveTarget
- The receive target of the programs.
true
, if the programs were correctly received and the
target really exists.ProgramReceiveIf.canReceiveProgramsWithTarget()
public boolean receiveValues(java.lang.String[] values, ProgramReceiveTarget receiveTarget)
receiveValues
in interface ProgramReceiveIf
values
- The value array passed from the other plugin.receiveTarget
- The receive target of the programs.
true
if the value array was handled correct,
false otherwise.canReceiveProgramsWithTarget()
public ProgramReceiveTarget[] getProgramReceiveTargets()
ProgramReceiveIf
null
if there is no
target
getProgramReceiveTargets
in interface ProgramReceiveIf
ProgramReceiveIf.canReceiveProgramsWithTarget()
,
ProgramReceiveIf.receivePrograms(Program[],ProgramReceiveTarget)
public PluginsProgramFilter[] getAvailableFilter()
null
if it supports no filter.public boolean isAllowedToDeleteProgramFilter(PluginsProgramFilter programFilter)
programFilter
- The program filter to delete.
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.Class<? extends PluginsFilterComponent>[] getAvailableFilterComponentClasses()
(Class extends PluginsFilterComponent>[]) new Class[] {MyFilterComponent1.class,MyFilterComponent2.class};
because the creation of a class array with generic type didn't work.
null
if no plugins filter components are supported.public int getMarkPriorityForProgram(Program p)
The mark priority can be
Program.NO_MARK_PRIORITY
,Program.MIN_MARK_PRIORITY
,Program.LOWER_MEDIUM_MARK_PRIORITY
,Program.MEDIUM_MARK_PRIORITY
,Program.HIGHER_MEDIUM_MARK_PRIORITY
orProgram.MAX_MARK_PRIORITY
.
getMarkPriorityForProgram
in interface Marker
p
- The program to get the mark priority for.
protected final boolean saveMe()
True
if the settings could be saved successfully.public final void layoutWindow(java.lang.String windowId, java.awt.Window window)
windowId
- The relative id of the window. The ID only needs to unique for this plugin.window
- The window to layout.public final void layoutWindow(java.lang.String windowId, java.awt.Window window, java.awt.Dimension defaultSize)
windowId
- The relative id of the window. The ID only needs to unique for this plugin.window
- The window to layout.defaultSize
- The default size for the window.public ProgramRatingIf[] getRatingInterfaces()
PluginManager.getAllProgramRatingIfs()
The plugin can return more than one ratingif, e.g. average ratings, user rating ...
public int compareTo(ProgramReceiveIf o)
compareTo
in interface java.lang.Comparable<ProgramReceiveIf>
public ImportanceValue getImportanceValueForProgram(Program p)
The importance value can be created as a weighted total of the following values.
Program.DEFAULT_PROGRAM_IMPORTANCE
,Program.MIN_PROGRAM_IMPORTANCE
,Program.LOWER_MEDIUM_PROGRAM_IMPORTANCE
,Program.MEDIUM_PROGRAM_IMPORTANCE
,Program.HIGHER_MEDIUM_PROGRAM_IMPORTANCE
orProgram.MAX_PROGRAM_IMPORTANCE
.
p
- The program to get the importance value for.
public java.lang.String getPluginCategory()
The category can be one of this values. Note: Don't use the NO_CATEGORY it's only for backward compatibility.
ALL_CATEGORY
REMOTE_CONTROL_SOFTWARE_CATEGORY
REMOTE_CONTROL_HARDWARE_CATEGORY
ADDITONAL_DATA_SERVICE_SOFTWARE_CATEGORY
ADDITONAL_DATA_SERVICE_HARDWARE_CATEGORY
RATINGS_CATEGORY
OTHER_CATEGORY
public PluginCenterPanelWrapper getPluginCenterPanelWrapper()
PluginCenterPanelWrapper
for this plugin or null
.public AfterDataUpdateInfoPanel getAfterDataUpdateInfoPanel()
public void handleTvBrowserSettingsChanged()
public void handleTvDataUpdateStarted()
handleTvDataUpdateStarted(Date)
instead
public void handleTvDataUpdateStarted(Date until)
|
TV-Browser 3.3.3 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |