1. /*
  2. * @(#)AccessibleHypertext.java 1.12 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.accessibility;
  8. import java.util.*;
  9. import java.awt.*;
  10. import javax.swing.text.*;
  11. /**
  12. * <P>The AccessibleHypertext class is the base class for all
  13. * classes that present hypertext information on the display. This class
  14. * provides the standard mechanism for an assistive technology to access
  15. * that text via its content, attributes, and spatial location.
  16. * It also provides standard mechanisms for manipulating hyperlinks.
  17. * Applications can determine if an object supports the AccessibleHypertext
  18. * interface by first obtaining its AccessibleContext (see {@link Accessible})
  19. * and then calling the {@link AccessibleContext#getAccessibleText}
  20. * method of AccessibleContext. If the return value is a class which extends
  21. * AccessibleHypertext, then that object supports AccessibleHypertext.
  22. *
  23. * @see Accessible
  24. * @see Accessible#getAccessibleContext
  25. * @see AccessibleContext
  26. * @see AccessibleText
  27. * @see AccessibleContext#getAccessibleText
  28. *
  29. * @version
  30. * @author Peter Korn
  31. */
  32. public interface AccessibleHypertext extends AccessibleText {
  33. /**
  34. * Returns the number of links within this hypertext document.
  35. *
  36. * @return number of links in this hypertext doc.
  37. */
  38. public abstract int getLinkCount();
  39. /**
  40. * Returns the nth Link of this Hypertext document.
  41. *
  42. * @param linkIndex within the links of this Hypertext
  43. * @return Link object encapsulating the nth link(s)
  44. */
  45. public abstract AccessibleHyperlink getLink(int linkIndex);
  46. /**
  47. * Returns the index into an array of hyperlinks that
  48. * is associated with this character index, or -1 if there
  49. * is no hyperlink associated with this index.
  50. *
  51. * @param charIndex index within the text
  52. * @return index into the set of hyperlinks for this hypertext doc.
  53. */
  54. public abstract int getLinkIndex(int charIndex);
  55. }