net.sourceforge.java.feednread.frontend.components.tabbar
Class TabManager

java.lang.Object
  extended bynet.sourceforge.java.feednread.frontend.components.tabbar.TabManager

public class TabManager
extends Object

Acts as model for the NewsFeedTabBar ui component by managing the CTabItems and their associated ITabItemData objects.

Author:
Sebastian Machhausen

Field Summary
private  Map aggregatedNewsFeedTabs
           Structure to store aggregated newsfeed tabs
private  CTabItem filterTab
           The special tab to hold filtered news
private  MainApplicationWindow mainWindow
           The Feed'n Read main window
private  Map plainNewsFeedTabs
           Structure to store plain newsfeed tabs
private  NewsFeedTabBar tabBar
           The NewsFeedTabBar component managed
private  CTabFolder tabFolder
           The managed CTabFolder component
private  Map watchTabs
           Structure to store Watch tabs
 
Constructor Summary
TabManager(MainApplicationWindow mainWindow, NewsFeedTabBar tabBar)
           Creates a new TabManager.
 
Method Summary
 void addBrowserTab(String url)
           Adds a new tab showing a browser page refering to the specified url.
 void addMessageTab(String title, Throwable throwable)
           Adds a new tab showing an error message using the specified Throwable.
 void addTab(Favorite favorite)
           Adds a new tab that displays the NewsFeed held by the specified Favorite.
 void addTab(Favorite[] favorites, AggregatedNewsFeed newsFeed)
           Adds a tab that displays the specified AggregatedNewsFeed and is bound to the specified Favorites.
 void addTab(NewsFeed newsFeed)
           Adds a new tab that displays the specified NewsFeed.
 void addTab(Watch watch)
           Adds a tab that displays the specified Watch.
private  void createNewsFeedTab(Favorite favorite)
           Creates a new tab that displays the NewsFeed held by the specified Favorite.
private  void createNewsFeedTab(Favorite[] favorites, AggregatedNewsFeed newsFeed)
           Creates a new tab that displays the specified AggregatedNewsFeed bound to the specified Favorites.
private  void createNewsFeedTab(NewsFeed newsFeed)
           Creates a new tab that displays the specified NewsFeed.
private  void createNewsFeedTab(Watch watch)
           Creates a new tab that displays the specified Watch.
 void dispose(CTabItem item)
           Disposes the specified CTabItem.
 CTabItem[] getBrowserTabs()
           Gets all tabs that display a web page in an InternalBrowser component.
(package private)  CTabItem getFilterTab()
           Gets the filter tab managed by this TabManager.
 CTabItem[] getNewsFeedTabs()
           Gets all tabs that display a NewsFeed.
 CTabItem getTab(AggregatedNewsFeed newsFeed)
           Gets the CTabItem that displays the specified AggregatedNewsFeed.
 CTabItem getTab(NewsFeed newsFeed)
           Gets the CTabItem that displays the specified NewsFeed.
 CTabItem getTab(Watch watch)
           Gets the CTabItem that displays the specified Watch.
 AggregatedNewsFeed isAggregated(NewsFeed newsFeed)
           Tests if the specified NewsFeed is aggregated in an AggregatedNewsFeed displayed in any aggregated newsfeed tab.
 boolean isOpen(AggregatedNewsFeed newsFeed)
           Verifies if the specified AggregatedNewsFeed is open in an aggregated newsfeed tab.
 boolean isOpen(NewsFeed newsFeed)
           Verifies if the specified NewsFeed is open in a plain newsfeed tab.
 boolean isOpen(Watch watch)
           Verifies if the specified Watch is open in a tab.
private  void refreshFilterTab()
           Refreshes the filter tab with the news from a previously added tab.
 void synchronizeFilterTab()
           Synchronizes the filter tab to show only news items from open news tabs.
 void updateAggregations(NewsFeed updatedNewsFeed)
           Updates all open aggregated newsfeed tabs to the updated version of the specified NewsFeed.
 void updateFilterTab(Favorite[] favorites, NewsFeed filteredFeed)
           Updates the filter tab with the specified filteredFeed.
private  void updateNewsFeedTab(AggregatedNewsFeed newsFeed)
           Updates a tab to the specified AggregatedNewsFeed.
private  void updateNewsFeedTab(Favorite favorite)
           Updates a tab to the NewsFeed held by the specified Favorite.
private  void updateNewsFeedTab(NewsFeed newsFeed)
           Updates a tab to the specified NewsFeed.
