net.sourceforge.java.feednread.frontend.components.addressbar
Class NewsFeedAddressBar

java.lang.Object
  extended bynet.sourceforge.java.feednread.frontend.components.addressbar.NewsFeedAddressBar
All Implemented Interfaces:
EventListener, ILanguageResourceChangeListener

public class NewsFeedAddressBar
extends Object
implements ILanguageResourceChangeListener

An address bar component holding an editable Combo to input a web page or NewsFeed url or to select from addresses in the history.

Author:
Sebastian Machhausen

Nested Class Summary
private  class NewsFeedAddressBar.AddressSelectionHandler
           Event handler for all selection events triggered by the address field: - User types in new address and hits enter - User selects an existing address from the list
 
Field Summary
private  Composite addressBarContainer
           The container to hold all components of the NewsFeedAddressBar
private  ViewForm addressBarForm
           The form for style purpose
private  Combo addressField
           Editable address Combo holding all stored addresses
private  NewsFeedAddressBar.AddressSelectionHandler addressHandler
           Handles all selections made to the address field: User types in new address and hits enter User selects an existing address from the list All event handling is delegated to the EventCentral.
private  Label addressLabel
           Label for the address Text field
private  ComboViewer addressViewer
           The ComboViewer to act as bridge between the model and gui layer
private  NewsFeedAddressBarContentProvider contentProvider
           The content provider to act as model layer to the address Viewer
private  MainApplicationWindow mainWindow
           The Feed'n Read main window
 
Constructor Summary
NewsFeedAddressBar(Composite parent, MainApplicationWindow mainWindow)
           Creates a new NewsFeedAddressBar instance embedding it into the specified parent component.
 
Method Summary
 void addAddress(String url)
           Adds the specified url to the list of managed addresses.
private  void createComponents(Composite parent)
           Creates all components required in this NewsFeedAddressBar context.
 void defaultLanguageChanged(LanguageResourceChangeEvent lrce)
           Called whenever the default language changes.
 void dispose()
           
 String getCurrentAddress()
           Gets the current address input as typed in by the user in the address field.
 String getSelectedAddress()
           Gets the currently selected address of this NewsFeedAddressBar.
 boolean isVisible()
           Gets the visibility status of this NewsFeedAddressBar component.
private  void registerEventHandler()
           Creates and registers all event handlers required in this NewsFeedAddressBar context.
 void removeAddress(String url)
           Removes the specified url from the list of managed addresses.
 void removeAllAddresses()
           Removes all urls from the list of managed addresses.
 void setCurrentAddress(String url)
           Sets the current address to the specified url.
 void setVisible(boolean visible)
           Sets the visibility status of this NewsFeedAddressBar component.
private  void unregisterEventHandler()
           Unregisters all event handlers required in this NewsFeedAddressBar context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

contentProvider

private NewsFeedAddressBarContentProvider contentProvider

The content provider to act as model layer to the address Viewer


mainWindow

private MainApplicationWindow mainWindow

The Feed'n Read main window


addressBarContainer

private Composite addressBarContainer

The container to hold all components of the NewsFeedAddressBar


addressBarForm

private ViewForm addressBarForm

The form for style purpose


addressLabel

private Label addressLabel

Label for the address Text field


addressField

private Combo addressField

Editable address Combo holding all stored addresses


addressViewer

private ComboViewer addressViewer

The ComboViewer to act as bridge between the model and gui layer


addressHandler

private NewsFeedAddressBar.AddressSelectionHandler addressHandler

Handles all selections made to the address field:

All event handling is delegated to the EventCentral.

Constructor Detail

NewsFeedAddressBar

public NewsFeedAddressBar(Composite parent,
                          MainApplicationWindow mainWindow)

Creates a new NewsFeedAddressBar instance embedding it into the specified parent component.

Parameters:
parent - the component to embed this NewsFeedAddressBar instance into
mainWindow - the Feed'n Read main window
Method Detail

defaultLanguageChanged

public void defaultLanguageChanged(LanguageResourceChangeEvent lrce)

Called whenever the default language changes.

Specified by:
defaultLanguageChanged in interface ILanguageResourceChangeListener
Parameters:
lrce - the triggered LanguageResourceChangeEvent

setVisible

public void setVisible(boolean visible)

Sets the visibility status of this NewsFeedAddressBar component.

Parameters:
visible - true for visible; false for invisible

isVisible

public boolean isVisible()

Gets the visibility status of this NewsFeedAddressBar component.

Returns:
visible true if visible; false if invisible

dispose

public void dispose()

addAddress

public void addAddress(String url)

Adds the specified url to the list of managed addresses. Prevents duplicates from being added.

Parameters:
url - the url to add

removeAddress

public void removeAddress(String url)

Removes the specified url from the list of managed addresses.

Parameters:
url - the url to remove

removeAllAddresses

public void removeAllAddresses()

Removes all urls from the list of managed addresses.


getSelectedAddress

public String getSelectedAddress()

Gets the currently selected address of this NewsFeedAddressBar.

Returns:
the currently selected address;null if nothing selected
See Also:
getCurrentAddress()

getCurrentAddress

public String getCurrentAddress()

Gets the current address input as typed in by the user in the address field. This value may differ from the one returned by the getSelectedAddress() method.

Returns:
the current address
See Also:
getSelectedAddress(), setCurrentAddress(String)

setCurrentAddress

public void setCurrentAddress(String url)

Sets the current address to the specified url. This method does not change the current selection.

Parameters:
url - the url to set as current address
See Also:
getCurrentAddress()

createComponents

private void createComponents(Composite parent)

Creates all components required in this NewsFeedAddressBar context.

Parameters:
parent - the component to embed the NewsFeedAddressBar components into

registerEventHandler

private void registerEventHandler()

Creates and registers all event handlers required in this NewsFeedAddressBar context.


unregisterEventHandler

private void unregisterEventHandler()

Unregisters all event handlers required in this NewsFeedAddressBar context.