net.sourceforge.java.feednread.frontend.components.watchestree
Class NewsFeedWatchesTree

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

public class NewsFeedWatchesTree
extends Object
implements ILanguageResourceChangeListener

Component to manage, organize and display hierarchical WatchFolder resp. Watch structures.

Author:
Sebastian Machhausen

Nested Class Summary
private  class NewsFeedWatchesTree.RefreshWatchesTreeTask
           Runnable task to refresh the NewsFeedWatchesTree if the filter value changed.
 
Field Summary
private  TreeCellModifier cellModifier
           Describes how to edit an ITreeElement by querying the corresponding value from the model and putting the updated value back into the model again.
private  ToolItem clearFilterButton
           Button to clear the filter
private  ToolBar clearFilterToolBar
           The filter ToolBar
private  NewsFeedWatchesTreeContentProvider contentProvider
           The content provider to get the data from
private  TreeColumn descriptionColumn
           The description column
private  TreeViewerDnDHandler dndHandler
           Enhances TreeViewer with DnD support
private  Object[] expandedElements
           A backup structure for the currently expanded elements.
private  TreeViewerFilter filter
           Default tree filter which allows filtering the complete NewsFeedWatchesTree tree upon a filter keyword.
private static int FILTER_REFRESH_INTERVAL
           The refresh interval of the filter in milliseconds
private  Text filterField
           The filter field
private  CLabel filterLabel
           The filter label
private  NewsFeedWatchesTreeLabelProvider labelProvider
           The label provider to convert WatchFolder and Watch objects to gui representations.
private  long lastFilterUpdate
           The timestamp of the last update to the filter
private  MainApplicationWindow mainWindow
           The Feed'n Read main window
private  MenuManager menuMgr
           The MenuManager to construct the context menu
private  TableTreeViewerSorter sorter
           Sorts WatcheFolders and Watches based on the selected TreeColumn.
private  TableTreeViewerSorterHandler sorterHandler
           Handles the header mouse clicks on the TreeColumns to jog a resorting based on the clicked TreeColumn.
private  TreeColumn titleColumn
           The title column
private  TreeViewer viewer
           The TreeViewer holding the watches
private  Tree watchesTree
           The visual Tree representation
 
Constructor Summary
NewsFeedWatchesTree(Composite parent, MainApplicationWindow mainWindow)
           Creates a new NewsFeedWatchesTree instance.
 
Method Summary
 void collapseAll()
           Collapses all expanded elements in this NewsFeedWatchesTree.
private  void createColumns()
           Creates the TreeColumns displayed in this NewsFeedWatchesTree.
private  void createComponents(Composite parent)
           Creates this NewsFeedWatchesTree's sub components.
private  void createFilterBar(Composite parent)
           Creates the filter bar to hold an input field which allows an user input to filter the favorites tree.
private  void createMenuManager()
           Creates the internal MenuManager used to create the context menu of this NewsFeedWatchesTree
 void defaultLanguageChanged(LanguageResourceChangeEvent lrce)
           Called whenever the default language changes.
 void expand(ITreeElement element)
           Expands the specified ITreeElement.
 void expandAll()
           Expands all collapsed elements in this NewsFeedWatchesTree.
 IMutableTreeElement getRoot()
           Gets the root of this NewsFeedWatchesTree.
 IMutableTreeElement getSelection()
           Gets the current selection in this NewsFeedWatchesTree.
 void show(ITreeElement element)
           Shows the specified element by making sure it is visible in this NewsFeedWatchesTree.
 
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


watchesTree

private Tree watchesTree

The visual Tree representation


titleColumn

private TreeColumn titleColumn

The title column


descriptionColumn

private TreeColumn descriptionColumn

The description column


filterLabel

private CLabel filterLabel

The filter label


filterField

private Text filterField

The filter field


clearFilterToolBar

private ToolBar clearFilterToolBar

The filter ToolBar


clearFilterButton

private ToolItem clearFilterButton

Button to clear the filter


menuMgr

private MenuManager menuMgr

The MenuManager to construct the context menu


FILTER_REFRESH_INTERVAL

private static final int FILTER_REFRESH_INTERVAL

The refresh interval of the filter in milliseconds

See Also:
Constant Field Values

viewer

private TreeViewer viewer

The TreeViewer holding the watches


contentProvider

private NewsFeedWatchesTreeContentProvider contentProvider

The content provider to get the data from


labelProvider

private NewsFeedWatchesTreeLabelProvider labelProvider

The label provider to convert WatchFolder and Watch objects to gui representations.


sorter

private TableTreeViewerSorter sorter

Sorts WatcheFolders and Watches based on the selected TreeColumn.


sorterHandler

private TableTreeViewerSorterHandler sorterHandler

Handles the header mouse clicks on the TreeColumns to jog a resorting based on the clicked TreeColumn.


filter

private TreeViewerFilter filter

Default tree filter which allows filtering the complete NewsFeedWatchesTree tree upon a filter keyword.


cellModifier

private TreeCellModifier cellModifier

Describes how to edit an ITreeElement by querying the corresponding value from the model and putting the updated value back into the model again.


expandedElements

private Object[] expandedElements

A backup structure for the currently expanded elements. This is needed whensoever the NewsFeedWatchesTree is filtered by user interaction to store and restore the current expansion status of the tree.


lastFilterUpdate

private long lastFilterUpdate

The timestamp of the last update to the filter


dndHandler

private TreeViewerDnDHandler dndHandler

Enhances TreeViewer with DnD support

Constructor Detail

NewsFeedWatchesTree

public NewsFeedWatchesTree(Composite parent,
                           MainApplicationWindow mainWindow)

Creates a new NewsFeedWatchesTree instance.

Parameters:
parent - the parent to embed this NewsFeedWatchesTree 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

getRoot

public IMutableTreeElement getRoot()

Gets the root of this NewsFeedWatchesTree. Note that the root is set invisible by default.

Returns:
the root of this NewsFeedWatchesTree

getSelection

public IMutableTreeElement getSelection()

Gets the current selection in this NewsFeedWatchesTree. This may either be a WatchFolder or a Watch object.

Returns:
the current selection

show

public void show(ITreeElement element)

Shows the specified element by making sure it is visible in this NewsFeedWatchesTree. The current selection remains unchanged.

Parameters:
element - the ITreeElement to make visible

expand

public void expand(ITreeElement element)

Expands the specified ITreeElement.

Parameters:
element - the ITreeElement to expand

expandAll

public void expandAll()

Expands all collapsed elements in this NewsFeedWatchesTree.


collapseAll

public void collapseAll()

Collapses all expanded elements in this NewsFeedWatchesTree.


createComponents

private void createComponents(Composite parent)

Creates this NewsFeedWatchesTree's sub components.

Parameters:
parent - the parent to embed this NewsFeedWatchesTree sub components into

createFilterBar

private void createFilterBar(Composite parent)

Creates the filter bar to hold an input field which allows an user input to filter the favorites tree.

Parameters:
parent - the parent Composite to embed the created filter bar in

createColumns

private void createColumns()

Creates the TreeColumns displayed in this NewsFeedWatchesTree.


createMenuManager

private void createMenuManager()

Creates the internal MenuManager used to create the context menu of this NewsFeedWatchesTree