net.sourceforge.rssowl.controller
Class NewsText

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

public class NewsText
extends Object
implements ITranslatable, IFontChangeable

This is the ViewForm where a newsitem is displayed with Title, URL to the news and the description.

Version:
1.1.3
Author:
Benjamin Pasero

Field Summary
private  BrowserPanel browserPanel
           
private  org.eclipse.swt.custom.SashForm contentSash
           
(package private)  org.eclipse.swt.widgets.MenuItem copyItem
           
private  org.eclipse.swt.widgets.MenuItem copyItemUrl
           
private  org.eclipse.swt.widgets.Composite descriptionHolder
           
(package private)  org.eclipse.swt.widgets.Display display
           
(package private)  EventManager eventManager
           
(package private)  boolean isReset
           
private  boolean isShowingNews
           
(package private)  int lastRate
           
private  org.eclipse.swt.widgets.Menu linkMenu
           
private  org.eclipse.swt.widgets.Composite newsContentHolder
           
private  ViewForm newsContentViewForm
           
private  org.eclipse.swt.widgets.Composite newsContentViewFormHeader
           
(package private)  org.eclipse.swt.custom.StyledText newsText
           
private  org.eclipse.swt.widgets.Composite newsTextHolder
           
(package private)  org.eclipse.swt.widgets.Menu newsTextMenu
           
(package private)  org.eclipse.swt.custom.StyledText newsTextTitle
           
(package private)  org.eclipse.swt.widgets.ToolBar newsTextToolBar
           
(package private)  org.eclipse.ui.forms.widgets.Hyperlink newsTextUrl
           
private  org.eclipse.swt.widgets.MenuItem openExternalItem
           
(package private)  org.eclipse.swt.widgets.MenuItem openInBrowserItem
           
private  org.eclipse.swt.widgets.MenuItem printNews
           
private  org.eclipse.swt.widgets.MenuItem rateBad
           
(package private)  org.eclipse.swt.widgets.Composite rateComposite
           
(package private)  org.eclipse.swt.widgets.Menu rateDropdown
           
private  org.eclipse.swt.widgets.MenuItem rateFantastic
           
private  org.eclipse.swt.widgets.MenuItem rateGood
           
private  org.eclipse.swt.widgets.MenuItem rateModerate
           
(package private)  org.eclipse.swt.widgets.ToolItem rateToolItem
           
private  org.eclipse.swt.widgets.MenuItem rateVeryBad
           
private  boolean requiresUpdate
           
(package private)  NewsItem rssNewsItem
           
(package private)  GUI rssOwlGui
           
private  org.eclipse.swt.widgets.MenuItem selectAllItem
           
(package private)  org.eclipse.swt.widgets.Shell shell
           
(package private)  org.eclipse.swt.widgets.Composite urlTitleHolder
           
private  org.eclipse.swt.widgets.MenuItem useBrowserForNewsText
           
(package private)  int x
           
(package private)  int y
           
 
Constructor Summary
NewsText(org.eclipse.swt.widgets.Display display, org.eclipse.swt.widgets.Shell shell, org.eclipse.swt.custom.SashForm contentSash, GUI rssOwlGui, EventManager eventManager)
          Instantiate a new NewsText to display a newsitem
 
Method Summary
(package private)  void checkWord(org.eclipse.swt.custom.StyledText text)
          Get the word from the position where the mouse is and check if the word is an URL.
(package private)  void clearNewstext()
          Empty the newstext viewform
private  void createBrowserPanel(boolean onStartup)
          Create the browser panel to display newstext in the internal browser
private  void createStyledText()
          Create the StyledText to display the newstext.
private  void displayNews(NewsItem rssNewsItem)
          Display news in the ViewForm
(package private)  void displayNews(String urlOrTitle, String newsTitle)
          Display the selected news in the newstext-viewform
private  void displayNewsInBrowser()
          Display the selected news in the internal browser.
private  void displayNewsInStyledText()
          Display selected news in a StyledText
