home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-08-14 | 2.4 KB | 89 lines |
- /*---------------------------------------------------------------------------
-
- Written by the Personal Journal developers of Dow Jones & Company, Inc.
-
- Dow Jones makes no representations or warranties about
- the suitability of this software, either express or
- implied, including but not limited to the implied warranties
- of merchantability, fitness for a particular purpose,
- or non-infringement. Dow Jones will not be liable for
- any damages suffered by a user as a result of using,
- modifying or distributing this software or its derivatives.
-
-
-
- @(#)ObsvrLabel.java 0.00 19-Mar-95
-
- A Label component that has observing capability.
-
- Authors:
-
- jlee James Lee
-
-
- Version Ident:
-
- $Header$
-
-
- History:
-
- 19-Mar-1996 jlee Initial Creation
- 26-Mar-1996 jlee Changed setText's string parameter which embeds "Persona News".
- ---------------------------------------------------------------------------*/
-
- package pj.awt;
-
- import pj.io.DownloadProgressNotification;
- import pj.io.PaperSection;
-
- import java.awt.Label;
- import java.lang.String;
- import java.util.Observer;
- import java.util.Observable;
-
- /**
- * A Label that can observe.
- * @version 0.00, 19-Mar-96
- * @author James Lee
- */
- public class ObsvrLabel extends Label implements Observer
- {
- // --- Instance variables
- private String m_strLabel;
- private String m_strPaperSection;
- private int m_nStoryCount;
-
- // --- Public constructors
- public ObsvrLabel( String strText, String strPaperSection )
- {
- setText( strText );
- m_strPaperSection = strPaperSection;
- m_nStoryCount = 0;
- }
-
- // --- Public functions
- public void setText( String strText )
- {
- m_strLabel = strText;
- super.setText( strText );
- }
-
- public void update(Observable o, Object arg)
- {
- if ( !(arg instanceof DownloadProgressNotification) )
- return;
-
- DownloadProgressNotification dpnProgress = (DownloadProgressNotification)arg;
-
- if ( !(m_strPaperSection.equals( dpnProgress.strSubsect )) )
- return;
-
- if ( dpnProgress.newState == PaperSection.stateAdding )
- m_nStoryCount++;
-
- super.setText( "Personal News: " + m_nStoryCount + " Stories from the Wall Street Journal" );
- } // update
- } // ObsvrLabel
-
-