home *** CD-ROM | disk | FTP | other *** search
/ The Net: Ultimate Internet Guide / WWLCD1.ISO / pc / java / un2maiq4 / pjjava / src / pj / awt / tabspec.java < prev    next >
Encoding:
Java Source  |  1996-08-14  |  3.4 KB  |  130 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.     TabSpec.java
  15.  
  16.         A specification for a component of a TabBar.
  17.  
  18.  
  19.     Authors:
  20.  
  21.         rphall          Rick Hall
  22.  
  23.  
  24.     Version Ident:
  25.  
  26.         $Header$
  27.  
  28.  
  29.     History:
  30.  
  31.         10-dec-1995 rphalll     Initial Creation
  32.  
  33.  
  34. ---------------------------------------------------------------------------*/
  35.  
  36. package pj.awt;
  37.  
  38. import collections.Assertable;
  39. import collections.ImplementationCheckable;
  40. import collections.ImplementationError;
  41. import java.lang.Object;
  42. import java.lang.String;
  43.  
  44. /**
  45.  * A specification for a component of a TabBar.
  46.  *
  47.  * @see TabBar
  48.  * @see Notebook
  49.  * @see Divider
  50.  * @version 0.00 03-Jan-96
  51.  * @author Rick Hall
  52. */
  53. public abstract class TabSpec implements Assertable, ImplementationCheckable
  54.     {
  55.  
  56.     // --- Instance variables
  57.  
  58.     /**
  59.      * The internal id of a tab within a TabBar.
  60.     */
  61.     public String strTabName;
  62.  
  63.     /**
  64.      * The pageName of the divider to which this tab refers.
  65.      * @see Notebook
  66.      * @see Divider
  67.     */
  68.     public String strPageName;
  69.  
  70.     /**
  71.      * A specification for the visible presentation of this tab
  72.      * within a TabBar, typically a String or an Image.
  73.     */
  74.     public Object objVisSpec;
  75.  
  76.     // --- Public constructors
  77.  
  78.     /**
  79.      * This constructor sets the public attributes of TabSpec and then
  80.      * invokes checkImplementation().
  81.      * @param tabName The internal id of a tab within a TabBar.
  82.      * @param pageName The pageName of the divider to which this tab refers.
  83.      * @param spec A specification for the visible presentation of this tab
  84.      * within a TabBar, typically a String or an Image.
  85.      * @see checkImplementation
  86.     */
  87.     public TabSpec(
  88.             String tabName,
  89.             String pageName,
  90.             Object spec)
  91.         {
  92.         strTabName = tabName;
  93.         strPageName = pageName;
  94.         objVisSpec = spec;
  95.         checkImplementation();
  96.         }
  97.  
  98.     // --- Public operations
  99.  
  100.     /**
  101.      * Raise an exception if predicate is false.
  102.      * @see collections.Assertable
  103.     */
  104.     public void assert(boolean predicate) throws ImplementationError
  105.         { 
  106.         ImplementationError.assert(this, predicate); 
  107.         }
  108.  
  109.     /**
  110.      * Check the internal validity of a TabSpec.
  111.      * Subclasses should extend this operation to check the type of
  112.      * objVisSpec. This operation is equivalent to:
  113.      * <pre>
  114.      *      assert(strPageName!=null);
  115.      *      assert(strTabName!= null);
  116.      *      assert(objVisSpec!=null);
  117.      * </pre>
  118.      * @see collections.ImplementationCheckable
  119.      * @exception ImplementationError Thrown if any public attribute
  120.      * is null.
  121.     */
  122.     public void checkImplementation() throws ImplementationError
  123.         {
  124.         assert(strPageName!=null);
  125.         assert(strTabName!= null);
  126.         assert(objVisSpec!=null);
  127.         }
  128.  
  129.     } // TabSpec
  130.