net.sourceforge.rssowl.model
Class Category

java.lang.Object
  extended bynet.sourceforge.rssowl.model.Category

public class Category
extends Object

The URL Tree builds itself from the Root-Object of this class. The root object holds categorys with its favorites. Each category may hold other sub-categorys and favorites. Some static methods provide access to the url / title of the favorites.

Version:
1.1.3
Author:
Benjamin Pasero

Field Summary
private static Vector blogrolls
          Vector holding all blogrolls
private static Vector favLinks
          Vector holding all favorite-urls
private  Hashtable favorites
          Hashtable holding the favorites of this category
private static Hashtable favPool
          Hashtable holding all favorites
private static Vector favTitles
          Vector holding all favorite-titles
private  boolean isBlogroll
          TRUE if this category is a blogroll
private  boolean isExpanded
          TRUE if this category is expanded in the favorite tree
private  boolean isRoot
          TRUE if this category is the root element of the favorite tree
private  boolean isUnSynchronized
          Flag indicating an unsynchronized blogroll
private static Hashtable mapLinkToTitle
          Hashtable holding all favorites mapping Link => Title
private static Hashtable mapTitleToLink
          Hashtable holding all favorites mapping Title => Link
private  String name
          Name of the Category
private  Category parent
          Parent category of this category
private  String pathToBlogroll
          Path to the blogroll XML
private static Category rootCategory
          The root category of all categories in RSSOwl
private  TreeSet sortedLinkTitles
          TreeSet holding the sorted titles of the favorites in this category
private  TreeSet sortedSubCatTitles
          TreeSet holding the sorted titles of the subcategories in this category
private  Hashtable subCategories
          Hashtable holding the subcategories of this category
private  org.eclipse.swt.widgets.TreeItem treeItem
          TreeItem this Category is shown
private  boolean useProxy
          TRUE if a proxy should be used
 
Constructor Summary
Category(String name, Category parent, boolean isBlogroll)
          Instantiate a new Category
 
Method Summary
 void addCategory(Category rssOwlCategory)
          Add a subcategory to this category
 void addCategory(Category rssOwlCategory, boolean makeUniqueTitle)
          Add a subcategory to this category
 void addFavorite(Favorite rssOwlFavorite)
          Add a favorit to the category
static boolean blogrollExists(String url)
          Check if the blogroll already exists
 void checkUseProxy(Category rssOwlCategory)
          Check recursivly what state the use proxy setting has
static void createRootCategory()
          Create a new root category
static String createUniqueLink(String link)
          Create a unique link
static String createUniqueTitle(String title)
          Create a unique title
 boolean editCategory(String title, String newTitle)
          Edit a subcategory
 void editFavorite(Favorite oldFavorite, Favorite newFavorite)
          Edit a favorite
 void getAllFavoriteTitles(TreeSet allFavoriteTitles, Category rssOwlCategory)
          Recursivly get all favorite titles also from the subcategorys
static Vector getBlogrolls()
           
 Hashtable getFavorites()
          Get all favorites of this Category
static Hashtable getFavPool()
          Get the Hashtable that stores all favorites
static String getLinkForTitle(String title)
          Return the Link for the given Title
 void getLoadOnStartupFavorites(TreeSet loadOnStartupFavorites, Category rssOwlCategory)
          Recursivly get all favorites also from the subcategorys that should autoload on startup of RSSOwl
 String getName()
           
 Category getParent()
           
 String getPathToBlogroll()
           
static Category getRootCategory()
          Get the root category of all categories used in RSSOwl to store favorites or other cats.
 TreeSet getSortedLinkTitles()
           
 TreeSet getSortedSubCatTitles()
           
 Hashtable getSubCategories()
           
static String getTitleForLink(String link)
          Return the Title of the given Link
 org.eclipse.swt.widgets.TreeItem getTreeItem()
           
 boolean isBlogroll()
           
 boolean isExpanded()
           
 boolean isRoot()
           
 boolean isUnSynchronized()
           
 boolean isUseProxy()
           
static boolean linkExists(String link)
          Check if the link already exists
 void removeAll()
          Remove all Favorites and Sub-Categories from the Category
 void removeCategory(String name, Category rssOwlCategory)
          Remove a subcategory from this category.
 void removeFavorite(String title, boolean disposeTreeItem)
          Remove a favorite from the category
 void reset()
          Reset this category.
 void setBlogroll(boolean isBlogroll)
          Set TRUE if this category is from a blogroll
 void setExpanded(boolean isExpanded)
          Set TRUE if category is expanded in the url tree
 void setName(String name)
          Set the Name of this category
 void setParent(Category parent)
          If the category is moved it is usefull to set the parent explicitly without calling the constructor.
 void setPathToBlogroll(String pathToBlogroll)
          Set the URL / Path to the blogroll
 void setTreeItem(org.eclipse.swt.widgets.TreeItem treeItem)
           
 void setUnSynchronized(boolean isUnSynchronized)
          Set the Blogroll's synchronization state
 void setUseProxy(boolean useProxy)
          Set TRUE if proxy should be used in this category's favorites and subcategories favorites
