net.sourceforge.rssowl.controller
Class NewsTabFolder

java.lang.Object
  extended bynet.sourceforge.rssowl.controller.NewsTabFolder
All Implemented Interfaces:
IFontChangeable, ITranslatable

public class NewsTabFolder
extends Object
implements ITranslatable, IFontChangeable

This is the TabFolder that holds the opened feeds displaying a table with all news header and some informations about the channel.

Version:
1.1.3
Author:
Benjamin Pasero

Field Summary
private  org.eclipse.swt.widgets.MenuItem close
           
private  org.eclipse.swt.widgets.MenuItem closeAll
           
(package private)  org.eclipse.swt.widgets.MenuItem closeAllKeepCurrent
           
(package private)  org.eclipse.swt.widgets.MenuItem closeAllKeepFeeds
           
(package private)  org.eclipse.swt.custom.SashForm contentPane
           
private  org.eclipse.swt.widgets.Display display
           
static int DISPLAY_MODE_FOCUS
          Display Mode: Focus Feed
static int DISPLAY_MODE_FOCUS_FIRST
          Display Mode: Focus Feed that is on Tabposition 1
static int DISPLAY_MODE_NO_FOCUS
          Display Mode: Do not Focus Feed
(package private)  EventManager eventManager
           
private  Vector lastOpenedFeeds
           
private  int lastTabState
           
private static int MAX_TAB_TITLE_LENGTH
          Maximum number of chars for a TabItem Title
(package private)  boolean mouseInTab
           
(package private)  org.eclipse.swt.custom.CTabFolder newsHeaderTabFolder
           
private  org.eclipse.swt.widgets.Composite newsHeaderTabFolderHolder
           
(package private)  ViewForm newsHeaderViewForm
           
(package private)  GUI rssOwlGui
           
private  NewsTabFolderDND rssOwlNewsTabFolderDND
           
(package private)  org.eclipse.swt.widgets.Shell shell
           
private static int TAB_STATE_BROWSER
          Tab State: Displaying a browser
private static int TAB_STATE_EMPTY
          Tab State: TabFolder empty
private static int TAB_STATE_ERROR
          Tab State: Displaying an error
private static int TAB_STATE_FEED
          Tab State: Displaying a feed
private static int TAB_STATE_MESSAGE
          Tab State: Displaying a message
(package private)  org.eclipse.swt.widgets.Menu tabFolderMenu
           
(package private)  org.eclipse.swt.widgets.MenuItem tabPositionBottom
           
private  org.eclipse.swt.widgets.MenuItem tabPositionMenu
           
(package private)  org.eclipse.swt.widgets.MenuItem tabPositionTop
           
 
Constructor Summary
NewsTabFolder(org.eclipse.swt.widgets.Display display, org.eclipse.swt.widgets.Shell shell, org.eclipse.swt.custom.SashForm contentPane, GUI rssOwlGui, EventManager eventManager)
          Instantiate a new NewsTabFolder holding the opened news feeds and the news header.
 
Method Summary
 void addFeedToLastOpened(String url)
          Add the URL of a feed to the list of feeds that RSSOwl shall open after restart.
(package private)  void announceTabFolderState(TabItemData data, int state)
          Announce the state of the TabFolder.
(package private)  void closeAll()
          Close all opened tabs
(package private)  void closeAll(boolean keepCurrent, boolean keepFeeds)
          Close all tabs but keep newsfeeds
(package private)  void closeCurrent()
          Close current opened tab
 void closeTab(org.eclipse.swt.custom.CTabItem tabItem)
          Close the given tabItem
 org.eclipse.swt.browser.Browser createBrowserPopupTab()
          Create a new Tab for a popup.
(package private)  void createBrowserTab(org.eclipse.swt.custom.CTabItem tabItem, String url)
          Create the browser in the given Tab and open the given URL.
 void displayBrowserTab(String url)
          Display a new browser tab in the tabfolder
 void displayNewsfeed(Channel rssChannel, String url, String searchPattern, boolean reselectNews, int displayMode)
          Display the selected newsfeed in the TabFolder
(package private)  void exportToDocument(File targetFile, int format, String newsTitle)
          Export the selected RSS feed to PDF / RTF or HTML into the given targetFile.
