StocksMonitor 1.5.0

hirondelle.stocks.quotes
Class FetchQuotesAction

Object
  extended by AbstractAction
      extended by FetchQuotesAction
All Implemented Interfaces:
ActionListener, Serializable, Cloneable, EventListener, Observer, Action

public final class FetchQuotesAction
extends AbstractAction
implements Observer

Fetch current quote data for the CurrentPortfolio from a data source on the web.

This action is performed at many different times :

This class performs most of its work in a background daemon thread, and uses EventQueue.invokeLater to update the user interface with the result. The user interface remains responsive, regardless of the time taken for its work to complete.

A daemon thread is used since daemon threads do not prevent an application from terminating.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class AbstractAction
changeSupport, enabled
 
Fields inherited from interface Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
FetchQuotesAction(CurrentPortfolio aCurrentPortfolio, QuoteTablePreferencesEditor aQuoteTablePrefEditor, QuoteTable aQuoteTable, SummaryView aSummaryView)
          Constructor.
 
Method Summary
 void actionPerformed(ActionEvent e)
          Fetch quotes from the web for the CurrentPortfolio.
 void update(Observable aPublisher, Object aData)
          Listens for changes to the CurrentPortfolio or the user preference for update frequency, and calls actionPerformed(java.awt.event.ActionEvent).
 
Methods inherited from class AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FetchQuotesAction

public FetchQuotesAction(CurrentPortfolio aCurrentPortfolio,
                         QuoteTablePreferencesEditor aQuoteTablePrefEditor,
                         QuoteTable aQuoteTable,
                         SummaryView aSummaryView)
Constructor.

Parameters:
aCurrentPortfolio - an Observable which notifies this object when the CurrentPortfolio is changed
aQuoteTablePrefEditor - allows this class to read the user preference for the frequency of periodic fetches
aQuoteTable - a GUI element which is updated when a fetch is performed
aSummaryView - a GUI element which is updated when a fetch is performed
Method Detail

actionPerformed

public void actionPerformed(ActionEvent e)
Fetch quotes from the web for the CurrentPortfolio.

Specified by:
actionPerformed in interface ActionListener

update

public void update(Observable aPublisher,
                   Object aData)
Listens for changes to the CurrentPortfolio or the user preference for update frequency, and calls actionPerformed(java.awt.event.ActionEvent).

In the case of changes to the update frequency, actionPerformed is called only if the udate frequency has been assigned a new value.

Specified by:
update in interface Observer

StocksMonitor 1.5.0

Copyright Hirondelle Systems - License - Generated 2008Jul12.10.53