private  void displayNewsLinkInBrowser(String link)
          Display the Link of the News using the internal browser.
private  void displayNewsMetaInfo()
          Display Title and link of the news
 BrowserPanel getBrowserPanel()
          Get the BrowserPanel of the Newstext panel in case internal browser view is activated for newstext
 org.eclipse.swt.custom.StyledText getNewsTextTitle()
          Let other objects access this controll (for example to focus on it)
 String getPrintableNewstext()
          Get the currently viewed newsitem's text to print.
private  void initComponents()
          Init all the components
private  boolean isShowingNews(NewsItem newsItem)
          Check if the given NewsItem is currently being displayed
(package private)  void onMouseMove(org.eclipse.swt.events.MouseEvent e)
          Called whenever the mouse is moving
(package private)  void onMouseUp(org.eclipse.swt.events.MouseEvent e)
          Called whenever the mouse button was released
(package private)  void rateNews(NewsItem rssNewsItem, int rateLevel)
          Rate selected news
private  void rebuildNewsText()
          Rebuild the newstext area
 void setRequiresUpdate()
          Explicitly marks the newstext as required to update.
private  void updateAccelerators()
          Update the accelerators on the menuitems
 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 updateLinkColor()
          Update color of Link Label
(package private)  void updateNewsTextComposite()
          Update the newstext composite to either show Internal Browser or StyledText for the newstext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

browserPanel

private BrowserPanel browserPanel

contentSash

private org.eclipse.swt.custom.SashForm contentSash

copyItemUrl

private org.eclipse.swt.widgets.MenuItem copyItemUrl

descriptionHolder

private org.eclipse.swt.widgets.Composite descriptionHolder

isShowingNews

private boolean isShowingNews

linkMenu

private org.eclipse.swt.widgets.Menu linkMenu

newsContentHolder

private org.eclipse.swt.widgets.Composite newsContentHolder

newsContentViewForm

private ViewForm newsContentViewForm

newsContentViewFormHeader

private org.eclipse.swt.widgets.Composite newsContentViewFormHeader

newsTextHolder

private org.eclipse.swt.widgets.Composite newsTextHolder

openExternalItem

private org.eclipse.swt.widgets.MenuItem openExternalItem

printNews

private org.eclipse.swt.widgets.MenuItem printNews

rateBad

private org.eclipse.swt.widgets.MenuItem rateBad

rateFantastic

private org.eclipse.swt.widgets.MenuItem rateFantastic

rateGood

private org.eclipse.swt.widgets.MenuItem rateGood

rateModerate

private org.eclipse.swt.widgets.MenuItem rateModerate

rateVeryBad

private org.eclipse.swt.widgets.MenuItem rateVeryBad

requiresUpdate

private boolean requiresUpdate

selectAllItem

private org.eclipse.swt.widgets.MenuItem selectAllItem

useBrowserForNewsText

private org.eclipse.swt.widgets.MenuItem useBrowserForNewsText

copyItem

org.eclipse.swt.widgets.MenuItem copyItem

display

org.eclipse.swt.widgets.Display display

eventManager

EventManager eventManager

isReset

boolean isReset

lastRate

int lastRate

newsText

org.eclipse.swt.custom.StyledText newsText

newsTextMenu

org.eclipse.swt.widgets.Menu newsTextMenu

newsTextTitle

org.eclipse.swt.custom.StyledText newsTextTitle

newsTextToolBar

org.eclipse.swt.widgets.ToolBar newsTextToolBar

newsTextUrl

org.eclipse.ui.forms.widgets.Hyperlink newsTextUrl

openInBrowserItem

org.eclipse.swt.widgets.MenuItem openInBrowserItem

rateComposite

org.eclipse.swt.widgets.Composite rateComposite

rateDropdown

org.eclipse.swt.widgets.Menu rateDropdown

rateToolItem

org.eclipse.swt.widgets.ToolItem rateToolItem

rssNewsItem

NewsItem rssNewsItem

rssOwlGui

GUI rssOwlGui

shell