(package private)  void exportToDocument(int format, String newsTitle)
          Export the selected RSS feed to PDF / RTF or HTML.
 boolean focusTab()
          Check wether new tabs should get focus.
(package private)  Channel getChannel(org.eclipse.swt.custom.CTabItem tabItem)
          Get Channel from the given Tab
 org.eclipse.swt.custom.CTabItem getFeedTabItem(String title)
          Get the tabitem showing the given Feed or NULL.
 Vector getLastOpenedFeeds()
          Get the Vector with the last opened newsfeeds.
 org.eclipse.swt.custom.CTabFolder getNewsHeaderTabFolder()
          Let other objects access this controll (for example to focus on it)
 NewsTabFolderDND getRSSOwlNewsTabFolderDND()
          Get the DND class that allows drag and drop on this tabfolder
 Channel getSelectedChannel()
          Get Channel from the selected Tab
(package private)  NewsItem getSelectedNewsItem()
          Get the selected newsitem
(package private)  NewsItem getSelectedNewsItem(String newsTitle)
          Get the selected newsitem from the given title
 org.eclipse.swt.custom.CTabItem getTabItem(Category aggregatedCategory)
          Get the tabitem for the given category or NULL.
(package private)  void gotoNextTab()
          Goto next tab
(package private)  void gotoPreviousTab()
          Goto previous tab
private  void initComponents()
          Init all components
private  void initTabFolderPopup()
          Init the Popupmenu on the TabFolder
 boolean isAggregationOpened(String title)
          Check if a tab with the given title of the Aggregation is opened in the tabfolder.
(package private)  boolean isNoFeedOpen()
          Check if no Feed is currently opened in the TabFolder.
(package private)  boolean isOnlyFeedsOpen()
          Check if only Feeds are currently opened in the TabFolder.
 void loadURLInTab(String url)
          Load a URL in a new TabItem.
(package private)  void onMaximize()
          Called whenever the CTabFolder becomes maximized.
(package private)  void onMouseDoubleClick(org.eclipse.swt.events.MouseEvent e)
          Called whenever the tabfolder is doubleclicked
(package private)  void onRestore()
          Called whenever the CTabFolder becomes restored.
 void reloadFeed()
          Reload the feed in the selected tab
(package private)  void reloadFeed(org.eclipse.swt.custom.CTabItem anItem)
          Reload the given feed
 void searchInSelectedFeed()
          Open search dialog and perform search on the selected tab
 void searchInSelectedFeed(String searchFor, boolean reselectNews)
          Search in visible Tab for the given String
(package private)  void setMaximized(boolean maximize)
          Maximize the Newsheader Tabfolder if maximized is TRUE, otherwise restore the normal state.
 void showErrorTab(org.eclipse.swt.custom.CTabItem tabItem, NewsfeedFactoryException e)
          Display an error as a new tab in the tab folder
 void showErrorTab(String url, NewsfeedFactoryException e)
          Display an warning as a new tab in the tab folder
 void showLicenseTab(InputStream inS, org.eclipse.swt.graphics.Image icon)
          Display the License in a new tab
(package private)  void showMessageTab(String message, String title, org.eclipse.swt.graphics.Image icon)
          Display a message in a new tab
 void showUpdateAvailableTab(String title, String message)
          Show information about new RSSOwl version in th UpdatePanel.
(package private)  void showWelcomeTab()
          Show the Welcome Tab
 void updateFonts()
          All implementing classes must provide a method to update the fonts of all GUI elements that provide a setFont() Method.
 void updateI18N()
          Update all controlls text with i18n
 void updateLastOpenedFeeds()
          This method updates the lastOpenedFeeds Vector.
 void updateTabFolderState()
          Update the state of the TabFolder and tell the MenuManager.
 void updateTabItemStatus(org.eclipse.swt.custom.CTabItem tabItem)
          Update the state of the given TabItem to reflect wether unread news are available in the Channel that is displayed.
(package private)  void updateViewFormBorder()
          Update state of 3D Border outside the ViewForm if neccessary
(package private)  void viewNewsInDocument(int format)
          View the current opened feed as PDF / RTF or HTML document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DISPLAY_MODE_FOCUS

public static final int DISPLAY_MODE_FOCUS
Display Mode: Focus Feed

See Also:
Constant Field Values

DISPLAY_MODE_FOCUS_FIRST

