1. /*
  2. * @(#)TabableView.java 1.6 00/02/02
  3. *
  4. * Copyright 1998-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package javax.swing.text;
  11. /**
  12. * Interface for View's that have size dependant
  13. * upon tabs.
  14. *
  15. * @author Timothy Prinzing
  16. * @author Scott Violet
  17. * @version 1.6 02/02/00
  18. * @see TabExpander
  19. * @see LabelView
  20. * @see ParagraphView
  21. */
  22. public interface TabableView {
  23. /**
  24. * Determines the desired span when using the given
  25. * tab expansion implementation. If a container
  26. * calls this method, it will do so prior to the
  27. * normal layout which would call getPreferredSpan.
  28. * A view implementing this should give the same
  29. * result in any subsequent calls to getPreferredSpan
  30. * along the axis of tab expansion.
  31. *
  32. * @param x the position the view would be located
  33. * at for the purpose of tab expansion >= 0.
  34. * @param e how to expand the tabs when encountered.
  35. * @return the desired span >= 0
  36. */
  37. float getTabbedSpan(float x, TabExpander e);
  38. /**
  39. * Determines the span along the same axis as tab
  40. * expansion for a portion of the view. This is
  41. * intended for use by the TabExpander for cases
  42. * where the tab expansion involves aligning the
  43. * portion of text that doesn't have whitespace
  44. * relative to the tab stop. There is therefore
  45. * an assumption that the range given does not
  46. * contain tabs.
  47. *
  48. * @param p0 the starting location in the text document >= 0
  49. * @param p1 the ending location in the text document >= p0
  50. * @return the span >= 0
  51. */
  52. float getPartialSpan(int p0, int p1);
  53. }