org.stringer.ui
Class Stringer

java.lang.Object
  |
  +--org.stringer.ui.Stringer
All Implemented Interfaces:
java.util.EventListener, java.awt.event.ItemListener, StringerConstants

public class Stringer
extends java.lang.Object
implements StringerConstants, java.awt.event.ItemListener

Author:
R. Kevin Cole, kcole@users.sourceforge.net

Nested Class Summary
(package private)  class Stringer.Hyperactive
          listen for link selection events in the JEditorPane
(package private)  class Stringer.MousePopupListener
          Handle mouse clicks in our JTree.
protected  class Stringer.MyTreeSelectionListener
          Handle selection/deselections in the "subscriptions" TreeView
(package private)  class Stringer.TableViewPopupListener
          Handle mouse clicks in our JTable
 
Field Summary
(package private) static java.util.Hashtable actionTable
          Map of AbstractActions to Action Keywords
static int ALL_TAB
          The TableView that contains the available feeds is tab #1
(package private)  Feed currentFeed
          The feed currently displayed in htmlView This is the feed that is undergoing selection in the tree view.
(package private)  javax.swing.JFrame frame
          The frame in which we are embedded
(package private) static javax.swing.JEditorPane htmlHeaderView
           
(package private) static javax.swing.JEditorPane htmlView
           
(package private)  int keycode
          maintains the current keyboard state (control-key down, etc)
(package private)  Channel lastSelectedChannel
          The feed previously displayed in htmlView.
(package private)  Item lastSelectedItem
           
(package private) static java.util.ResourceBundle localStrings
           
(package private) static org.apache.log4j.Logger logger
           
(package private) static javax.swing.JLabel m_lblMemUsage
           
(package private) static javax.swing.JLabel m_lblPressed
           
(package private) static javax.swing.JLabel m_lblSize
           
(package private) static javax.swing.JLabel m_lblStatus
           
static int NEW_TAB
          The TableView that contains the newly available feeds is tab #2
private  TableView newFeedsView
          The JTable-based view of all newly available feeds
protected  javax.swing.JPopupMenu popup
           
(package private) static javax.swing.JProgressBar progressBar
           
(package private) static javax.swing.JSplitPane splitPane
          the splitpane component in which the htmlView and the tabbedPane are embedded
static int SUBSCRIBED_TAB
          The TreeView that contains the hierarchy of feed folders is tab #0
(package private)  java.util.Hashtable subscriptionMap
          all subscribed nodes
(package private)  javax.swing.JTabbedPane tabbedPane
          the tabbed pane in the left-hand window
private  TableView tableview
          The JTable-based view of all available feeds
private  TreeView treeview
          The JTree-based view of subscribed feeds and folders
 
Fields inherited from interface org.stringer.StringerConstants
ABOUT_KEY, BACKUP_DIR, BACKUP_FEEDRC_FILE, BACKUP_SUBSCRIPTION_FILE, COPY_KEY, DELETE_KEY, DOCTYPE, EXIT_KEY, EXPORT_KEY, FEED_DIR, HOME_DIR, IMPORT_KEY, ITEM_PROPERTIES_KEY, KILLALL_KEY, NEWFEED_KEY, NEWFOLDER_KEY, REFRESH_FEEDS_KEY, SUBSCRIPTION_FILE, UPDATE_FEEDS_KEY, UPDATESELECTED_KEY, UPDATESUBSCRIBED_KEY, XMLVERSION
 
Constructor Summary
Stringer(javax.swing.JFrame frame)
          Create a new Stringer main window embedded within frame
 
Method Summary
 void addNewFeed(Item item)
          Add a newsfeed to the subscription list
 void deleteItem(javax.swing.tree.DefaultMutableTreeNode node)
          Delete a node in the TreeView
 void deleteItem(Item item)
          Delete an item from the tree and remove its cache file.
 void displayChannel(Channel channel)
          Format a channel as HTML and display it in our JEditorPane
 void displayErrorEvent(Item item)
           
 javax.swing.AbstractAction getAction(java.lang.Integer actionKey)
           
 int getAvailableNewsFeedCount()
           
 javax.swing.JPanel getContentPanel()
           
 javax.swing.JFrame getFrame()
           
 javax.swing.JEditorPane getHtmlHeaderView()
           
 javax.swing.JEditorPane getHtmlView()
           
 int getKeyCode()
           