public static final int DISPLAY_MODE_FOCUS_FIRST
Display Mode: Focus Feed that is on Tabposition 1

See Also:
Constant Field Values

DISPLAY_MODE_NO_FOCUS

public static final int DISPLAY_MODE_NO_FOCUS
Display Mode: Do not Focus Feed

See Also:
Constant Field Values

MAX_TAB_TITLE_LENGTH

private static final int MAX_TAB_TITLE_LENGTH
Maximum number of chars for a TabItem Title

See Also:
Constant Field Values

TAB_STATE_BROWSER

private static final int TAB_STATE_BROWSER
Tab State: Displaying a browser

See Also:
Constant Field Values

TAB_STATE_EMPTY

private static final int TAB_STATE_EMPTY
Tab State: TabFolder empty

See Also:
Constant Field Values

TAB_STATE_ERROR

private static final int TAB_STATE_ERROR
Tab State: Displaying an error

See Also:
Constant Field Values

TAB_STATE_FEED

private static final int TAB_STATE_FEED
Tab State: Displaying a feed

See Also:
Constant Field Values

TAB_STATE_MESSAGE

private static final int TAB_STATE_MESSAGE
Tab State: Displaying a message

See Also:
Constant Field Values

close

private org.eclipse.swt.widgets.MenuItem close

closeAll

private org.eclipse.swt.widgets.MenuItem closeAll

display

private org.eclipse.swt.widgets.Display display

lastOpenedFeeds

private Vector lastOpenedFeeds

lastTabState

private int lastTabState

newsHeaderTabFolderHolder

private org.eclipse.swt.widgets.Composite newsHeaderTabFolderHolder

rssOwlNewsTabFolderDND

private NewsTabFolderDND rssOwlNewsTabFolderDND

tabPositionMenu

private org.eclipse.swt.widgets.MenuItem tabPositionMenu

closeAllKeepCurrent

org.eclipse.swt.widgets.MenuItem closeAllKeepCurrent

closeAllKeepFeeds

org.eclipse.swt.widgets.MenuItem closeAllKeepFeeds

contentPane

org.eclipse.swt.custom.SashForm contentPane

eventManager

EventManager eventManager

mouseInTab

boolean mouseInTab

newsHeaderTabFolder

org.eclipse.swt.custom.CTabFolder newsHeaderTabFolder

newsHeaderViewForm

ViewForm newsHeaderViewForm

rssOwlGui

GUI rssOwlGui

shell

org.eclipse.swt.widgets.Shell shell

tabFolderMenu

org.eclipse.swt.widgets.Menu tabFolderMenu

tabPositionBottom

org.eclipse.swt.widgets.MenuItem tabPositionBottom

tabPositionTop

org.eclipse.swt.widgets.MenuItem tabPositionTop
Constructor Detail

NewsTabFolder

public NewsTabFolder(org.eclipse.swt.widgets.Display display,
                     org.eclipse.swt.widgets.Shell shell,
                     org.eclipse.swt.custom.SashForm contentPane,
                     GUI rssOwlGui,
                     EventManager eventManager)
Instantiate a new NewsTabFolder holding the opened news feeds and the news header.

Parameters:
display - The display
shell - The shell
contentPane - The Sashform where to add the ViewForm
rssOwlGui - Access some methods of the main controller
eventManager - The event manager
Method Detail

addFeedToLastOpened

public void addFeedToLastOpened(String url)
Add the URL of a feed to the list of feeds that RSSOwl shall open after restart.

Parameters:
url - The URL of the feed

closeTab

public void closeTab(org.eclipse.swt.custom.CTabItem tabItem)
Close the given tabItem

Parameters:
tabItem - Selected tabItem

createBrowserPopupTab

public org.eclipse.swt.browser.Browser createBrowserPopupTab()
Create a new Tab for a popup. This method is ONLY called from another internal browser, when either the user has clicked on a link that uses "target=_blank" or a JS popup.

Returns:
Browser The new browser instance that will display the popup

displayBrowserTab

public void displayBrowserTab(String url)
Display a new browser tab in the tabfolder

Parameters:
url - URL of the website to display

displayNewsfeed

public void displayNewsfeed(Channel rssChannel,
                            String url,
                            String searchPattern,
                            boolean reselectNews,
                            int displayMode)
Display the selected newsfeed in the TabFolder