org.eclipse.swt.widgets.Shell shell

urlTitleHolder

org.eclipse.swt.widgets.Composite urlTitleHolder

x

int x

y

int y
Constructor Detail

NewsText

public NewsText(org.eclipse.swt.widgets.Display display,
                org.eclipse.swt.widgets.Shell shell,
                org.eclipse.swt.custom.SashForm contentSash,
                GUI rssOwlGui,
                EventManager eventManager)
Instantiate a new NewsText to display a newsitem

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

getBrowserPanel

public BrowserPanel getBrowserPanel()
Get the BrowserPanel of the Newstext panel in case internal browser view is activated for newstext

Returns:
BrowserPanel The browserpanel for the newstext

getNewsTextTitle

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

Returns:
NewsTextTitle StyledText

getPrintableNewstext

public String getPrintableNewstext()
Get the currently viewed newsitem's text to print.

Returns:
String Text to print

setRequiresUpdate

public void setRequiresUpdate()
Explicitly marks the newstext as required to update. This is called when the user has clicked into a news.


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

updateLinkColor

public void updateLinkColor()
Update color of Link Label


createBrowserPanel

private void createBrowserPanel(boolean onStartup)
Create the browser panel to display newstext in the internal browser

Parameters:
onStartup - If TRUE this method is called on startup of RSSOwl

createStyledText

private void createStyledText()
Create the StyledText to display the newstext. This method is called whenever the user switches from the internal browser view to the StyledText view.


displayNews

private void displayNews(NewsItem rssNewsItem)
Display news in the ViewForm

Parameters:
rssNewsItem - The newsitem to display

displayNewsInBrowser

private void displayNewsInBrowser()
Display the selected news in the internal browser. This will display Title and URL of the news as usual and show the description (plus possible enclosures, comments, source) in the internal browser.


displayNewsInStyledText

private void displayNewsInStyledText()
Display selected news in a StyledText


displayNewsLinkInBrowser

private void displayNewsLinkInBrowser(String link)
Display the Link of the News using the internal browser.

Parameters:
link - The valid link of the Newsitem to display.

displayNewsMetaInfo

private void displayNewsMetaInfo()
Display Title and link of the news


initComponents

private void initComponents()
Init all the components


isShowingNews

private boolean isShowingNews(NewsItem newsItem)
Check if the given NewsItem is currently being displayed

Parameters:
newsItem - The newsitem to check if being displayed
Returns:
boolean TRUE in case the newsitem is currently displayed

rebuildNewsText

private void rebuildNewsText()
Rebuild the newstext area


updateAccelerators

private void updateAccelerators()
Update the accelerators on the menuitems


checkWord

void checkWord(org.eclipse.swt.custom.StyledText text)
Get the word from the position where the mouse is and check if the word is an URL. If an URL was found the setData() method of the StyledText is called and the URL is inserted as String. Otherwise the setData() method is called with NULL as argument.

Parameters:
text - StyledText to check the word

clearNewstext

void clearNewstext()
Empty the newstext viewform


displayNews

void displayNews(String urlOrTitle,
                 String newsTitle)
Display the selected news in the newstext-viewform

Parameters:
urlOrTitle - The URL / Path or Title of the RSS XML
newsTitle - Title of the selected news

onMouseMove

void onMouseMove(org.eclipse.swt.events.MouseEvent e)
Called whenever the mouse is moving

Parameters:
e - The occuring MouseEvent

onMouseUp

void onMouseUp(org.eclipse.swt.events.MouseEvent e)
Called whenever the mouse button was released

Parameters:
e - The occuring MouseEvent

rateNews

void rateNews(NewsItem rssNewsItem,
              int rateLevel)
Rate selected news

Parameters:
rssNewsItem - The newsitem to rate
rateLevel - The rating level

updateNewsTextComposite

void updateNewsTextComposite()
Update the newstext composite to either show Internal Browser or StyledText for the newstext



RSSOwl - RSS / RDF / Atom Newsreader

SourceForge.net Logo