private  void updateNewsFeedTab(Watch watch)
           Updates a tab to the NewsFeed held by the specified Watch.
 void updateTabReadStates()
           Updates the tab read status of all newsfeed tabs and the filter tab if it is currently visible.
 void updateTabReadStatus(CTabItem item)
           Updates the tab read status of the specified CTabItem.
 void updateWatches(NewsFeed updatedNewsFeed)
           Updates all open Watch tabs to the updated version of the specified NewsFeed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mainWindow

private MainApplicationWindow mainWindow

The Feed'n Read main window


tabBar

private NewsFeedTabBar tabBar

The NewsFeedTabBar component managed


tabFolder

private CTabFolder tabFolder

The managed CTabFolder component


filterTab

private CTabItem filterTab

The special tab to hold filtered news


plainNewsFeedTabs

private Map plainNewsFeedTabs

Structure to store plain newsfeed tabs


aggregatedNewsFeedTabs

private Map aggregatedNewsFeedTabs

Structure to store aggregated newsfeed tabs


watchTabs

private Map watchTabs

Structure to store Watch tabs

Constructor Detail

TabManager

public TabManager(MainApplicationWindow mainWindow,
                  NewsFeedTabBar tabBar)

Creates a new TabManager.

Parameters:
mainWindow - the Feed'n Read main window
Method Detail

addTab

public void addTab(NewsFeed newsFeed)

Adds a new tab that displays the specified NewsFeed. If a tab is yet open for the specified NewsFeed it is then updated and focussed.

Parameters:
newsFeed - the NewsFeed to create or update a tab for

addTab

public void addTab(Favorite favorite)

Adds a new tab that displays the NewsFeed held by the specified Favorite. If a tab is yet open for the NewsFeed held by the specified Favorite it is then updated and focussed.

Parameters:
favorite - the Favorite for which to create or update a tab

addTab

public void addTab(Favorite[] favorites,
                   AggregatedNewsFeed newsFeed)

Adds a tab that displays the specified AggregatedNewsFeed and is bound to the specified Favorites. If a tab is yet open for the AggregatedNewsFeed it is then updated and focussed.

Parameters:
favorites - the Favorites to bind to the tab to create
newsFeed - the AggregatedNewsFeed to create or update a tab for

addTab

public void addTab(Watch watch)

Adds a tab that displays the specified Watch. If a tab is yet open for the Watch it is then updated and focussed.

Parameters:
watch - the Watchs to bind to the tab to create

addBrowserTab

public void addBrowserTab(String url)

Adds a new tab showing a browser page refering to the specified url.

Parameters:
url - the url to open in a new browser tab

addMessageTab

public void addMessageTab(String title,
                          Throwable throwable)

Adds a new tab showing an error message using the specified Throwable.

Parameters:
title - the title of the message tab
throwable - the Throwable raised

updateFilterTab

public void updateFilterTab(Favorite[] favorites,
                            NewsFeed filteredFeed)

Updates the filter tab with the specified filteredFeed. If no filtering has been done yet the filter tab is created lazily.

Parameters:
filteredFeed - the NewsFeed holding all filtered news

updateAggregations

public void updateAggregations(NewsFeed updatedNewsFeed)

Updates all open aggregated newsfeed tabs to the updated version of the specified NewsFeed. Those which do not hold the specified NewsFeed are omited.

Parameters:
updatedNewsFeed - the updated version of the NewsFeed

updateWatches

public void updateWatches(NewsFeed updatedNewsFeed)

Updates all open Watch tabs to the updated version of the specified NewsFeed. Those which do not hold the specified NewsFeed are omited.

Parameters:
updatedNewsFeed - the updated version of the NewsFeed

isOpen

public boolean isOpen(NewsFeed newsFeed)

Verifies if the specified NewsFeed is open in a plain newsfeed tab.

Parameters:
newsFeed - the NewsFeed to verify
Returns:
true if the specified NewsFeed is open in a plain newsfeed tab; false otherwise
See Also:
isOpen(AggregatedNewsFeed), isOpen(Watch)

isOpen

public boolean isOpen(AggregatedNewsFeed newsFeed)

Verifies if the specified AggregatedNewsFeed is open in an aggregated newsfeed tab.

Parameters:
newsFeed - the AggregatedNewsFeed to verify
Returns:
true if the specified AggregatedNewsFeed is open in an aggregated newsfeed tab; false otherwise
See Also:
isOpen(NewsFeed), isOpen(Watch)

isOpen

public boolean isOpen(Watch watch)

Verifies if the specified Watch is open in a tab.

Parameters:
watch - the Watch to verify
Returns:
true if the specified Watch is open in a tab; false otherwise
See Also:
isOpen(NewsFeed), isOpen(AggregatedNewsFeed)

