home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-08-14 | 3.9 KB | 156 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.
-
-
- CheckboxTab.java
-
- A tab implemented from a Checkbox.
-
-
- Authors:
-
- rphall Rick Hall
-
-
- Version Ident:
-
- $Header: /PjJavaClient/src/pj/awt/CheckboxTab.java 2 1/21/96 5:53p Rphall $
-
-
- History:
-
- 10-dec-1995 rphalll Initial Creation
-
-
- ---------------------------------------------------------------------------*/
-
- package pj.awt;
-
- import pj.awt.StringTabSpec;
- import pj.awt.Tab;
-
- import collections.Assertable;
- import collections.ImplementationError;
- import java.awt.Checkbox;
- import java.awt.CheckboxGroup;
- import java.lang.String;
-
- /**
- * A tab implemented from a Checkbox.
- *
- * @see pj.awt.Tab
- * @see java.awt.Checkbox
- * @version 0.00 03-Jan-96
- * @author Rick Hall
- */
- class CheckboxTab extends Checkbox
- implements Assertable, Tab
- {
-
- // --- Public constructors
-
- /**
- * Construct a CheckboxTab.
- * @param tab a string-based specification of this tab.
- * @param group the CheckboxGroup this Checkbox is in
- * @param state the initial state of this Checkbox
- */
- public CheckboxTab(
- StringTabSpec tab, CheckboxGroup group, boolean selected)
- {
- super((String)tab.objVisSpec, group, selected);
- strTabName = tab.strTabName;
- strPageName = tab.strPageName;
- }
-
- // --- Public operations
-
- /**
- * Raise an exception if predicate is false.
- * @see collections.Assertable
- */
- public void assert(boolean predicate) throws ImplementationError
- { ImplementationError.assert(this, predicate); }
-
- /**
- * @param tabname The name for this tab.
- */
- public void setName(String tabname)
- { strTabName = tabname; }
-
- /**
- * @return The name for this tab.
- */
- public String getName()
- { return strTabName; }
-
- /**
- * Get a tab's name.
- * Equivalent to getName().
- *
- * @return The internal id of a tab within a TabBar.
- * @see getName
- */
- public String getTabName()
- { return getName(); }
-
- /**
- * @param object The page name mapped to this tab.
- * @exception ImplementationError thrown if object is not an instance
- * of String
- */
- public void setMappedObject(Object object)
- throws ImplementationError
- {
- assert(object instanceof String);
- strPageName = (String)object;
- }
-
- /**
- * @return The page name mapped to this tab.
- */
- public Object getMappedObject()
- { return strPageName; }
-
- /**
- * Get the mapped name of a tab.
- * Equivalent to ((String)getMappedObject()).
- *
- * @return The name of the page which this tab references.
- * @see pj.util.Mappable#getMappedName
- */
- public String getPageName()
- { return (String)getMappedObject(); }
-
- /**
- * @param visual The string presentation of this tab.
- * @exception ImplementationError if visual is not an instance of String
- */
- public void setTabVisual(Object visual)
- {
- assert(visual instanceof String);
- setLabel((String)visual);
- }
-
- /**
- * @return The String presentation of this tab.
- */
- public Object getTabVisual()
- { return getLabel(); }
-
- // --- Private attributes
-
- String strTabName;
- String strPageName;
-
- } // Tab
-