private  void setUseProxy(Category rssOwlCategory, boolean enabled)
          Recursivly update state of use proxy
static boolean titleExists(String title)
          Check if the title already exists
 String toCatPath()
          Crate the category path from the category
 String toCatPath(boolean humanReadable)
          Crate the category path from the category
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

blogrolls

private static Vector blogrolls
Vector holding all blogrolls


favLinks

private static Vector favLinks
Vector holding all favorite-urls


favPool

private static Hashtable favPool
Hashtable holding all favorites


favTitles

private static Vector favTitles
Vector holding all favorite-titles


mapLinkToTitle

private static Hashtable mapLinkToTitle
Hashtable holding all favorites mapping Link => Title


mapTitleToLink

private static Hashtable mapTitleToLink
Hashtable holding all favorites mapping Title => Link


rootCategory

private static Category rootCategory
The root category of all categories in RSSOwl


favorites

private Hashtable favorites
Hashtable holding the favorites of this category


isBlogroll

private boolean isBlogroll
TRUE if this category is a blogroll


isExpanded

private boolean isExpanded
TRUE if this category is expanded in the favorite tree


isRoot

private boolean isRoot
TRUE if this category is the root element of the favorite tree


isUnSynchronized

private boolean isUnSynchronized
Flag indicating an unsynchronized blogroll


name

private String name
Name of the Category


parent

private Category parent
Parent category of this category


pathToBlogroll

private String pathToBlogroll
Path to the blogroll XML


sortedLinkTitles

private TreeSet sortedLinkTitles
TreeSet holding the sorted titles of the favorites in this category


sortedSubCatTitles

private TreeSet sortedSubCatTitles
TreeSet holding the sorted titles of the subcategories in this category


subCategories

private Hashtable subCategories
Hashtable holding the subcategories of this category


treeItem

private org.eclipse.swt.widgets.TreeItem treeItem
TreeItem this Category is shown


useProxy

private boolean useProxy
TRUE if a proxy should be used

Constructor Detail

Category

public Category(String name,
                Category parent,
                boolean isBlogroll)
Instantiate a new Category

Parameters:
name - Name of the category
parent - Parent category of this subcategory
isBlogroll - TRUE if category is from a blogroll
Method Detail

blogrollExists

public static boolean blogrollExists(String url)
Check if the blogroll already exists

Parameters:
url - URL to the blogroll
Returns:
TRUE if blogroll exists

createRootCategory

public static void createRootCategory()
Create a new root category


createUniqueLink

public static String createUniqueLink(String link)
Create a unique link

Parameters:
link - The link to make unique
Returns:
The unique link

createUniqueTitle

public static String createUniqueTitle(String title)
Create a unique title

Parameters:
title - The title to make unique
Returns:
The unique title

getBlogrolls

public static Vector getBlogrolls()
Returns:
Vector holding the URLs of all blogrolls

getFavPool

public static Hashtable getFavPool()
Get the Hashtable that stores all favorites

Returns:
Hashtable All favorites

getLinkForTitle

public static String getLinkForTitle(String title)
Return the Link for the given Title

Parameters:
title - Title of the favorit
Returns:
String Link of the favorit

getRootCategory

public static Category getRootCategory()
Get the root category of all categories used in RSSOwl to store favorites or other cats.

Returns:
Category The root category

getTitleForLink

public static String getTitleForLink(String link)
Return the Title of the given Link

Parameters:
link - Link of the favorit
Returns:
String Title of the favorit

linkExists

public static boolean linkExists(String link)
Check if the link already exists

Parameters:
link - URL of the link
Returns:
TRUE if link exists

titleExists

public static boolean titleExists(String title)
Check if the title already exists

Parameters:
title - Title of the link
Returns:
TRUE if Title exists

addCategory

public void addCategory(Category rssOwlCategory)
Add a subcategory to this category

Parameters:
rssOwlCategory - The subcategory

addCategory

public void addCategory(Category rssOwlCategory,
                        boolean makeUniqueTitle)
Add a subcategory to this category

Parameters:
rssOwlCategory - The subcategory
makeUniqueTitle - TRUE if the new category has to get a unique title to avoid duplicates in the subcategories of this category

addFavorite

public void addFavorite(Favorite rssOwlFavorite)
Add a favorit to the category

Parameters:
rssOwlFavorite - A RSSOwl favorite

checkUseProxy

public void checkUseProxy(Category rssOwlCategory)
Check recursivly what state the use proxy setting has

Parameters:
rssOwlCategory - Current Category

editCategory

