home *** CD-ROM | disk | FTP | other *** search
/ The Net: Ultimate Internet Guide / WWLCD1.ISO / pc / java / un2maiq4 / pjjava / src / pj / awt / pjcheckboxnb.java < prev    next >
Encoding:
Java Source  |  1996-08-14  |  4.2 KB  |  150 lines

  1. /*---------------------------------------------------------------------------
  2.  
  3.     Written by the Personal Journal developers of Dow Jones & Company, Inc.
  4.  
  5.     Dow Jones makes no representations or warranties about 
  6.     the suitability of this software, either express or 
  7.     implied, including but not limited to the implied warranties 
  8.     of merchantability, fitness for a particular purpose, 
  9.     or non-infringement.  Dow Jones will not be liable for 
  10.     any damages suffered by a user as a result of using, 
  11.     modifying or distributing this software or its derivatives.
  12.  
  13.  
  14.     @(#)PjCheckboxNb.java  0.00 05-Jan-96
  15.  
  16.         An implementation of PjNbSpec using CheckboxNb.
  17.  
  18.     Authors:
  19.  
  20.         jts      Ted Skolnick
  21.         ln       Lindee Ning
  22.         rphall   Rick Hall
  23.         jlee     James Lee
  24.  
  25.     Version Ident:
  26.  
  27.         $Header: /PjJavaClient/src/pj/awt/PjCheckboxNb.java 6     2/02/96 11:46a Rphall $
  28.  
  29.     History:
  30.  
  31.         0.00 05-Jan-96  rphall      Initial Creation
  32.              29-Jan-96  jlee        Added WeatherSection
  33.              12-Feb-96  ln          Added ticker
  34.              13-Feb-96  jts         Added DogEar
  35.              14-Feb-96  jlee        Added SportsSection
  36.              23-Feb-96  Ted S.      Made this implement PaperView so you
  37.                                         can step through the paper saying NextView().
  38.  
  39. ---------------------------------------------------------------------------*/
  40.  
  41. package pj.awt;
  42.  
  43. import pj.awt.CheckboxNb;
  44. import pj.awt.DogEar;
  45. import pj.awt.HeadlineSection;
  46. import pj.awt.MarketSection;
  47. import pj.awt.PaperView;
  48. import pj.awt.PjImages;
  49. import pj.awt.PjNbSpec;
  50. import pj.awt.PjTicker;
  51. import pj.awt.SportsSection;
  52. import pj.awt.WeatherSection;
  53. import pj.io.Paper;
  54.  
  55. import collections.Assertable;
  56. import collections.ImplementationError;
  57. import java.awt.BorderLayout;
  58. import java.awt.Color;
  59. import java.awt.Panel;
  60. import java.util.Date;
  61.  
  62.  
  63. /**
  64.  * An implementation of PjNbSpec using CheckboxNb.
  65.  *
  66.  * @see     pj.awt.CheckboxNb
  67.  * @version 0.00 05-Jan-96
  68.  * @author  rphall
  69. */
  70. public class PjCheckboxNb extends CheckboxNb implements Assertable
  71.     {
  72.  
  73.     // --- Instance variables
  74.  
  75.     DogEar dogear;
  76.     Paper paper;
  77.     PjTicker ticker;
  78.  
  79.     // --- Public constructors
  80.  
  81.     /**
  82.      * Create a Personal Journal notebook.
  83.     */
  84.         public PjCheckboxNb(Paper p, PjAds ads, PjImages images)
  85.         {
  86.         assert(p != null);
  87.         assert(ads != null);
  88.         assert(images != null);
  89.  
  90.         paper = p;
  91.         PjNbSpec nbs = new PjNbSpec();
  92.  
  93.         appendPage( new HeadlineSection(
  94.                 nbs.pagespecs()[nbs.idxFPHdlines],paper) );
  95.  
  96.         appendPage( new HeadlineSection(
  97.                 nbs.pagespecs()[nbs.idxTJIHdlines],paper) );
  98.  
  99.         appendPage( new MarketSection(
  100.                 nbs.pagespecs()[nbs.idxMrk],paper) );
  101.  
  102.         appendPage( new PortView(
  103.                 nbs.pagespecs()[nbs.idxPort],
  104.                 ads.adspecs()[ads.idxPortAd],paper) );
  105.  
  106.         appendPage( new SportsSection(
  107.                 nbs.pagespecs()[nbs.idxSpHilite],
  108.                 ads.adspecs()[ads.idxSpAd],paper) );
  109.  
  110.         appendPage( new WeatherSection(
  111.                 nbs.pagespecs()[nbs.idxWth],
  112.                 ads.adspecs()[ads.idxWthAd],paper,
  113.                 images.imagespecs()[images.idxWthMap]) );
  114.  
  115.         // Top panel with Connect Button, Ticker, DogEar
  116.         Panel pnl = new Panel();
  117.         pnl.setLayout(new BorderLayout(/*hgap*/5,/*vgap*/0) );
  118.         dogear = new DogEar( images, this );
  119.  
  120.         pnl.add("East",dogear);
  121.         Panel pnlTicker = new Panel();
  122.         ticker = new PjTicker( p.idPortQuote, p );
  123.  
  124.         pnlTicker.add("North", ticker);
  125.         ticker.startTicker();  
  126.  
  127.         // Leave space for something later
  128.         Panel westPnl = new Panel();
  129.  
  130.         pnl.add("West",westPnl);
  131.         pnl.add("Center", pnlTicker);
  132.         add("North",pnl);
  133.  
  134.         } // PjCheckboxNb
  135.  
  136.     // --- Public operations
  137.  
  138.     /**
  139.      * Raise an exception if predicate is false.
  140.      * @see collections.Assertable
  141.     */
  142.     public void assert(boolean predicate) throws ImplementationError
  143.         { 
  144.         ImplementationError.assert(this, predicate); 
  145.         }
  146.    
  147.     
  148.  
  149.     } // PjCheckboxNb
  150.