tvbrowser.extras.favoritesplugin.dlgs

## Class FavoriteTreeModel

- java.lang.Object
- - javax.swing.tree.DefaultTreeModel
  - - tvbrowser.extras.favoritesplugin.dlgs.FavoriteTreeModel

- All Implemented Interfaces:
    java.io.Serializable, javax.swing.tree.TreeModel

      public class FavoriteTreeModel
      extends javax.swing.tree.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

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addFavorite(Favorite fav)` Adds a favorite to this tree at the root node.
    `FavoriteNode` | `addFavorite(Favorite fav, FavoriteNode parent)` 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 java.lang.String` | `getFavoriteLabel(Favorite favorite, Program program)`
    `static java.lang.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(java.io.ObjectInputStream in, int version)`
    `boolean` | `isContainedByOtherFavorites(Favorite favorite, Program p)` Check if a program is marked by other Favorites to.
    `boolean` | `isInMultipleFavorites(Program program)`
    `boolean` | `isLeaf(java.lang.Object nodeObject)`
    `void` | `reload()`
    `void` | `reload(FavoriteTree tree, javax.swing.tree.TreeNode node)`
    `void` | `reload(javax.swing.tree.TreeNode node)`
    `void` | `resetMultiplesCounter()`
    `void` | `reValidateChannelLimitations()`
    `void` | `sort(FavoriteNode node, java.util.Comparator<FavoriteNode> comp, java.lang.String title)` Sorts the path from the given node to all leafs alphabetically.
    `void` | `storeData(java.io.ObjectOutputStream out)` Saves the data of this tree into the given stream.
    `void` | `updatePluginTree(PluginTreeNode topicNode, java.util.ArrayList<Program> allPrograms)`
    `void` | `updatePluginTree(PluginTreeNode node, java.util.ArrayList<Program> allPrograms, 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(java.io.ObjectInputStream in,
                                       int version)
                                                throws java.io.IOException,
                                                       java.lang.ClassNotFoundException

      Throws:
        `java.io.IOException`
        `java.lang.ClassNotFoundException`

    - #### getInstance

          public static FavoriteTreeModel getInstance()

    - #### reload

          public void reload(javax.swing.tree.TreeNode node)

      Overrides:
        `reload` in class `javax.swing.tree.DefaultTreeModel`

    - #### reload

          public void reload(FavoriteTree tree,
                    javax.swing.tree.TreeNode node)

    - #### reload

          public void reload()

      Overrides:
        `reload` in class `javax.swing.tree.DefaultTreeModel`

    - #### isLeaf

          public boolean isLeaf(java.lang.Object nodeObject)

      Specified by:
        `isLeaf` in interface `javax.swing.tree.TreeModel`
      Overrides:
        `isLeaf` in class `javax.swing.tree.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 FavoriteNode addFavorite(Favorite fav,
                                 FavoriteNode parent)

      Adds a favorite to this tree at the given target node.
      Parameters:
        `fav` - The favorite to add.
        `parent` - The parent node to add the favorite to or `null` if the root node should be used.
      Returns:
        the newly created node for the favorite

    - #### getFavoriteLabel

          public static java.lang.String getFavoriteLabel(Favorite favorite,
                                          Program program)

    - #### getFavoriteLabel

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

    - #### storeData

          public void storeData(java.io.ObjectOutputStream out)
                         throws java.io.IOException

      Saves the data of this tree into the given stream.
      Parameters:
        `out` - The stream to write the data to.
      Throws:
        `java.io.IOException` - Thrown if something went wrong

    - #### updatePluginTree

          public void updatePluginTree(PluginTreeNode node,
                              java.util.ArrayList<Program> allPrograms,
                              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,
                  java.util.Comparator<FavoriteNode> comp,
                  java.lang.String title)

      Sorts the path from the given node to all leafs alphabetically.
      Parameters:
        `node` - The node to sort from.
        `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 topicNode,
                              java.util.ArrayList<Program> allPrograms)

    - #### 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

    - #### isInMultipleFavorites

          public boolean isInMultipleFavorites(Program program)

    - #### resetMultiplesCounter

          public void resetMultiplesCounter()

    - #### reValidateChannelLimitations

          public void reValidateChannelLimitations()

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