public boolean editCategory(String title,
                            String newTitle)
Edit a subcategory

Parameters:
title - Title of the Subcategory
newTitle - New Title of the Subcategory
Returns:
TRUE if new title not yet existing

editFavorite

public void editFavorite(Favorite oldFavorite,
                         Favorite newFavorite)
Edit a favorite

Parameters:
oldFavorite - The edited favorite
newFavorite - The updated favorite

getAllFavoriteTitles

public void getAllFavoriteTitles(TreeSet allFavoriteTitles,
                                 Category rssOwlCategory)
Recursivly get all favorite titles also from the subcategorys

Parameters:
allFavoriteTitles - TreeSet holding titles of all favorites
rssOwlCategory - Current Category

getFavorites

public Hashtable getFavorites()
Get all favorites of this Category

Returns:
Hashtable All favorites of this category

getLoadOnStartupFavorites

public void getLoadOnStartupFavorites(TreeSet loadOnStartupFavorites,
                                      Category rssOwlCategory)
Recursivly get all favorites also from the subcategorys that should autoload on startup of RSSOwl

Parameters:
loadOnStartupFavorites - TreeSet holding titles of all favorites
rssOwlCategory - Current Category

getName

public String getName()
Returns:
String Name of the Category

getParent

public Category getParent()
Returns:
Category The parent category

getPathToBlogroll

public String getPathToBlogroll()
Returns:
String The URL / Path to the blogroll

getSortedLinkTitles

public TreeSet getSortedLinkTitles()
Returns:
TreeSet Sorted favorite titles

getSortedSubCatTitles

public TreeSet getSortedSubCatTitles()
Returns:
TreeSet Sorted subcategory titles

getSubCategories

public Hashtable getSubCategories()
Returns:
Hashtable All subcategorys of this category

getTreeItem

public org.eclipse.swt.widgets.TreeItem getTreeItem()
Returns:
Returns the treeItem.

isBlogroll

public boolean isBlogroll()
Returns:
TRUE if this category is from a blogroll

isExpanded

public boolean isExpanded()
Returns:
TRUE if category is expanded in the url tree

isRoot

public boolean isRoot()
Returns:
TRUE is this category is the root

isUnSynchronized

public boolean isUnSynchronized()
Returns:
TRUE if Blogroll is unsychronized

isUseProxy

public boolean isUseProxy()
Returns:
TRUE The state of the use proxy field

removeAll

public void removeAll()
Remove all Favorites and Sub-Categories from the Category


removeCategory

public void removeCategory(String name,
                           Category rssOwlCategory)
Remove a subcategory from this category. Also remove all favorites of the subcategorys

Parameters:
name - Name of the subcategory
rssOwlCategory - Current Category

removeFavorite

public void removeFavorite(String title,
                           boolean disposeTreeItem)
Remove a favorite from the category

Parameters:
disposeTreeItem - If TRUE, dispose the favorite's TreeItem
title - Title of the favorite

reset

public void reset()
Reset this category. This method is usually called from the root category


setBlogroll

public void setBlogroll(boolean isBlogroll)
Set TRUE if this category is from a blogroll

Parameters:
isBlogroll -

setExpanded

public void setExpanded(boolean isExpanded)
Set TRUE if category is expanded in the url tree

Parameters:
isExpanded -

setName

public void setName(String name)
Set the Name of this category

Parameters:
name -

setParent

public void setParent(Category parent)
If the category is moved it is usefull to set the parent explicitly without calling the constructor.

Parameters:
parent - The new parent category

setPathToBlogroll

public void setPathToBlogroll(String pathToBlogroll)
Set the URL / Path to the blogroll

Parameters:
pathToBlogroll -

setTreeItem

public void setTreeItem(org.eclipse.swt.widgets.TreeItem treeItem)
Parameters:
treeItem - The treeItem to set.

setUnSynchronized

public void setUnSynchronized(boolean isUnSynchronized)
Set the Blogroll's synchronization state

Parameters:
isUnSynchronized - TRUE indicates that this Blogroll has not yet been synchronized with the blogroll.

setUseProxy

public void setUseProxy(boolean useProxy)
Set TRUE if proxy should be used in this category's favorites and subcategories favorites

Parameters:
useProxy -

toCatPath

public String toCatPath()
Crate the category path from the category

Returns:
String Category path to the Category

toCatPath

public String toCatPath(boolean humanReadable)
Crate the category path from the category

Parameters:
humanReadable - If TRUE, use '>' as separator
Returns:
String Category path to the Category

setUseProxy

private void setUseProxy(Category rssOwlCategory,
                         boolean enabled)
Recursivly update state of use proxy

Parameters:
rssOwlCategory - Current Category
enabled - TRUE if proxy should be used


RSSOwl - RSS / RDF / Atom Newsreader

SourceForge.net Logo