isAggregated

public AggregatedNewsFeed isAggregated(NewsFeed newsFeed)

Tests if the specified NewsFeed is aggregated in an AggregatedNewsFeed displayed in any aggregated newsfeed tab.

Parameters:
newsFeed - the NewsFeed to test
Returns:
the AggregatedNewsFeed which holds the specified NewsFeed; null if the specified NewsFeed is not aggregated

getTab

public CTabItem getTab(NewsFeed newsFeed)

Gets the CTabItem that displays the specified NewsFeed.

Parameters:
newsFeed - the NewsFeed to get the displaying CTabItem for
Returns:
the CTabItem that displays the specified NewsFeed
See Also:
getTab(AggregatedNewsFeed), getTab(Watch)

getTab

public CTabItem getTab(AggregatedNewsFeed newsFeed)

Gets the CTabItem that displays the specified AggregatedNewsFeed.

Parameters:
newsFeed - the AggregatedNewsFeed to get the displaying CTabItem for
Returns:
the CTabItem that displays the specified AggregatedNewsFeed
See Also:
getTab(NewsFeed), getTab(Watch)

getTab

public CTabItem getTab(Watch watch)

Gets the CTabItem that displays the specified Watch.

Parameters:
watch - the Watch to get the displaying CTabItem for
Returns:
the CTabItem that displays the specified Watch
See Also:
getTab(NewsFeed), getTab(AggregatedNewsFeed)

synchronizeFilterTab

public void synchronizeFilterTab()

Synchronizes the filter tab to show only news items from open news tabs. Call this method whenever a newsfeed tab is closed.


updateTabReadStatus

public void updateTabReadStatus(CTabItem item)

Updates the tab read status of the specified CTabItem.

Parameters:
item - the CTabItem to update the read status for

updateTabReadStates

public void updateTabReadStates()

Updates the tab read status of all newsfeed tabs and the filter tab if it is currently visible.


getNewsFeedTabs

public CTabItem[] getNewsFeedTabs()

Gets all tabs that display a NewsFeed.

Returns:
all tabs that display a NewsFeed

getBrowserTabs

public CTabItem[] getBrowserTabs()

Gets all tabs that display a web page in an InternalBrowser component.

Returns:
all tabs that display a web page in an InternalBrowser component

dispose

public void dispose(CTabItem item)

Disposes the specified CTabItem. This includes the disposal of the embedded Control and the removal of the related TabItemData object.

Parameters:
item - the CTabItem to dispose of

createNewsFeedTab

private void createNewsFeedTab(NewsFeed newsFeed)

Creates a new tab that displays the specified NewsFeed.

Parameters:
newsFeed - the NewsFeed to create a tab for

createNewsFeedTab

private void createNewsFeedTab(Favorite favorite)

Creates a new tab that displays the NewsFeed held by the specified Favorite.

Parameters:
favorite - the Favorite to create a tab for

createNewsFeedTab

private void createNewsFeedTab(Favorite[] favorites,
                               AggregatedNewsFeed newsFeed)

Creates a new tab that displays the specified AggregatedNewsFeed bound to the specified Favorites.

Parameters:
favorites - the Favorites to bind the tab to
newsFeed - the AggregatedNewsFeed to display in the tab

createNewsFeedTab

private void createNewsFeedTab(Watch watch)

Creates a new tab that displays the specified Watch.

Parameters:
watch - the Watchs to bind the tab to

updateNewsFeedTab

private void updateNewsFeedTab(NewsFeed newsFeed)

Updates a tab to the specified NewsFeed.

Parameters:
newsFeed - the updated version of the NewsFeed to display in the tab

updateNewsFeedTab

private void updateNewsFeedTab(Favorite favorite)

Updates a tab to the NewsFeed held by the specified Favorite.

Parameters:
favorite - the Favorite which holds the updated version of the NewsFeed to display in the tab

updateNewsFeedTab

private void updateNewsFeedTab(AggregatedNewsFeed newsFeed)

Updates a tab to the specified AggregatedNewsFeed.

Parameters:
newsFeed - the updated version of the AggregatedNewsFeed to display in the tab

updateNewsFeedTab

private void updateNewsFeedTab(Watch watch)

Updates a tab to the NewsFeed held by the specified Watch.

Parameters:
watch - the Watch which holds the updated version of the NewsFeed to display in the tab

refreshFilterTab

private void refreshFilterTab()

Refreshes the filter tab with the news from a previously added tab.


getFilterTab

CTabItem getFilterTab()

Gets the filter tab managed by this TabManager.

Returns:
the used filter tab