home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection Student Program / ADC Tools Sampler CD Disk 3 1999.iso / Metrowerks CodeWarrior / Java Support / Java_Source / Java2 / src / javax / accessibility / AccessibleHyperlink.java < prev    next >
Encoding:
Java Source  |  1999-05-28  |  4.0 KB  |  132 lines  |  [TEXT/CWIE]

  1. /*
  2.  * @(#)AccessibleHyperlink.java    1.4 98/08/26
  3.  *
  4.  * Copyright 1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package javax.accessibility;
  16.  
  17.  
  18. import java.lang.*;
  19. import java.util.*;
  20. import java.awt.*;
  21. import javax.swing.text.*;
  22.  
  23.  
  24. /**
  25.  * Encapsulation of a link, or set of links (e.g. client side imagemap)
  26.  * in a Hypertext document
  27.  *
  28.  * @see Accessible
  29.  * @see Accessible#getAccessibleContext
  30.  * @see AccessibleContext
  31.  * @see AccessibleText
  32.  * @see AccessibleContext#getAccessibleText
  33.  *
  34.  * @version
  35.  * @author    Peter Korn
  36.  */
  37. public abstract class AccessibleHyperlink implements AccessibleAction {
  38.  
  39.     /**
  40.      * Since the document a link is associated with may have
  41.      * changed, this method returns whether this Link is valid
  42.      * anymore (with respect to the document it references).
  43.      *
  44.      * @return a flag indicating whether this link is still valid with
  45.      *         respect to the AccessibleHypertext it belongs to
  46.      */
  47.     public abstract boolean isValid();
  48.  
  49.     /**
  50.      * Returns the number of accessible actions available in this Link
  51.      * If there are more than one, the first one is NOT considered the
  52.          * "default" action of this LINK object (e.g. in an HTML imagemap).
  53.      * In general, links will have only one AccessibleAction in them.
  54.      *
  55.      * @return the zero-based number of Actions in this object
  56.      */
  57.     public abstract int getAccessibleActionCount();
  58.  
  59.     /**
  60.      * Perform the specified Action on the object
  61.      *
  62.      * @param i zero-based index of actions
  63.      * @return true if the the action was performed; else false.
  64.      * @see #getAccessibleActionCount
  65.      */
  66.     public abstract boolean doAccessibleAction(int i);
  67.  
  68.     /**
  69.      * Return a String description of this particular
  70.      * link action.  This should be a text string
  71.      * associated with anchoring text, this should be the
  72.      * anchor text.  E.g. from HTML:
  73.      *   <a HREF="http://www.sun.com/access">Accessibility</a>
  74.      * this method would return "Accessibility".
  75.      *
  76.      * Similarly, from this HTML:
  77.      *   <a HREF="#top"><img src="top-hat.gif" alt="top hat"></a>
  78.      * this method would return "top hat"
  79.      *
  80.          * @param i zero-based index of the actions
  81.          * @return a String description of the action
  82.      * @see #getAccessibleActionCount
  83.      */
  84.     public abstract String getAccessibleActionDescription(int i);
  85.  
  86.     /**
  87.      * Return an object that represents the link action,
  88.      * as appropriate for that link.  E.g. from HTML:
  89.      *   <a HREF="http://www.sun.com/access">Accessibility</a>
  90.      * this method would return a
  91.      * java.net.URL("http://www.sun.com/access.html");
  92.      *
  93.          * @param i zero-based index of the actions
  94.          * @return an Object representing the hypertext link itself
  95.      * @see #getAccessibleActionCount
  96.      */
  97.     public abstract Object getAccessibleActionObject(int i);
  98.  
  99.     /**
  100.      * Return an object that represents the link anchor,
  101.      * as appropriate for that link.  E.g. from HTML:
  102.      *   <a href="http://www.sun.com/access">Accessibility</a>
  103.      * this method would return a String containing the text:
  104.      * 'Accessibility'.
  105.      *
  106.      * Similarly, from this HTML:
  107.      *   <a HREF="#top"><img src="top-hat.gif" alt="top hat"></a>
  108.      * this might return the object ImageIcon("top-hat.gif", "top hat");
  109.      *
  110.          * @param i zero-based index of the actions
  111.          * @return an Object representing the hypertext anchor
  112.      * @see #getAccessibleActionCount
  113.      */
  114.     public abstract Object getAccessibleActionAnchor(int i);
  115.  
  116.     /**
  117.      * Get the index with the hypertext document at which this
  118.      * link begins
  119.      *
  120.      * @return index of start of link
  121.      */
  122.     public abstract int getStartIndex();
  123.  
  124.     /**
  125.      * Get the index with the hypertext document at which this
  126.      * link ends
  127.      *
  128.      * @return index of end of link
  129.      */
  130.     public abstract int getEndIndex();
  131. }
  132.