static java.lang.String getLocalString(java.lang.String key)
           
 TableView getNewFeedsView()
           
 int getNewNewsFeedCount()
           
 java.lang.String getNewsFeed()
           
 javax.swing.JPopupMenu getPopup()
          Lazy instantiation of the treeview's popup menu.
 javax.swing.JProgressBar getProgressBar()
           
 Channel getSelectedChannel()
           
 int getSubscribedFeedCount()
           
 java.util.Hashtable getSubscriptionMap()
           
 javax.swing.JTabbedPane getTabbedPane()
           
 TableView getTableView()
           
 javax.swing.JTree getTree()
           
 void itemStateChanged(java.awt.event.ItemEvent e)
          Listen for changes to our subscription list
protected static javax.swing.JComponent newLabel(java.lang.String text)
           
 void saveAll()
          Save the screen state and the current subscription tree
 void savePreferences()
          Save the current window state and component positions to our preferences file
 void saveSubscriptions()
          Update our subscription file from the tree contents.
static void setActionEnabled(java.lang.Integer actionKey, boolean b)
          Enable/disable an AbstractAction
 void setItemCountStatus(int n)
           
 void setSelection(javax.swing.tree.TreePath path)
          Set the current selection in the treeview.
 void setStatusText(java.lang.String s)
           
protected  void showMemoryUsage()
           
protected  void walk(java.lang.Object o, java.lang.StringBuffer buf)
          Build an XML string representation of the nodes in our JTree by visiting every node in the tree and appending to a StringBuffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

static org.apache.log4j.Logger logger

subscriptionMap

java.util.Hashtable subscriptionMap
all subscribed nodes


treeview

private TreeView treeview
The JTree-based view of subscribed feeds and folders


tableview

private TableView tableview
The JTable-based view of all available feeds


newFeedsView

private TableView newFeedsView
The JTable-based view of all newly available feeds


tabbedPane

javax.swing.JTabbedPane tabbedPane
the tabbed pane in the left-hand window


localStrings

static final java.util.ResourceBundle localStrings

actionTable

static final java.util.Hashtable actionTable
Map of AbstractActions to Action Keywords


m_lblStatus

static javax.swing.JLabel m_lblStatus

m_lblSize

static javax.swing.JLabel m_lblSize

m_lblMemUsage

static javax.swing.JLabel m_lblMemUsage

m_lblPressed

static javax.swing.JLabel m_lblPressed

progressBar

static javax.swing.JProgressBar progressBar

popup

protected javax.swing.JPopupMenu popup

splitPane

static javax.swing.JSplitPane splitPane
the splitpane component in which the htmlView and the tabbedPane are embedded


frame

javax.swing.JFrame frame
The frame in which we are embedded


currentFeed

Feed currentFeed
The feed currently displayed in htmlView This is the feed that is undergoing selection in the tree view.


lastSelectedChannel

Channel lastSelectedChannel
The feed previously displayed in htmlView. This is the feed that is undergoing deselection in the tree view.


lastSelectedItem

Item lastSelectedItem

keycode

int keycode
maintains the current keyboard state (control-key down, etc)


htmlView

static final javax.swing.JEditorPane htmlView

htmlHeaderView

static final javax.swing.JEditorPane htmlHeaderView

SUBSCRIBED_TAB

public static final int SUBSCRIBED_TAB
The TreeView that contains the hierarchy of feed folders is tab #0

See Also:
Constant Field Values

ALL_TAB

public static final int ALL_TAB
The TableView that contains the available feeds is tab #1

See Also:
Constant Field Values

NEW_TAB

public static final int NEW_TAB
The TableView that contains the newly available feeds is tab #2

See Also:
Constant Field Values
Constructor Detail

Stringer

public Stringer(javax.swing.JFrame frame)
         throws java.lang.ClassNotFoundException,
                java.lang.Exception
Create a new Stringer main window embedded within frame

