net.sourceforge.rssowl.controller.panel
Class BrowserPanel

java.lang.Object
  extended by net.sourceforge.rssowl.controller.panel.BrowserPanel

public class BrowserPanel
extends java.lang.Object

This is the Web-Browser support for RSSOwl. It loads a Browser in a Composite and opens URLs.

Important Note: Dynamically disable/enable JavaScript in the Browser widget on Windows with the following modifications:

BrowserPanel.java:

Line 276:
browser.setScriptDisabled(false);
Line 550:
browser.setScriptDisabled(!URLShop.isScriptAllowed(event.location));
Browser.java:
public void setScriptDisabled(boolean disabled) { if (site != null) ((WebSite) site).disableScript = disabled; }
WebSite.java:
boolean disableScript = false;
Line 417:
if (disableScript && dwAction == 5120 //0x1400 - URLACTION_SCRIPT_RUN//) { policy = Browser.URLPOLICY_DISALLOW; }

Version:
1.2.4
Author:
Benjamin Pasero

Field Summary
(package private)  boolean blockNavigation
           
(package private)  Browser browser
           
private  Composite browserPanel
           
private  ToolItem itemDiscovery
           
private  ToolItem itemHome
           
private  ToolItem itemNewTab
           
private  ToolItem itemReload
           
private  ToolItem itemStop
           
private static java.lang.String JAVA_SCRIPT_PRINT
          JavaScript command to print the current website of the Browser
(package private)  Text location
           
private  MenuItem menuItemBackward
           
private  MenuItem menuItemForward
           
private static boolean mozillaAvailable
          Flag to check if Mozilla is available on Windows
private static java.lang.String NO_MOZILLA_PROPERTY
          DWord to disable the use of Mozilla on Windows
private  Composite parent
           
(package private)  CTabItem parentTabItem
           
(package private)  GUI rssOwlGui
           
(package private)  java.lang.String saveHome
           
private  boolean showControls
           
private  boolean showNewTabControl
           
(package private)  Label status
           
(package private)  Label statusProgressBar
           
(package private)  ToolItem toolItemBack
           
(package private)  ToolItem toolItemForward
           
 
Constructor Summary
BrowserPanel(GUI rssOwlGui, Composite parent, boolean showControls)
          Instantiate a new BrowserPanel
BrowserPanel(GUI rssOwlGui, Composite parent, CTabItem parentTabItem, boolean showControls, boolean showNewTabControl)
          Instantiate a new BrowserPanel
 
Method Summary
private  void addMenu(Browser browser)
           
 void displayNews(NewsItem rssNewsItem)
          Display HTML formatted news
 void dispose()
          Dispose the browser
 Browser getBrowser()
          Get the Browser widget
 Composite getBrowserPanel()
          Get the browser panel
 Text getLocation()
          Get the Location Text-Input field.
 void hideNoControlsBrowser()
          Hide the Newstext Browser Panel
private  void initBrowser()
          Init the browser
private  void initBrowserNoControls()
          Create the browser to use with no controls
private  void initComponents()
          Init all components
private  void initComponentsNoControls()
          Init components without the controls
(package private)  void onProgressChange(ProgressEvent event)
          Called whenever the Progress is changing
(package private)  void onProgressCompletion()
          Called whenever the Progress is completed
(package private)  void onStatusTextChange(StatusTextEvent event)
          Called whenever the Status Text is changing
 void openUrl(java.lang.String url)
          Open a new URL in the browser
 boolean print()
          Print the Browser using the JavaScript print() method
 void setBlockNavigation(boolean blockNav)
          Set TRUE to block navigation in the browser widget.
 void setTabItem(CTabItem tabItem)
          Sets the CTabItem this BrowserPanel is part of.
private  void setText(java.lang.String text)
          Set HTML text to the browser
private  void setupFeedProtocolSupport(Browser browser)
          Add Support for the Feed Protocol to the given Browser.
(package private)  void updateNavToolItems()
          Update "Back" and "Forward" tool items
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JAVA_SCRIPT_PRINT

private static final java.lang.String JAVA_SCRIPT_PRINT
JavaScript command to print the current website of the Browser

See Also:
Constant Field Values

mozillaAvailable

private static boolean mozillaAvailable
Flag to check if Mozilla is available on Windows


NO_MOZILLA_PROPERTY

private static final java.lang.String NO_MOZILLA_PROPERTY
DWord to disable the use of Mozilla on Windows

See Also:
Constant Field Values

browserPanel

private Composite browserPanel

itemDiscovery

private ToolItem itemDiscovery

itemHome

private ToolItem itemHome

itemNewTab

private ToolItem itemNewTab

itemReload

private ToolItem itemReload

itemStop

private ToolItem itemStop

menuItemForward

private MenuItem menuItemForward

menuItemBackward

private MenuItem menuItemBackward

parent

private Composite parent

showControls

private boolean showControls

showNewTabControl

private boolean showNewTabControl

blockNavigation

boolean blockNavigation

browser

Browser browser

toolItemBack

ToolItem toolItemBack

toolItemForward

ToolItem toolItemForward

location

Text location

parentTabItem

CTabItem parentTabItem

rssOwlGui

GUI rssOwlGui

saveHome

java.lang.String saveHome

status

Label status

statusProgressBar

Label statusProgressBar
Constructor Detail

BrowserPanel

public BrowserPanel(GUI rssOwlGui,
                    Composite parent,
                    boolean showControls)
Instantiate a new BrowserPanel

Parameters:
rssOwlGui - The maincontroller
parent - The parent composite
showControls - TRUE if the controls should be visible

BrowserPanel

public BrowserPanel(GUI rssOwlGui,
                    Composite parent,
                    CTabItem parentTabItem,
                    boolean showControls,
                    boolean showNewTabControl)
Instantiate a new BrowserPanel

Parameters:
rssOwlGui - The maincontroller
parent - The parent composite
parentTabItem - The parent CTabItem containing the Browser if available
showControls - TRUE if the controls should be visible
showNewTabControl - TRUE if the "Open new Tab" button should be visible
Method Detail

displayNews

public void displayNews(NewsItem rssNewsItem)
Display HTML formatted news

Parameters:
rssNewsItem - News to display

dispose

public void dispose()
Dispose the browser


getBrowser

public Browser getBrowser()
Get the Browser widget

Returns:
Browser The browser widget

getBrowserPanel

public Composite getBrowserPanel()
Get the browser panel

Returns:
Composite The browser panel

getLocation

public Text getLocation()
Get the Location Text-Input field.

Returns:
Text The location text-input field.

hideNoControlsBrowser

public void hideNoControlsBrowser()
Hide the Newstext Browser Panel


openUrl

public void openUrl(java.lang.String url)
Open a new URL in the browser

Parameters:
url - URL of the webpage

print

public boolean print()
Print the Browser using the JavaScript print() method

Returns:
boolean TRUE in case of success, FALSE otherwise

setBlockNavigation

public void setBlockNavigation(boolean blockNav)
Set TRUE to block navigation in the browser widget. Any selected links will open in the external browser if set in Settings. Set FALSE to allow navigation in the browser. When setting text to the browser, blockNav has to be FALSE to display the text!

Parameters:
blockNav - The blockNav to set.

setTabItem

public void setTabItem(CTabItem tabItem)
Sets the CTabItem this BrowserPanel is part of. This method is only called when the initial TabItem was moved to a different TabItem.

Parameters:
tabItem - The CTabItem this Table is part of.

initBrowser

private void initBrowser()
Init the browser


addMenu

private void addMenu(Browser browser)

initBrowserNoControls

private void initBrowserNoControls()
Create the browser to use with no controls


initComponents

private void initComponents()
Init all components


initComponentsNoControls

private void initComponentsNoControls()
Init components without the controls


setText

private void setText(java.lang.String text)
Set HTML text to the browser

Parameters:
text - HTML code

setupFeedProtocolSupport

private void setupFeedProtocolSupport(Browser browser)
Add Support for the Feed Protocol to the given Browser.

Listen for changing Location and intercept the new location the Browser is about to navigate to. In case the new Location uses the Feed Protocol URI Syntax, parse the Feed's URL out of it and open the "New Favorite" dialog.

Parameters:
browser - The Browser to add the Feed Protocol Support.

onProgressChange

void onProgressChange(ProgressEvent event)
Called whenever the Progress is changing

Parameters:
event - The ProgressEvent

onProgressCompletion

void onProgressCompletion()
Called whenever the Progress is completed


onStatusTextChange

void onStatusTextChange(StatusTextEvent event)
Called whenever the Status Text is changing

Parameters:
event - The StatusTextEvent

updateNavToolItems

void updateNavToolItems()
Update "Back" and "Forward" tool items



RSSOwl - RSS / RDF / Atom Newsreader

SourceForge.net Logo