Parameters:
rssChannel - The newsfeed to display
url - URL / Path to the RSS XML
searchPattern - Optional pattern for a search
reselectNews - Wether to reselect an already selected news
displayMode - One of the supported displaymodes

focusTab

public boolean focusTab()
Check wether new tabs should get focus. Either the settings tells so, or only one tabitem is visible in the tabfolder. That item will always get focus.

Returns:
boolean TRUE if the new tab should gain focus

getFeedTabItem

public org.eclipse.swt.custom.CTabItem getFeedTabItem(String title)
Get the tabitem showing the given Feed or NULL.

Parameters:
title - The title of the Feed
Returns:
CTabItem The Tab or NULL

getLastOpenedFeeds

public Vector getLastOpenedFeeds()
Get the Vector with the last opened newsfeeds.

Returns:
Returns the lastOpenedFeeds.

getNewsHeaderTabFolder

public org.eclipse.swt.custom.CTabFolder getNewsHeaderTabFolder()
Let other objects access this controll (for example to focus on it)

Returns:
The tabfolder holding the feeds and news header

getRSSOwlNewsTabFolderDND

public NewsTabFolderDND getRSSOwlNewsTabFolderDND()
Get the DND class that allows drag and drop on this tabfolder

Returns:
RSSOwlTabFolderDND The dnd class of this tabfolder

getSelectedChannel

public Channel getSelectedChannel()
Get Channel from the selected Tab

Returns:
Channel The Channel displayed in the tab

getTabItem

public org.eclipse.swt.custom.CTabItem getTabItem(Category aggregatedCategory)
Get the tabitem for the given category or NULL.

Parameters:
aggregatedCategory - The category that is aggregated
Returns:
CTabItem The Tab or NULL

isAggregationOpened

public boolean isAggregationOpened(String title)
Check if a tab with the given title of the Aggregation is opened in the tabfolder.

Parameters:
title - The title of the Aggregation to look for
Returns:
boolean TRUE if the tab is opened

loadURLInTab

public void loadURLInTab(String url)
Load a URL in a new TabItem.

Parameters:
url - URL of the News

reloadFeed

public void reloadFeed()
Reload the feed in the selected tab


searchInSelectedFeed

public void searchInSelectedFeed()
Open search dialog and perform search on the selected tab


searchInSelectedFeed

public void searchInSelectedFeed(String searchFor,
                                 boolean reselectNews)
Search in visible Tab for the given String

Parameters:
searchFor - The String to search for
reselectNews - Wether to reselect a selected news

showErrorTab

public void showErrorTab(org.eclipse.swt.custom.CTabItem tabItem,
                         NewsfeedFactoryException e)
Display an error as a new tab in the tab folder

Parameters:
tabItem - The tabitem to load the error into
e - The exception that occured

showErrorTab

public void showErrorTab(String url,
                         NewsfeedFactoryException e)
Display an warning as a new tab in the tab folder

Parameters:
url - URL / Path that caused the exception
e - The exception that occured

showLicenseTab

public void showLicenseTab(InputStream inS,
                           org.eclipse.swt.graphics.Image icon)
Display the License in a new tab

Parameters:
inS - Source of the license file
icon - The icon to use for the tab

showUpdateAvailableTab

public void showUpdateAvailableTab(String title,
                                   String message)
Show information about new RSSOwl version in th UpdatePanel. It offers a link to download new version and shows its changelog.

Parameters:
title - Title of the TabItem
message - Message containing the Changelog

updateFonts

public void updateFonts()
Description copied from interface: IFontChangeable
All implementing classes must provide a method to update the fonts of all GUI elements that provide a setFont() Method.

Specified by:
updateFonts in interface IFontChangeable
See Also:
IFontChangeable.updateFonts()

updateI18N

public void updateI18N()
Update all controlls text with i18n

Specified by:
updateI18N in interface ITranslatable

updateLastOpenedFeeds

public void updateLastOpenedFeeds()
This method updates the lastOpenedFeeds Vector.


updateTabFolderState

public void updateTabFolderState()
Update the state of the TabFolder and tell the MenuManager. This method is called whenever the selection in the tabfolder changes, for example when a new tab is opened or another one was closed, revealing the tab that is left of it.


updateTabItemStatus