Parameters:
frame - our parent window.
Method Detail

getSubscriptionMap

public java.util.Hashtable getSubscriptionMap()
Returns:
a map of subscribed news feeds

getTree

public javax.swing.JTree getTree()
Returns:
The view of subscribed feeds

getTableView

public TableView getTableView()
Returns:
The view of available feeds

getNewFeedsView

public TableView getNewFeedsView()
Returns:
The view of new feeds

getHtmlView

public javax.swing.JEditorPane getHtmlView()
Returns:
The HTML view of a particular feed

getHtmlHeaderView

public javax.swing.JEditorPane getHtmlHeaderView()
Returns:
The HTML header view of a particular feed

getTabbedPane

public javax.swing.JTabbedPane getTabbedPane()
Returns:
The JTabbedPane view

getSubscribedFeedCount

public int getSubscribedFeedCount()
Returns:
a count of the subscribed newsfeeds.

getAvailableNewsFeedCount

public int getAvailableNewsFeedCount()
Returns:
a count of the available feeds in the AvailableFeeds view.

getNewNewsFeedCount

public int getNewNewsFeedCount()
Returns:
a count of the new feeds in the NewFeeds view.

getLocalString

public static java.lang.String getLocalString(java.lang.String key)

setActionEnabled

public static void setActionEnabled(java.lang.Integer actionKey,
                                    boolean b)
Enable/disable an AbstractAction

Parameters:
b - true to enable or false to disable the action

getAction

public javax.swing.AbstractAction getAction(java.lang.Integer actionKey)

setStatusText

public void setStatusText(java.lang.String s)

setItemCountStatus

public void setItemCountStatus(int n)

newLabel

protected static javax.swing.JComponent newLabel(java.lang.String text)

getSelectedChannel

public Channel getSelectedChannel()
Returns:
the currently selected channel in the TreeView

getProgressBar

public javax.swing.JProgressBar getProgressBar()

getFrame

public javax.swing.JFrame getFrame()
Returns:
our parent frame

getContentPanel

public javax.swing.JPanel getContentPanel()

getNewsFeed

public java.lang.String getNewsFeed()

getKeyCode

public int getKeyCode()
Returns:
the current keyboard state (control-key down, etc)

getPopup

public javax.swing.JPopupMenu getPopup()
Lazy instantiation of the treeview's popup menu.

Returns:
a popup menu for the subscription view

showMemoryUsage

protected void showMemoryUsage()

displayErrorEvent

public void displayErrorEvent(Item item)

displayChannel

public void displayChannel(Channel channel)
Format a channel as HTML and display it in our JEditorPane

Parameters:
channel - format this channel as HTML and display it.

savePreferences

public void savePreferences()
Save the current window state and component positions to our preferences file


saveSubscriptions

public void saveSubscriptions()
                       throws java.io.IOException
Update our subscription file from the tree contents.

Throws:
java.io.IOException

saveAll

public void saveAll()
             throws java.io.IOException
Save the screen state and the current subscription tree

java.io.IOException

deleteItem

public void deleteItem(javax.swing.tree.DefaultMutableTreeNode node)
Delete a node in the TreeView

Parameters:
node - this TreeNode will be deleted

deleteItem

public void deleteItem(Item item)
Delete an item from the tree and remove its cache file.

Parameters:
item - The TreeNode that has this item as its UserObject will be deleted.

walk

protected void walk(java.lang.Object o,
                    java.lang.StringBuffer buf)
Build an XML string representation of the nodes in our JTree by visiting every node in the tree and appending to a StringBuffer.

Parameters:
o - the tree branch
buf - xml representation of this branch is written here.

setSelection

public void setSelection(javax.swing.tree.TreePath path)
Set the current selection in the treeview.

Parameters:
path - this treepath becomes the current selection in the TreeView

itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent e)
Listen for changes to our subscription list

Specified by:
itemStateChanged in interface java.awt.event.ItemListener

addNewFeed

public void addNewFeed(Item item)
Add a newsfeed to the subscription list

Parameters:
item - the newsfeed to be added.


Copyright © R. Kevin Cole. All Rights Reserved.