public final class FetchQuotesAction extends AbstractAction implements Observer
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 thread, using a javax.swing.Timer. The user interface remains responsive, regardless of the time taken for its work to complete.
changeSupport, enabled
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
Constructor and Description |
---|
FetchQuotesAction(CurrentPortfolio aCurrentPortfolio,
QuoteTablePreferencesEditor aQuoteTablePrefEditor,
QuoteTable aQuoteTable,
SummaryView aSummaryView)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent e)
Fetch quotes from the web for the CurrentPortfolio.
|
void |
startTimer()
Start an internal Timer, which in turn calls
actionPerformed(ActionEvent) . |
void |
update(Observable aPublisher,
Object aData)
Listens for changes to the CurrentPortfolio or the user
preference for update frequency.
|
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
public FetchQuotesAction(CurrentPortfolio aCurrentPortfolio, QuoteTablePreferencesEditor aQuoteTablePrefEditor, QuoteTable aQuoteTable, SummaryView aSummaryView)
aCurrentPortfolio
- an Observable which notifies this
object when the CurrentPortfolio
is changedaQuoteTablePrefEditor
- allows this class to read the user preference
for the frequency of periodic fetchesaQuoteTable
- a GUI element which is updated when a fetch is performedaSummaryView
- a GUI element which is updated when a fetch is performedpublic void startTimer()
actionPerformed(ActionEvent)
.
This method must be called immediately after calling the constructor. (Since this operation uses a 'this' reference, it shouldn't be included in the constructor itself.)
public void actionPerformed(ActionEvent e)
actionPerformed
in interface ActionListener
public void update(Observable aPublisher, Object aData)
Calls actionPerformed(java.awt.event.ActionEvent)
if the current portfolio has changed.
If the update frequency has changed, the underlying Timer is restarted.
Copyright Hirondelle Systems - License - Generated 2013Sep20.10.58