TV-Browser 2.7.5 API

tvbrowser.extras.favoritesplugin.dlgs
Class FavoriteTreeModel

java.lang.Object
  extended by javax.swing.tree.DefaultTreeModel
      extended by tvbrowser.extras.favoritesplugin.dlgs.FavoriteTreeModel
All Implemented Interfaces:
Serializable, TreeModel

public class FavoriteTreeModel
extends DefaultTreeModel

The model for the favorite tree.

Since:
2.6
Author:
René Mach
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.tree.DefaultTreeModel
asksAllowsChildren, listenerList, root
 
Method Summary
 void addFavorite(Favorite fav)
          Adds a favorite to this tree at the root node.
 void addFavorite(Favorite fav, FavoriteNode target)
          Adds a favorite to this tree at the given target node.
 void deleteFavorite(Favorite favorite)
          Deletes a favorite.
 Favorite[] getFavoriteArr()
          Gets all favorites in an array.
static String getFavoriteLabel(Favorite favorite, Program program)
           
static String getFavoriteLabel(Favorite favorite, Program p, Channel currentChannel)
           
 Favorite[] getFavoritesContainingProgram(Program program)
          get an array of all favorites containing the given program
 Favorite[] getFavoritesContainingReceiveTarget(ProgramReceiveTarget target)
          Gets the Favorites containing the given receive target in an array.
static FavoriteTreeModel getInstance()
           
static int[] getProgramsCount(FavoriteNode node)
          Calculates the number of programs contained in the children
static FavoriteTreeModel initInstance(Favorite[] favoriteArr)
           
static FavoriteTreeModel initInstance(ObjectInputStream in, int version)
           
 boolean isContainedByOtherFavorites(Favorite favorite, Program p)
          Check if a program is marked by other Favorites to.
 boolean isLeaf(Object nodeObject)
           
 void reload()
           
 void reload(FavoriteTree tree, TreeNode node)
           
 void reload(TreeNode node)
           
 void sort(FavoriteNode node, boolean start, Comparator<FavoriteNode> comp, String title)
          Sorts the path from the given node to all leafs alphabetically.
 void storeData(ObjectOutputStream out)
          Saves the data of this tree into the given stream.
 void updatePluginTree(PluginTreeNode rootNode)
           
 void updatePluginTree(PluginTreeNode node, FavoriteNode parentFavorite)
           
 
Methods inherited from class javax.swing.tree.DefaultTreeModel
addTreeModelListener, asksAllowsChildren, fireTreeNodesChanged, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, getChild, getChildCount, getIndexOfChild, getListeners, getPathToRoot, getPathToRoot, getRoot, getTreeModelListeners, insertNodeInto, nodeChanged, nodesChanged, nodeStructureChanged, nodesWereInserted, nodesWereRemoved, removeNodeFromParent, removeTreeModelListener, setAsksAllowsChildren, setRoot, valueForPathChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

initInstance

public static FavoriteTreeModel initInstance(Favorite[] favoriteArr)

initInstance

public static FavoriteTreeModel initInstance(ObjectInputStream in,
                                             int version)
                                      throws IOException,
                                             ClassNotFoundException
Throws:
IOException
ClassNotFoundException

getInstance

public static FavoriteTreeModel getInstance()

reload

public void reload(TreeNode node)
Overrides:
reload in class DefaultTreeModel

reload

public void reload(FavoriteTree tree,
                   TreeNode node)

reload

public void reload()
Overrides:
reload in class DefaultTreeModel

isLeaf

public boolean isLeaf(Object nodeObject)
Specified by:
isLeaf in interface TreeModel
Overrides:
isLeaf in class DefaultTreeModel

getFavoriteArr

public Favorite[] getFavoriteArr()
Gets all favorites in an array.

Returns:
All favorites in an array.

deleteFavorite

public void deleteFavorite(Favorite favorite)
Deletes a favorite.

Parameters:
favorite - The favorite to delete.

isContainedByOtherFavorites

public boolean isContainedByOtherFavorites(Favorite favorite,
                                           Program p)
Check if a program is marked by other Favorites to.

Parameters:
favorite - The Favorite that wants to check this.
p - The program to check.
Returns:
True if the program was found in other Favorites than the given one.

addFavorite

public void addFavorite(Favorite fav)
Adds a favorite to this tree at the root node.

Parameters:
fav - The favorite to add.

addFavorite

public void addFavorite(Favorite fav,
                        FavoriteNode target)
Adds a favorite to this tree at the given target node.

Parameters:
fav - The favorite to add.
target - The target node to add the favorite to or null if the root node should be used.

getFavoriteLabel

public static String getFavoriteLabel(Favorite favorite,
                                      Program program)

getFavoriteLabel

public static String getFavoriteLabel(Favorite favorite,
                                      Program p,
                                      Channel currentChannel)

storeData

public void storeData(ObjectOutputStream out)
               throws IOException
Saves the data of this tree into the given stream.

Parameters:
out - The stream to write the data to.
Throws:
IOException - Thrown if something went wrong

updatePluginTree

public void updatePluginTree(PluginTreeNode node,
                             FavoriteNode parentFavorite)

getProgramsCount

public static int[] getProgramsCount(FavoriteNode node)
Calculates the number of programs contained in the children

Parameters:
node - use this Node
Returns:
Number of Child-Nodes

sort

public void sort(FavoriteNode node,
                 boolean start,
                 Comparator<FavoriteNode> comp,
                 String title)
Sorts the path from the given node to all leafs alphabetically.

Parameters:
node - The node to sort from.
start - If this is called with the root sort node.
comp - Comparator for sorting
title - Title of confirmation message dialog

getFavoritesContainingReceiveTarget

public Favorite[] getFavoritesContainingReceiveTarget(ProgramReceiveTarget target)
Gets the Favorites containing the given receive target in an array.

Parameters:
target - The target to check.
Returns:
The Favorites that contains the given receive target in an array.

updatePluginTree

public void updatePluginTree(PluginTreeNode rootNode)

getFavoritesContainingProgram

public Favorite[] getFavoritesContainingProgram(Program program)
get an array of all favorites containing the given program

Parameters:
program - program to search for
Returns:
array of favorites
Since:
2.7

TV-Browser 2.7.5 API

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