public void updateTabItemStatus(org.eclipse.swt.custom.CTabItem tabItem)
Update the state of the given TabItem to reflect wether unread news are available in the Channel that is displayed.

Parameters:
tabItem - The TabItem to update the status

initComponents

private void initComponents()
Init all components


initTabFolderPopup

private void initTabFolderPopup()
Init the Popupmenu on the TabFolder


announceTabFolderState

void announceTabFolderState(TabItemData data,
                            int state)
Announce the state of the TabFolder. Possible states are an empty tabfolder or a tab displaying a message, error, browser or newsfeed.

Parameters:
data - The TabItemData model object
state - One of the five states of the TabFolder

closeAll

void closeAll()
Close all opened tabs


closeAll

void closeAll(boolean keepCurrent,
              boolean keepFeeds)
Close all tabs but keep newsfeeds

Parameters:
keepCurrent - TRUE if the current tab should remain opened
keepFeeds - TRUE if newsfeeds should remain opened

closeCurrent

void closeCurrent()
Close current opened tab


createBrowserTab

void createBrowserTab(org.eclipse.swt.custom.CTabItem tabItem,
                      String url)
Create the browser in the given Tab and open the given URL.

Parameters:
tabItem - The TabItem to add the browser
url - The URL to open

exportToDocument

void exportToDocument(File targetFile,
                      int format,
                      String newsTitle)
Export the selected RSS feed to PDF / RTF or HTML into the given targetFile.

Parameters:
targetFile - The target file to export the news into
format - PDF, RTF or HTML
newsTitle - If given, just export one newsitem

exportToDocument

void exportToDocument(int format,
                      String newsTitle)
Export the selected RSS feed to PDF / RTF or HTML. Ask the filepath from the user and suggest a filename.

Parameters:
format - PDF, RTF or HTML
newsTitle - If given, just export one newsitem

getChannel

Channel getChannel(org.eclipse.swt.custom.CTabItem tabItem)
Get Channel from the given Tab

Parameters:
tabItem - The TabItem to get the Channel from
Returns:
Channel The Channel displayed in the tab

getSelectedNewsItem

NewsItem getSelectedNewsItem()
Get the selected newsitem

Returns:
NewsItem The selected newsitem

getSelectedNewsItem

NewsItem getSelectedNewsItem(String newsTitle)
Get the selected newsitem from the given title

Parameters:
newsTitle - Title of the selected news
Returns:
NewsItem The newsitem for that title

gotoNextTab

void gotoNextTab()
Goto next tab


gotoPreviousTab

void gotoPreviousTab()
Goto previous tab


isNoFeedOpen

boolean isNoFeedOpen()
Check if no Feed is currently opened in the TabFolder.

Returns:
TRUE if no Feed is open.

isOnlyFeedsOpen

boolean isOnlyFeedsOpen()
Check if only Feeds are currently opened in the TabFolder.

Returns:
TRUE if only Feeds are open.

onMaximize

void onMaximize()
Called whenever the CTabFolder becomes maximized.


onMouseDoubleClick

void onMouseDoubleClick(org.eclipse.swt.events.MouseEvent e)
Called whenever the tabfolder is doubleclicked

Parameters:
e - The occuring MouseEvent

onRestore

void onRestore()
Called whenever the CTabFolder becomes restored.


reloadFeed

void reloadFeed(org.eclipse.swt.custom.CTabItem anItem)
Reload the given feed

Parameters:
anItem - the feed to reload

setMaximized

void setMaximized(boolean maximize)
Maximize the Newsheader Tabfolder if maximized is TRUE, otherwise restore the normal state.

Parameters:
maximize - TRUE if maximized

showMessageTab

void showMessageTab(String message,
                    String title,
                    org.eclipse.swt.graphics.Image icon)
Display a message in a new tab

Parameters:
message - Message String
title - Title String
icon - The image icon to display

showWelcomeTab

void showWelcomeTab()
Show the Welcome Tab


updateViewFormBorder

void updateViewFormBorder()
Update state of 3D Border outside the ViewForm if neccessary


viewNewsInDocument

void viewNewsInDocument(int format)
View the current opened feed as PDF / RTF or HTML document. This method will launch the associated progra to the given document format. The document is created using a temp file, that is deleted after exit.

Parameters:
format - PDF, RTF or HTML


RSSOwl - RSS / RDF / Atom Newsreader

SourceForge.net Logo