net.sourceforge.java.feednread.backend.model.watchestree
Class WatchFolder

java.lang.Object
  extended bynet.sourceforge.java.util.gui.jface.viewers.MutableTreeElement
      extended bynet.sourceforge.java.feednread.backend.model.watchestree.WatchFolder
All Implemented Interfaces:
IFilterTag, IMutableTreeElement, INameable, INewsFeedStatus, ITreeElement

public class WatchFolder
extends MutableTreeElement
implements INameable, INewsFeedStatus, IFilterTag

Logical folder structure to hold and organize Watch elements.

Author:
Sebastian Machhausen

Field Summary
private  String description
           The description of the WatchFolder
private  boolean filtered
           true if filtered; false otherwise
private  String title
           The title of the WatchFolder
 
Fields inherited from class net.sourceforge.java.util.gui.jface.viewers.MutableTreeElement
 
Constructor Summary
WatchFolder(String title)
           Creates a new WatchFolder with the specified title.
WatchFolder(String title, String description)
           Creates a new WatchFolder with the specified title.
 
Method Summary
 Watch[] collectWatches()
           Recursively collects all Watch elements starting at this WatchFolder.
 String getDescription()
           Gets the description of this WatchFolder.
 String getTitle()
           Gets the title of this WatchFolder.
 int getUnreadCount()
           Returns the number of unread news in the NewsFeeds related to the Watches in this WatchFolder and all of its sub WatchFolders.
 int getUnreadCount(ITreeElement element)
           Returns the number of unread news in the NewsFeeds related to the specified ITreeElement.
 boolean isFiltered()
           Gets the filtered status of this WatchFolder.
 boolean isUnread()
           Returns true if at least one NewsFeed related to a Favorite in this Category holds an unread news.
private  boolean isUnread(ITreeElement element)
           Returns true if at least one NewsFeed related to a Watch in the specified ITreeElement holds an unread news.
 void setDescription(String description)
           Sets the description of this WatchFolder.
 void setFiltered(boolean filtered)
           Sets the filtered status of this WatchFolder.
 void setTitle(String title)
           Sets the title of this WatchFolder.
 String toString()
           Gets the textual represntation of this WatchFolder.
 
Methods inherited from class net.sourceforge.java.util.gui.jface.viewers.MutableTreeElement
add, addIMutableTreeElementListener, allowsSubElements, collectLeafs, dispose, fireElementAdded, fireElementRemoved, fireElementUpdated, getData, getElementAt, getElements, getIndex, getParent, getPath, getSize, hasSubElements, isSubElement, remove, removeIMutableTreeElementListener, setData, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

title

private String title

The title of the WatchFolder


description

private String description

The description of the WatchFolder


filtered

private boolean filtered

true if filtered; false otherwise

Constructor Detail

WatchFolder

public WatchFolder(String title)

Creates a new WatchFolder with the specified title.

Parameters:
title - the title for this WatchFolder
See Also:
WatchFolder(String, String)

WatchFolder

public WatchFolder(String title,
                   String description)

Creates a new WatchFolder with the specified title.

Parameters:
title - the title for this WatchFolder
description - the description for this WatchFolder
See Also:
WatchFolder(String)
Method Detail

setTitle

public void setTitle(String title)

Sets the title of this WatchFolder.

Specified by:
setTitle in interface INameable
Parameters:
title - the new title for this WatchFolder
See Also:
INameable.setTitle(String), getTitle()

getTitle

public String getTitle()

Gets the title of this WatchFolder.

Specified by:
getTitle in interface INameable
Returns:
the title of this WatchFolder
See Also:
INameable.getTitle(), setTitle(String)

setDescription

public void setDescription(String description)

Sets the description of this WatchFolder.

Parameters:
description - the new description for this WatchFolder
See Also:
getDescription()

getDescription

public String getDescription()

Gets the description of this WatchFolder.

Returns:
the description of this WatchFolder
See Also:
setDescription(String)

isUnread

public boolean isUnread()

Returns true if at least one NewsFeed related to a Favorite in this Category holds an unread news.

Specified by:
isUnread in interface INewsFeedStatus
Returns:
true if at least one NewsFeed related to a Favorite in this Category holds an unread news; false otherwise
See Also:
INewsFeedStatus.isUnread()

isUnread

private boolean isUnread(ITreeElement element)

Returns true if at least one NewsFeed related to a Watch in the specified ITreeElement holds an unread news.

Parameters:
element - the ITreeElement to test
Returns:
true if at least one NewsFeed related to a Watch the specified ITreeElement holds an unread news; false otherwise

getUnreadCount

public int getUnreadCount()

Returns the number of unread news in the NewsFeeds related to the Watches in this WatchFolder and all of its sub WatchFolders.

Specified by:
getUnreadCount in interface INewsFeedStatus
Returns:
the number of unread news in the NewsFeeds related to the Watches in this WatchFolder and all of its sub WatchFolders
See Also:
INewsFeedStatus.getUnreadCount()

getUnreadCount

public int getUnreadCount(ITreeElement element)

Returns the number of unread news in the NewsFeeds related to the specified ITreeElement. If the specified ITreeElement denotes a WatchFolder the calculation is done recursively.

Parameters:
element - the ITreeElement to get the number of unread news for
Returns:
the number of unread news in the NewsFeeds related to the specified ITreeElement

isFiltered

public boolean isFiltered()

Gets the filtered status of this WatchFolder.

Specified by:
isFiltered in interface IFilterTag
Returns:
true if this WatchFolder is filtered; false otherwise

setFiltered

public void setFiltered(boolean filtered)

Sets the filtered status of this WatchFolder.

Specified by:
setFiltered in interface IFilterTag
Parameters:
filtered - true to mark this WatchFolder as filtered; false to mark it as unfiltered

collectWatches

public Watch[] collectWatches()

Recursively collects all Watch elements starting at this WatchFolder.

Returns:
the collected Watch elements

toString

public String toString()

Gets the textual represntation of this WatchFolder. Returns the WatchFolder's title.

Overrides:
toString in class MutableTreeElement
Returns:
the textual representaion of this WatchFolder