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

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

public class Watch
extends MutableTreeElement
implements INameable, INewsFeedStatus, INewsFeedStatusListener, INewsFeedTableStatusListener, IFilterTag

Represents a NewsFeedWatch tree element which can be organized in WatchFolder structures.

Author:
Sebastian Machhausen

Field Summary
private  String description
           The description of the Watch
private  boolean filtered
           true if filtered; false otherwise
private  AggregatedNewsFeed newsFeed
           The AggregatedNewsFeed holding all NewsFeedEntries that match the criterions of the embedded WatchSettings.
private  String title
           The title of the Watch
private  IMutableTreeElement[] watchedElements
           The list of IMutableTreeElements to watch
 
Fields inherited from class net.sourceforge.java.util.gui.jface.viewers.MutableTreeElement
 
Constructor Summary
Watch(String title)
           Creates a new Watch instance with the specified title.
Watch(String title, String description)
           Creates a new Watch instance with the specified title.
 
Method Summary
 void closing(NewsFeedTableStatusChangedEvent event)
           Triggered when the NewsFeedTable is about to be closed.
 void dispose()
           Disposes this Watch.
 String getDescription()
           Gets the description of this Watch.
 AggregatedNewsFeed getNewsFeed()
           Gets the AggregatedNewsFeed of this Watch.
 WatchSettings getSettings()
           Gets the WatchSettings of this Watch.
 String getTitle()
           Gets the title of this Watch.
 int getUnreadCount()
           Returns the number of unread news in the NewsFeed related to this Favorite.
 IMutableTreeElement[] getWatchedElements()
           Gets the IMutableTreeElements included in this Watch, i.e. the IMutableTreeElements which are watched.
 Favorite[] getWatchedFavorites()
           Gets the Favorites included in this Watch, i.e. the Favorites which are watched.
private  void initializeAggregation()
           Initializes the internally used AgrgegatedNewsFeed with the data from this Watch.
 boolean isFiltered()
           Gets the filtered status of this Watch.
 boolean isUnread()
           Returns true if the NewsFeed related to this Favorite
 void newsFeedReadStatusChanged(NewsFeed newsFeed)
           Called whenever the read status of the NewsFeed associated to one of the watched Favorites has changed.
 void newsFeedUpdated(NewsFeed updatedNewsFeed)
           Called whenever the NewsFeed associated to one of the watched Favorites has changed.
 void setDescription(String description)
           Sets the description of this Watch.
 void setFiltered(boolean filtered)
           Sets the filtered status of this Watch.
 void setNewsFeed(AggregatedNewsFeed newsFeed)
           Sets the NewsFeed of this Watch.
 void setSettings(WatchSettings settings)
           Sets the WatchSettings for this Watch.
 void setTitle(String title)
           Sets the title of this Watch.
 void setWatchedElements(IMutableTreeElement[] watchedElements)
           Sets the IMutableTreeElements to include in this Watch, i.e. to watch over.
 void statusChanged(NewsFeedTableStatusChangedEvent event)
           Triggered when the status of the NewsFeedTable changes.
 String toString()
           Gets the textual represntation of this Watch.
private  void updateParents()
           Updates all parent Categories of this Favorite.
 
Methods inherited from class net.sourceforge.java.util.gui.jface.viewers.MutableTreeElement
add, addIMutableTreeElementListener, allowsSubElements, collectLeafs, 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 Watch


description

private String description

The description of the Watch


filtered

private boolean filtered

true if filtered; false otherwise


watchedElements

private IMutableTreeElement[] watchedElements

The list of IMutableTreeElements to watch


newsFeed

private AggregatedNewsFeed newsFeed

The AggregatedNewsFeed holding all NewsFeedEntries that match the criterions of the embedded WatchSettings.

Constructor Detail

Watch

public Watch(String title)

Creates a new Watch instance with the specified title.

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

Watch

public Watch(String title,
             String description)

Creates a new Watch instance with the specified title.

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

setTitle

public void setTitle(String title)

Sets the title of this Watch.

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

getTitle

public String getTitle()

Gets the title of this Watch.

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

setDescription

public void setDescription(String description)

Sets the description of this Watch.

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

getDescription

public String getDescription()

Gets the description of this Watch.

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

