home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-08-14 | 8.4 KB | 277 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.
-
-
- @(#)PjImages.java 0.00 16-Jan-96
-
- A specification of images in the Personal Journal notebook.
-
- Authors:
-
- jts Ted Skolnick
- rphall Rick Hall
-
- Version Ident:
-
- $Header: /PjJavaClient/src/pj/awt/PjImages.java 3 1/23/96 10:53p Rphall $
-
- History:
-
- 16-Jan-96 rphall Initial Creation
- 13-Feb-96 Ted S. Adding images for DogEar
- 28-Feb-96 Ted S. Added icons that go on the tops of the pages
- like the umbrella, or the bull.
- 1-Mar-96 Ted S. Added portfolio icon.
- 26-Mar-96 Ted S. Added PJ Logo bitmap. and "This Just In"
- and "What's news".
-
- ---------------------------------------------------------------------------*/
-
- package pj.awt;
-
- import collections.Assertable;
- import collections.ImplementationCheckable;
- import collections.ImplementationError;
- import java.net.MalformedURLException;
- import java.net.URL;
- import pj.net.RemoteImage;
-
- /**
- * A specification of images in the Personal Journal notebook.
- *
- * @version 0.00 16-Jan-96
- * @author rphall
- */
- public class PjImages implements Assertable, ImplementationCheckable
- {
-
- // --- Class variables
-
- /** Index of the Weather map within imagespecs() */
- public static final int idxWthMap = 0;
-
- /** Index of dogear image with both pages up */
- public static final int idxDogEarBothUp = 1;
-
- /** Index of dogear image with left page down */
- public static final int idxDogEarLeftDown = 2;
-
- /** Index of dogear image with right page down */
- public static final int idxDogEarRightDown = 3;
-
- /** Index of Bear image */
- public static final int idxBear = 4;
-
- /** Index of FrontPage image */
- public static final int idxFrontPage = 5;
-
- /** Index of Sports image */
- public static final int idxSports = 6;
-
- /** Index of TJI image */
- public static final int idxTJI = 7;
-
- /** Index of Scores image */
- public static final int idxScores = 8;
-
- /** Index of Weather image */
- public static final int idxWeather = 9;
-
- /** Index of Market image */
- public static final int idxMarket = 10;
-
- /** Index of bull image w */
- public static final int idxBull = 10;
-
- /** Index of Portfolio image */
- public static final int idxPortfolio = 11;
-
- /** Index of PJ Logo image */
- public static final int idxPjLogo = 12;
-
- /** Index of "This just In..." image */
- public static final int idxThisJustInText = 13;
-
- /** Index of "Whats News" image */
- public static final int idxWhatsNewsText = 14;
-
-
- private static RemoteImage[] imagespec;
-
- /** A relative URL to the Weather map */
- private static final String strUrlWthMap = "WeatherMap.gif";
-
- /** A relative URL to the DogEar bothUp image */
- private static final String strUrlbothUp = "pjwdebo.gif";
-
- /** A relative URL to the DogEar leftDown image */
- private static final String strUrlleftDown = "pjwdebld.gif";
-
- /** A relative URL to the DogEar rightDown image */
- private static final String strUrlrightDown = "pjwdebrd.gif";
-
-
- /** Relative URLs for all the icons on each PJ screen ( like the bear, or umbrella ) */
- private static final String strBear = "bear.gif";
-
- private static final String strFrontPage = "front.gif";
-
- private static final String strSports = "sports.gif";
-
- private static final String strTJI = "tji.gif";
-
- private static final String strScores = "scores.gif";
-
- private static final String strWeather = "weathico.gif";
-
- private static final String strMarket = "market.gif";
-
- private static final String strBull = "bull.gif";
-
- private static final String strPortfolio = "port.gif";
-
- private static final String strPjLogo = "pj_logo.gif";
-
- private static final String strThisJustInText = "thisjustin.gif";
-
- private static final String strWhatsNewsText = "whatsnews.gif";
-
-
-
- // --- Public constructors
-
- /**
- * Constructs an advertisement specification.
- * @param base A base URL from which relative image URL's are calculated.
- */
- public PjImages(URL base)
- {
- RemoteImage ri;
-
- if (imagespec == null)
- {
- imagespec = new RemoteImage[15];
-
- try {
-
- // Weather map
- ri = new RemoteImage( new URL(base,strUrlWthMap) );
- imagespec[idxWthMap] = ri;
-
- // Add images for the DogaEar
- ri = new RemoteImage( new URL(base,strUrlbothUp) );
- imagespec[idxDogEarBothUp] = ri;
-
- ri = new RemoteImage( new URL(base,strUrlleftDown) );
- imagespec[idxDogEarLeftDown] = ri;
-
- ri = new RemoteImage( new URL(base,strUrlrightDown) );
- imagespec[idxDogEarRightDown] = ri;
-
-
-
- ri = new RemoteImage( new URL(base,strBear) );
- imagespec[idxBear] = ri;
-
- ri = new RemoteImage( new URL(base,strFrontPage) );
- imagespec[idxFrontPage] = ri;
-
- ri = new RemoteImage( new URL(base,strSports) );
- imagespec[idxSports] = ri;
-
- ri = new RemoteImage( new URL(base,strTJI) );
- imagespec[idxTJI] = ri;
-
- ri = new RemoteImage( new URL(base,strScores) );
- imagespec[idxScores] = ri;
-
- ri = new RemoteImage( new URL(base,strWeather) );
- imagespec[idxWeather] = ri;
-
- ri = new RemoteImage( new URL(base,strMarket) );
- imagespec[idxMarket] = ri;
-
- ri = new RemoteImage( new URL(base,strBull) );
- imagespec[idxBull] = ri;
-
- ri = new RemoteImage( new URL(base,strPortfolio) );
- imagespec[idxPortfolio] = ri;
-
- ri = new RemoteImage( new URL(base,strPjLogo) );
- imagespec[idxPjLogo] = ri;
-
- ri = new RemoteImage( new URL(base,strThisJustInText) );
- imagespec[idxThisJustInText] = ri;
-
- ri = new RemoteImage( new URL(base,strWhatsNewsText) );
- imagespec[idxWhatsNewsText] = ri;
-
-
-
- } // try
- catch(MalformedURLException e)
- {
- assert(false);
- }
-
- } // if imagespec null
-
- // Postconditions
- checkImplementation();
-
- System.out.println("Debug-PjImages:constructed");
- } // PjImages()
-
-
-
- /**
- * A null constructor handy for anyone who wants to use this to get an image
- * after PJ has been initialised. So, somebody must first construct a PjImages
- * with the URL constructor before this one has any value. Static members are what
- * makes this possible.
- */
- public PjImages( )
- {
- } // PjImages()
-
-
- // --- Public operations
- /**
- * Check the internal consistency of the a PjImages.
- * Currently a NOP.
- * @exception ImplementationError currently never thrown.
- */
- public void checkImplementation() throws ImplementationError
- {
- } // checkImplementation()
-
- /**
- * Raise an exception if predicate is false.
- * @see collections.Assertable
- * @exception ImplementationError thrown if predicate is false.
- */
- public void assert(boolean predicate) throws ImplementationError
- {
- ImplementationError.assert(this, predicate);
- }
-
- /**
- * @return An array of ad specifications.
- */
- public RemoteImage[] imagespecs()
- {
- return imagespec;
- }
-
-
- } // PjImages
-