setWatchedElements

public void setWatchedElements(IMutableTreeElement[] watchedElements)

Sets the IMutableTreeElements to include in this Watch, i.e. to watch over.

Parameters:
watchedElements - the IMutableTreeElements to include in this Watch
See Also:
getWatchedElements()

getWatchedElements

public IMutableTreeElement[] getWatchedElements()

Gets the IMutableTreeElements included in this Watch, i.e. the IMutableTreeElements which are watched.

Returns:
the IMutableTreeElements included in this Watch
See Also:
setWatchedElements(IMutableTreeElement[])

getWatchedFavorites

public Favorite[] getWatchedFavorites()

Gets the Favorites included in this Watch, i.e. the Favorites which are watched. In contrast to the getWatchedElements() method all Category elements are omited.

Returns:
the Favorites included in this Watch

setSettings

public void setSettings(WatchSettings settings)

Sets the WatchSettings for this Watch. The WatchSettings include all the rules to apply for this Watch.

Parameters:
settings - the WatchSettings for this Watch
See Also:
getSettings()

getSettings

public WatchSettings getSettings()

Gets the WatchSettings of this Watch. The WatchSettings include all the rules which are applied for this Watch.

Returns:
settings the WatchSettings of this Watch
See Also:
setSettings(WatchSettings)

setNewsFeed

public void setNewsFeed(AggregatedNewsFeed newsFeed)

Sets the NewsFeed of this Watch.

Parameters:
newsFeed - the AggregatedNewsFeed to set
See Also:
getNewsFeed()

getNewsFeed

public AggregatedNewsFeed getNewsFeed()

Gets the AggregatedNewsFeed of this Watch.

Returns:
the AggregatedNewsFeed of this Watch
See Also:
setNewsFeed(AggregatedNewsFeed)

isUnread

public boolean isUnread()

Returns true if the NewsFeed related to this Favorite

Specified by:
isUnread in interface INewsFeedStatus
Returns:
true if the NewsFeed related to this Favoritefalse otherwise
See Also:
INewsFeedStatus.isUnread()

getUnreadCount

public int getUnreadCount()

Returns the number of unread news in the NewsFeed related to this Favorite.

Specified by:
getUnreadCount in interface INewsFeedStatus
Returns:
the number of unread news in the NewsFeed related to this Favorite
See Also:
INewsFeedStatus.getUnreadCount()

statusChanged

public void statusChanged(NewsFeedTableStatusChangedEvent event)

Triggered when the status of the NewsFeedTable changes. Called whenever the news read status of the associated NewsFeed changed.

Specified by:
statusChanged in interface INewsFeedTableStatusListener
Parameters:
event - the triggered NewsFeedTableStatusChangedEvent

closing

public void closing(NewsFeedTableStatusChangedEvent event)

Triggered when the NewsFeedTable is about to be closed.

Specified by:
closing in interface INewsFeedTableStatusListener
Parameters:
event - the triggered NewsFeedTableStatusChangedEvent

newsFeedUpdated

public void newsFeedUpdated(NewsFeed updatedNewsFeed)

Called whenever the NewsFeed associated to one of the watched Favorites has changed.

Specified by:
newsFeedUpdated in interface INewsFeedStatusListener
Parameters:
updatedNewsFeed - the updated NewsFeed

newsFeedReadStatusChanged

public void newsFeedReadStatusChanged(NewsFeed newsFeed)

Called whenever the read status of the NewsFeed associated to one of the watched Favorites has changed.

Specified by:
newsFeedReadStatusChanged in interface INewsFeedStatusListener
Parameters:
newsFeed - the NewsFeed whose read status changed

isFiltered

public boolean isFiltered()

Gets the filtered status of this Watch.

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

setFiltered

public void setFiltered(boolean filtered)

Sets the filtered status of this Watch.

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

dispose

public void dispose()

Disposes this Watch.

Specified by:
dispose in interface IMutableTreeElement
Overrides:
dispose in class MutableTreeElement

toString

public String toString()

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

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

updateParents

private void updateParents()

Updates all parent Categories of this Favorite.


initializeAggregation

private void initializeAggregation()

Initializes the internally used AgrgegatedNewsFeed with the data from this Watch.